[sh4] Prepare baseline JIT for DFG_JIT implementation.

https://bugs.webkit.org/show_bug.cgi?id=119758

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-08-13
Reviewed by Oliver Hunt.

* assembler/MacroAssemblerSH4.h:
    - Introduce a loadEffectiveAddress function to avoid code duplication.
    - Add ASSERTs and clean code.
* assembler/SH4Assembler.h:
    - Prepare DFG_JIT implementation.
    - Add ASSERTs.
* jit/JITStubs.cpp:
    - Add SH4 specific call for assertions.
* jit/JITStubs.h:
    - Cosmetic change.
* jit/JITStubsSH4.h:
    - Use constants to be more flexible with sh4 JIT stack frame.
* jit/JSInterfaceJIT.h:
    - Cosmetic change.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 268d5b31
2013-08-13 Julien Brianceau <jbrianceau@nds.com>
[sh4] Prepare baseline JIT for DFG_JIT implementation.
https://bugs.webkit.org/show_bug.cgi?id=119758
Reviewed by Oliver Hunt.
* assembler/MacroAssemblerSH4.h:
- Introduce a loadEffectiveAddress function to avoid code duplication.
- Add ASSERTs and clean code.
* assembler/SH4Assembler.h:
- Prepare DFG_JIT implementation.
- Add ASSERTs.
* jit/JITStubs.cpp:
- Add SH4 specific call for assertions.
* jit/JITStubs.h:
- Cosmetic change.
* jit/JITStubsSH4.h:
- Use constants to be more flexible with sh4 JIT stack frame.
* jit/JSInterfaceJIT.h:
- Cosmetic change.
2013-08-13 Oliver Hunt <oliver@apple.com>
Harden executeConstruct against incorrect return types from host functions
......
......@@ -114,6 +114,8 @@ void performPlatformSpecificJITAssertions(VM* vm)
performARMJITAssertions();
#elif CPU(MIPS)
performMIPSJITAssertions();
#elif CPU(SH4)
performSH4JITAssertions();
#endif
}
......
......@@ -266,15 +266,19 @@ struct JITStackFrame {
JITStubArg args[6];
ReturnAddressPtr thunkReturnAddress;
void* savedR10;
void* savedR11;
void* savedR13;
void* savedRPR;
void* savedR14;
// These arguments are passed in r5, r6 and r7.
JSStack* stack;
CallFrame* callFrame;
JSValue* exception;
// These arguments are passed on the stack.
void* unused1;
VM* vm;
......
......@@ -41,6 +41,9 @@
namespace JSC {
#define THUNK_RETURN_ADDRESS_OFFSET 56
#define SAVED_R8_OFFSET 60
#define SYMBOL_STRING(name) #name
/* code (r4), JSStack* (r5), CallFrame* (r6), void* unused1 (r7), void* unused2(sp), VM (sp)*/
......@@ -57,11 +60,11 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"mov.l r13, @-r15" "\n"
"mov.l r11, @-r15" "\n"
"mov.l r10, @-r15" "\n"
"add #-60, r15" "\n"
"add #-" STRINGIZE_VALUE_OF(SAVED_R8_OFFSET) ", r15" "\n"
"mov r6, r14" "\n"
"jsr @r4" "\n"
"nop" "\n"
"add #60, r15" "\n"
"add #" STRINGIZE_VALUE_OF(SAVED_R8_OFFSET) ", r15" "\n"
"mov.l @r15+,r10" "\n"
"mov.l @r15+,r11" "\n"
"mov.l @r15+,r13" "\n"
......@@ -84,7 +87,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"mov.l @(r0,r12),r11" "\n"
"jsr @r11" "\n"
"nop" "\n"
"add #60, r15" "\n"
"add #" STRINGIZE_VALUE_OF(SAVED_R8_OFFSET) ", r15" "\n"
"mov.l @r15+,r10" "\n"
"mov.l @r15+,r11" "\n"
"mov.l @r15+,r13" "\n"
......@@ -108,7 +111,8 @@ SYMBOL_STRING(ctiVMThrowTrampolineSlowpath) ":" "\n"
// When cti_vm_throw_slowpath returns, r0 has callFrame and r1 has handler address
"nop" "\n"
"mov r0, r14" "\n"
"jmp @r1" "\n"
"lds r1, pr" "\n"
"rts" "\n"
"nop" "\n"
".align 2" "\n"
".L2"SYMBOL_STRING(cti_vm_throw_slowpath)":.long " SYMBOL_STRING(cti_vm_throw_slowpath)"@GOT \n"
......@@ -118,7 +122,7 @@ asm volatile (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"add #60, r15" "\n"
"add #" STRINGIZE_VALUE_OF(SAVED_R8_OFFSET) ", r15" "\n"
"mov.l @r15+,r10" "\n"
"mov.l @r15+,r11" "\n"
"mov.l @r15+,r13" "\n"
......@@ -139,12 +143,12 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
".globl " SYMBOL_STRING(cti_##op) "\n" \
SYMBOL_STRING(cti_##op) ":" "\n" \
"sts pr, r11" "\n" \
"mov.l r11, @(0x38, r15)" "\n" \
"mov.l r11, @(" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) ", r15)" "\n" \
"mov.l .L2"SYMBOL_STRING(JITStubThunked_##op)",r0" "\n" \
"mov.l @(r0,r12),r11" "\n" \
"jsr @r11" "\n" \
"nop" "\n" \
"mov.l @(0x38, r15), r11 " "\n" \
"mov.l @(" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) ", r15), r11 " "\n" \
"lds r11, pr " "\n" \
"rts" "\n" \
"nop" "\n" \
......@@ -153,6 +157,12 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
); \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
static void performSH4JITAssertions()
{
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == THUNK_RETURN_ADDRESS_OFFSET);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, savedR8) == SAVED_R8_OFFSET);
}
} // namespace JSC
#endif // JITStubsSH4_h
......@@ -164,14 +164,12 @@ namespace JSC {
static const RegisterID returnValueRegister = SH4Registers::r0;
static const RegisterID cachedResultRegister = SH4Registers::r0;
static const FPRegisterID fpRegT0 = SH4Registers::fr0;
static const FPRegisterID fpRegT1 = SH4Registers::fr2;
static const FPRegisterID fpRegT2 = SH4Registers::fr4;
static const FPRegisterID fpRegT3 = SH4Registers::fr6;
static const FPRegisterID fpRegT4 = SH4Registers::fr8;
static const FPRegisterID fpRegT5 = SH4Registers::fr10;
static const FPRegisterID fpRegT6 = SH4Registers::fr12;
static const FPRegisterID fpRegT7 = SH4Registers::fr14;
static const FPRegisterID fpRegT0 = SH4Registers::dr0;
static const FPRegisterID fpRegT1 = SH4Registers::dr2;
static const FPRegisterID fpRegT2 = SH4Registers::dr4;
static const FPRegisterID fpRegT3 = SH4Registers::dr6;
static const FPRegisterID fpRegT4 = SH4Registers::dr8;
static const FPRegisterID fpRegT5 = SH4Registers::dr10;
#else
#error "JIT not supported on this platform."
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment