Changeset 43273 in webkit for trunk/JavaScriptCore/jit
- Timestamp:
- May 5, 2009, 8:20:10 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/jit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r43227 r43273 45 45 namespace JSC { 46 46 47 #if COMPILER(GCC) && PLATFORM(X86)48 49 COMPILE_ASSERT(STUB_ARGS_code == 0x0C, STUB_ARGS_code_is_0x0C);50 COMPILE_ASSERT(STUB_ARGS_callFrame == 0x0E, STUB_ARGS_callFrame_is_0x0E);51 52 #if PLATFORM(DARWIN)53 #define SYMBOL_STRING(name) "_" #name54 #else55 #define SYMBOL_STRING(name) #name56 #endif57 58 asm(59 ".globl " SYMBOL_STRING(ctiTrampoline) "\n"60 SYMBOL_STRING(ctiTrampoline) ":" "\n"61 "pushl %ebp" "\n"62 "movl %esp, %ebp" "\n"63 "pushl %esi" "\n"64 "pushl %edi" "\n"65 "pushl %ebx" "\n"66 "subl $0x1c, %esp" "\n"67 "movl $512, %esi" "\n"68 "movl 0x38(%esp), %edi" "\n" // Ox38 = 0x0E * 4, 0x0E = STUB_ARGS_callFrame (see assertion above)69 "call *0x30(%esp)" "\n" // Ox30 = 0x0C * 4, 0x0C = STUB_ARGS_code (see assertion above)70 "addl $0x1c, %esp" "\n"71 "popl %ebx" "\n"72 "popl %edi" "\n"73 "popl %esi" "\n"74 "popl %ebp" "\n"75 "ret" "\n"76 );77 78 asm(79 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"80 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"81 #if USE(JIT_STUB_ARGUMENT_VA_LIST)82 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPvz) "\n"83 #else84 #if USE(JIT_STUB_ARGUMENT_REGISTER)85 "movl %esp, %ecx" "\n"86 #else // JIT_STUB_ARGUMENT_STACK87 "movl %esp, 0(%esp)" "\n"88 #endif89 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPPv) "\n"90 #endif91 "addl $0x1c, %esp" "\n"92 "popl %ebx" "\n"93 "popl %edi" "\n"94 "popl %esi" "\n"95 "popl %ebp" "\n"96 "ret" "\n"97 );98 99 #elif COMPILER(GCC) && PLATFORM(X86_64)100 101 COMPILE_ASSERT(STUB_ARGS_code == 0x10, STUB_ARGS_code_is_0x10);102 COMPILE_ASSERT(STUB_ARGS_callFrame == 0x12, STUB_ARGS_callFrame_is_0x12);103 104 #if PLATFORM(DARWIN)105 #define SYMBOL_STRING(name) "_" #name106 #else107 #define SYMBOL_STRING(name) #name108 #endif109 110 asm(111 ".globl " SYMBOL_STRING(ctiTrampoline) "\n"112 SYMBOL_STRING(ctiTrampoline) ":" "\n"113 "pushq %rbp" "\n"114 "movq %rsp, %rbp" "\n"115 "pushq %r12" "\n"116 "pushq %r13" "\n"117 "pushq %r14" "\n"118 "pushq %r15" "\n"119 "pushq %rbx" "\n"120 "subq $0x48, %rsp" "\n"121 "movq $512, %r12" "\n"122 "movq $0xFFFF000000000000, %r14" "\n"123 "movq $0xFFFF000000000002, %r15" "\n"124 "movq 0x90(%rsp), %r13" "\n" // Ox90 = 0x12 * 8, 0x12 = STUB_ARGS_callFrame (see assertion above)125 "call *0x80(%rsp)" "\n" // Ox80 = 0x10 * 8, 0x10 = STUB_ARGS_code (see assertion above)126 "addq $0x48, %rsp" "\n"127 "popq %rbx" "\n"128 "popq %r15" "\n"129 "popq %r14" "\n"130 "popq %r13" "\n"131 "popq %r12" "\n"132 "popq %rbp" "\n"133 "ret" "\n"134 );135 136 asm(137 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"138 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"139 #if USE(JIT_STUB_ARGUMENT_REGISTER)140 "movq %rsp, %rdi" "\n"141 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPPv) "\n"142 #else // JIT_STUB_ARGUMENT_VA_LIST or JIT_STUB_ARGUMENT_STACK143 #error "JIT_STUB_ARGUMENT configuration not supported."144 #endif145 "addq $0x48, %rsp" "\n"146 "popq %rbx" "\n"147 "popq %r15" "\n"148 "popq %r14" "\n"149 "popq %r13" "\n"150 "popq %r12" "\n"151 "popq %rbp" "\n"152 "ret" "\n"153 );154 155 #elif COMPILER(MSVC)156 157 extern "C" {158 159 __declspec(naked) EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*)160 {161 __asm {162 push ebp;163 mov ebp, esp;164 push esi;165 push edi;166 push ebx;167 sub esp, 0x1c;168 mov esi, 512;169 mov ecx, esp;170 mov edi, [esp + 0x38];171 call [esp + 0x30]; // Ox30 = 0x0C * 4, 0x0C = STUB_ARGS_code (see assertion above)172 add esp, 0x1c;173 pop ebx;174 pop edi;175 pop esi;176 pop ebp;177 ret;178 }179 }180 181 __declspec(naked) void ctiVMThrowTrampoline()182 {183 __asm {184 #if USE(JIT_STUB_ARGUMENT_REGISTER)185 mov ecx, esp;186 #else // JIT_STUB_ARGUMENT_VA_LIST or JIT_STUB_ARGUMENT_STACK187 #error "JIT_STUB_ARGUMENT configuration not supported."188 #endif189 call JSC::JITStubs::cti_vm_throw;190 add esp, 0x1c;191 pop ebx;192 pop edi;193 pop esi;194 pop ebp;195 ret;196 }197 }198 199 }200 201 #endif202 203 47 void ctiSetReturnAddress(void** addressOfReturnAddress, void* newDestinationToReturnTo) 204 48 { -
trunk/JavaScriptCore/jit/JIT.h
r43220 r43273 44 44 #include <wtf/Vector.h> 45 45 46 #if PLATFORM(X86_64)47 #define STUB_ARGS_offset 0x1048 #else49 #define STUB_ARGS_offset 0x0C50 #endif51 52 #define STUB_ARGS_code (STUB_ARGS_offset)53 #define STUB_ARGS_registerFile (STUB_ARGS_offset + 1)54 #define STUB_ARGS_callFrame (STUB_ARGS_offset + 2)55 #define STUB_ARGS_exception (STUB_ARGS_offset + 3)56 #define STUB_ARGS_profilerReference (STUB_ARGS_offset + 4)57 #define STUB_ARGS_globalData (STUB_ARGS_offset + 5)58 59 #define ARG_callFrame static_cast<CallFrame*>(ARGS[STUB_ARGS_callFrame])60 #define ARG_registerFile static_cast<RegisterFile*>(ARGS[STUB_ARGS_registerFile])61 #define ARG_exception static_cast<JSValue*>(ARGS[STUB_ARGS_exception])62 #define ARG_profilerReference static_cast<Profiler**>(ARGS[STUB_ARGS_profilerReference])63 #define ARG_globalData static_cast<JSGlobalData*>(ARGS[STUB_ARGS_globalData])64 65 #define ARG_setCallFrame(newCallFrame) (ARGS[STUB_ARGS_callFrame] = (newCallFrame))66 67 #define ARG_src1 JSValue::decode(static_cast<EncodedJSValue>(ARGS[1]))68 #define ARG_src2 JSValue::decode(static_cast<EncodedJSValue>(ARGS[2]))69 #define ARG_src3 JSValue::decode(static_cast<EncodedJSValue>(ARGS[3]))70 #define ARG_src4 JSValue::decode(static_cast<EncodedJSValue>(ARGS[4]))71 #define ARG_src5 JSValue::decode(static_cast<EncodedJSValue>(ARGS[5]))72 #define ARG_id1 static_cast<Identifier*>(ARGS[1])73 #define ARG_id2 static_cast<Identifier*>(ARGS[2])74 #define ARG_id3 static_cast<Identifier*>(ARGS[3])75 #define ARG_id4 static_cast<Identifier*>(ARGS[4])76 #define ARG_int1 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[1]))77 #define ARG_int2 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[2]))78 #define ARG_int3 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[3]))79 #define ARG_int4 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[4]))80 #define ARG_int5 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[5]))81 #define ARG_int6 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[6]))82 #define ARG_func1 static_cast<FuncDeclNode*>(ARGS[1])83 #define ARG_funcexp1 static_cast<FuncExprNode*>(ARGS[1])84 #define ARG_regexp1 static_cast<RegExp*>(ARGS[1])85 #define ARG_pni1 static_cast<JSPropertyNameIterator*>(ARGS[1])86 #define ARG_returnAddress2 static_cast<void*>(ARGS[2])87 #define ARG_codeBlock4 static_cast<CodeBlock*>(ARGS[4])88 89 #define STUB_RETURN_ADDRESS_SLOT (ARGS[-1])90 91 46 namespace JSC { 92 47 … … 199 154 MacroAssembler::Call callReturnLocation; 200 155 MacroAssembler::Label coldPathOther; 201 };202 203 extern "C" {204 void ctiVMThrowTrampoline();205 156 }; 206 157 -
trunk/JavaScriptCore/jit/JITCode.h
r43220 r43273 39 39 class JSGlobalData; 40 40 class RegisterFile; 41 42 extern "C" {43 EncodedJSValue ctiTrampoline(44 #if PLATFORM(X86_64)45 // FIXME: (bug #22910) this will force all arguments onto the stack (regparm(0) does not appear to have any effect).46 // We can allow register passing here, and move the writes of these values into the trampoline.47 void*, void*, void*, void*, void*, void*,48 #endif49 void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*);50 };51 41 52 42 class JITCode { -
trunk/JavaScriptCore/jit/JITStubs.cpp
r43220 r43273 62 62 63 63 namespace JSC { 64 65 66 #if COMPILER(GCC) && PLATFORM(X86) 67 68 COMPILE_ASSERT(STUB_ARGS_code == 0x0C, STUB_ARGS_code_is_0x0C); 69 COMPILE_ASSERT(STUB_ARGS_callFrame == 0x0E, STUB_ARGS_callFrame_is_0x0E); 70 71 #if PLATFORM(DARWIN) 72 #define SYMBOL_STRING(name) "_" #name 73 #else 74 #define SYMBOL_STRING(name) #name 75 #endif 76 77 asm( 78 ".globl " SYMBOL_STRING(ctiTrampoline) "\n" 79 SYMBOL_STRING(ctiTrampoline) ":" "\n" 80 "pushl %ebp" "\n" 81 "movl %esp, %ebp" "\n" 82 "pushl %esi" "\n" 83 "pushl %edi" "\n" 84 "pushl %ebx" "\n" 85 "subl $0x1c, %esp" "\n" 86 "movl $512, %esi" "\n" 87 "movl 0x38(%esp), %edi" "\n" // Ox38 = 0x0E * 4, 0x0E = STUB_ARGS_callFrame (see assertion above) 88 "call *0x30(%esp)" "\n" // Ox30 = 0x0C * 4, 0x0C = STUB_ARGS_code (see assertion above) 89 "addl $0x1c, %esp" "\n" 90 "popl %ebx" "\n" 91 "popl %edi" "\n" 92 "popl %esi" "\n" 93 "popl %ebp" "\n" 94 "ret" "\n" 95 ); 96 97 asm( 98 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" 99 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" 100 #if USE(JIT_STUB_ARGUMENT_VA_LIST) 101 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPvz) "\n" 102 #else 103 #if USE(JIT_STUB_ARGUMENT_REGISTER) 104 "movl %esp, %ecx" "\n" 105 #else // JIT_STUB_ARGUMENT_STACK 106 "movl %esp, 0(%esp)" "\n" 107 #endif 108 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPPv) "\n" 109 #endif 110 "addl $0x1c, %esp" "\n" 111 "popl %ebx" "\n" 112 "popl %edi" "\n" 113 "popl %esi" "\n" 114 "popl %ebp" "\n" 115 "ret" "\n" 116 ); 117 118 #elif COMPILER(GCC) && PLATFORM(X86_64) 119 120 COMPILE_ASSERT(STUB_ARGS_code == 0x10, STUB_ARGS_code_is_0x10); 121 COMPILE_ASSERT(STUB_ARGS_callFrame == 0x12, STUB_ARGS_callFrame_is_0x12); 122 123 #if PLATFORM(DARWIN) 124 #define SYMBOL_STRING(name) "_" #name 125 #else 126 #define SYMBOL_STRING(name) #name 127 #endif 128 129 asm( 130 ".globl " SYMBOL_STRING(ctiTrampoline) "\n" 131 SYMBOL_STRING(ctiTrampoline) ":" "\n" 132 "pushq %rbp" "\n" 133 "movq %rsp, %rbp" "\n" 134 "pushq %r12" "\n" 135 "pushq %r13" "\n" 136 "pushq %r14" "\n" 137 "pushq %r15" "\n" 138 "pushq %rbx" "\n" 139 "subq $0x48, %rsp" "\n" 140 "movq $512, %r12" "\n" 141 "movq $0xFFFF000000000000, %r14" "\n" 142 "movq $0xFFFF000000000002, %r15" "\n" 143 "movq 0x90(%rsp), %r13" "\n" // Ox90 = 0x12 * 8, 0x12 = STUB_ARGS_callFrame (see assertion above) 144 "call *0x80(%rsp)" "\n" // Ox80 = 0x10 * 8, 0x10 = STUB_ARGS_code (see assertion above) 145 "addq $0x48, %rsp" "\n" 146 "popq %rbx" "\n" 147 "popq %r15" "\n" 148 "popq %r14" "\n" 149 "popq %r13" "\n" 150 "popq %r12" "\n" 151 "popq %rbp" "\n" 152 "ret" "\n" 153 ); 154 155 asm( 156 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" 157 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" 158 #if USE(JIT_STUB_ARGUMENT_REGISTER) 159 "movq %rsp, %rdi" "\n" 160 "call " SYMBOL_STRING(_ZN3JSC8JITStubs12cti_vm_throwEPPv) "\n" 161 #else // JIT_STUB_ARGUMENT_VA_LIST or JIT_STUB_ARGUMENT_STACK 162 #error "JIT_STUB_ARGUMENT configuration not supported." 163 #endif 164 "addq $0x48, %rsp" "\n" 165 "popq %rbx" "\n" 166 "popq %r15" "\n" 167 "popq %r14" "\n" 168 "popq %r13" "\n" 169 "popq %r12" "\n" 170 "popq %rbp" "\n" 171 "ret" "\n" 172 ); 173 174 #elif COMPILER(MSVC) 175 176 extern "C" { 177 178 __declspec(naked) EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*) 179 { 180 __asm { 181 push ebp; 182 mov ebp, esp; 183 push esi; 184 push edi; 185 push ebx; 186 sub esp, 0x1c; 187 mov esi, 512; 188 mov ecx, esp; 189 mov edi, [esp + 0x38]; 190 call [esp + 0x30]; // Ox30 = 0x0C * 4, 0x0C = STUB_ARGS_code (see assertion above) 191 add esp, 0x1c; 192 pop ebx; 193 pop edi; 194 pop esi; 195 pop ebp; 196 ret; 197 } 198 } 199 200 __declspec(naked) void ctiVMThrowTrampoline() 201 { 202 __asm { 203 #if USE(JIT_STUB_ARGUMENT_REGISTER) 204 mov ecx, esp; 205 #else // JIT_STUB_ARGUMENT_VA_LIST or JIT_STUB_ARGUMENT_STACK 206 #error "JIT_STUB_ARGUMENT configuration not supported." 207 #endif 208 call JSC::JITStubs::cti_vm_throw; 209 add esp, 0x1c; 210 pop ebx; 211 pop edi; 212 pop esi; 213 pop ebp; 214 ret; 215 } 216 } 217 218 } 219 220 #endif 64 221 65 222 #if ENABLE(OPCODE_SAMPLING) … … 2286 2443 } 2287 2444 2288 #undef STUB_RETURN_ADDRESS2289 #undef STUB_SET_RETURN_ADDRESS2290 #undef BEGIN_STUB_FUNCTION2291 #undef CHECK_FOR_EXCEPTION2292 #undef CHECK_FOR_EXCEPTION_AT_END2293 #undef CHECK_FOR_EXCEPTION_VOID2294 #undef VM_THROW_EXCEPTION2295 #undef VM_THROW_EXCEPTION_22296 #undef VM_THROW_EXCEPTION_AT_END2297 2298 2445 } // namespace JSC 2299 2446 -
trunk/JavaScriptCore/jit/JITStubs.h
r43220 r43273 37 37 namespace JSC { 38 38 39 class CodeBlock; 39 40 class ExecutablePool; 41 class Identifier; 42 class JSGlobalData; 40 43 class JSGlobalData; 41 44 class JSObject; 42 45 class JSPropertyNameIterator; 46 class JSValue; 43 47 class JSValueEncodedAsPointer; 44 class CodeBlock; 45 class JSValue; 46 class Identifier; 48 class Profiler; 47 49 class PropertySlot; 48 50 class PutPropertySlot; 51 class RegisterFile; 49 52 50 53 #if USE(JIT_STUB_ARGUMENT_VA_LIST) … … 74 77 #endif 75 78 79 #if PLATFORM(X86_64) 80 #define STUB_ARGS_offset 0x10 81 #else 82 #define STUB_ARGS_offset 0x0C 83 #endif 84 85 #define STUB_ARGS_code (STUB_ARGS_offset) 86 #define STUB_ARGS_registerFile (STUB_ARGS_offset + 1) 87 #define STUB_ARGS_callFrame (STUB_ARGS_offset + 2) 88 #define STUB_ARGS_exception (STUB_ARGS_offset + 3) 89 #define STUB_ARGS_profilerReference (STUB_ARGS_offset + 4) 90 #define STUB_ARGS_globalData (STUB_ARGS_offset + 5) 91 92 #define ARG_callFrame static_cast<CallFrame*>(ARGS[STUB_ARGS_callFrame]) 93 #define ARG_registerFile static_cast<RegisterFile*>(ARGS[STUB_ARGS_registerFile]) 94 #define ARG_exception static_cast<JSValue*>(ARGS[STUB_ARGS_exception]) 95 #define ARG_profilerReference static_cast<Profiler**>(ARGS[STUB_ARGS_profilerReference]) 96 #define ARG_globalData static_cast<JSGlobalData*>(ARGS[STUB_ARGS_globalData]) 97 #define ARG_setCallFrame(newCallFrame) (ARGS[STUB_ARGS_callFrame] = (newCallFrame)) 98 99 #define ARG_src1 JSValue::decode(static_cast<EncodedJSValue>(ARGS[1])) 100 #define ARG_src2 JSValue::decode(static_cast<EncodedJSValue>(ARGS[2])) 101 #define ARG_src3 JSValue::decode(static_cast<EncodedJSValue>(ARGS[3])) 102 #define ARG_src4 JSValue::decode(static_cast<EncodedJSValue>(ARGS[4])) 103 #define ARG_src5 JSValue::decode(static_cast<EncodedJSValue>(ARGS[5])) 104 #define ARG_id1 static_cast<Identifier*>(ARGS[1]) 105 #define ARG_id2 static_cast<Identifier*>(ARGS[2]) 106 #define ARG_id3 static_cast<Identifier*>(ARGS[3]) 107 #define ARG_id4 static_cast<Identifier*>(ARGS[4]) 108 #define ARG_int1 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[1])) 109 #define ARG_int2 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[2])) 110 #define ARG_int3 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[3])) 111 #define ARG_int4 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[4])) 112 #define ARG_int5 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[5])) 113 #define ARG_int6 static_cast<int32_t>(reinterpret_cast<intptr_t>(ARGS[6])) 114 #define ARG_func1 static_cast<FuncDeclNode*>(ARGS[1]) 115 #define ARG_funcexp1 static_cast<FuncExprNode*>(ARGS[1]) 116 #define ARG_regexp1 static_cast<RegExp*>(ARGS[1]) 117 #define ARG_pni1 static_cast<JSPropertyNameIterator*>(ARGS[1]) 118 #define ARG_returnAddress2 static_cast<void*>(ARGS[2]) 119 #define ARG_codeBlock4 static_cast<CodeBlock*>(ARGS[4]) 120 121 #define STUB_RETURN_ADDRESS_SLOT (ARGS[-1]) 122 76 123 // The Mac compilers are fine with this, 77 124 #if PLATFORM(MAC) … … 89 136 #define RETURN_PAIR(a,b) VoidPtrPairValue pair = {{ a, b }}; return pair.i 90 137 #endif 138 139 extern "C" void ctiVMThrowTrampoline(); 140 extern "C" EncodedJSValue ctiTrampoline( 141 #if PLATFORM(X86_64) 142 // FIXME: (bug #22910) this will force all arguments onto the stack (regparm(0) does not appear to have any effect). 143 // We can allow register passing here, and move the writes of these values into the trampoline. 144 void*, void*, void*, void*, void*, void*, 145 #endif 146 void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*); 91 147 92 148 class JITStubs {
Note:
See TracChangeset
for help on using the changeset viewer.