Changeset 215592 in webkit for trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
- Timestamp:
- Apr 20, 2017, 4:55:45 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r215196 r215592 48 48 49 49 #define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE) 50 #define PROBE_ARG1_OFFSET (1 * PTR_SIZE) 51 #define PROBE_ARG2_OFFSET (2 * PTR_SIZE) 52 53 #define PROBE_FIRST_GPR_OFFSET (3 * PTR_SIZE) 50 #define PROBE_ARG_OFFSET (1 * PTR_SIZE) 51 52 #define PROBE_FIRST_GPR_OFFSET (2 * PTR_SIZE) 54 53 #define PROBE_CPU_EAX_OFFSET (PROBE_FIRST_GPR_OFFSET + (0 * PTR_SIZE)) 55 54 #define PROBE_CPU_ECX_OFFSET (PROBE_FIRST_GPR_OFFSET + (1 * PTR_SIZE)) … … 91 90 #if CPU(X86) 92 91 #define PROBE_SIZE (PROBE_CPU_XMM7_OFFSET + XMM_SIZE) 92 #define PROBE_ALIGNED_SIZE (PROBE_SIZE + (2 * XMM_SIZE)) 93 93 #else // CPU(X86_64) 94 94 #define PROBE_CPU_XMM8_OFFSET (PROBE_FIRST_XMM_OFFSET + (8 * XMM_SIZE)) … … 101 101 #define PROBE_CPU_XMM15_OFFSET (PROBE_FIRST_XMM_OFFSET + (15 * XMM_SIZE)) 102 102 #define PROBE_SIZE (PROBE_CPU_XMM15_OFFSET + XMM_SIZE) 103 #define PROBE_ALIGNED_SIZE (PROBE_SIZE + (4 * XMM_SIZE)) 103 104 #endif // CPU(X86_64) 104 105 … … 107 108 #define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x) 108 109 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline); 109 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline); 110 COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline); 110 COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline); 111 111 112 112 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.eax) == PROBE_CPU_EAX_OFFSET, ProbeContext_cpu_eax_offset_matches_ctiMasmProbeTrampoline); … … 132 132 #endif // CPU(X86_64) 133 133 134 COMPILE_ASSERT(!(PROBE_CPU_XMM0_OFFSET & 0x7), ProbeContext_cpu_xmm0_offset_should_be_8_byte_aligned); 135 134 136 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm0) == PROBE_CPU_XMM0_OFFSET, ProbeContext_cpu_xmm0_offset_matches_ctiMasmProbeTrampoline); 135 137 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm1) == PROBE_CPU_XMM1_OFFSET, ProbeContext_cpu_xmm1_offset_matches_ctiMasmProbeTrampoline); … … 153 155 154 156 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline); 157 COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0x1f), ProbeContext_aligned_size_offset_should_be_32_byte_aligned); 155 158 156 159 #undef PROBE_OFFSETOF … … 171 174 // esp[2 * ptrSize]: probeFunction 172 175 // esp[3 * ptrSize]: arg1 173 // esp[4 * ptrSize]: arg2 174 // esp[5 * ptrSize]: saved eax 175 // esp[6 * ptrSize]: saved esp 176 // esp[4 * ptrSize]: saved eax 177 // esp[5 * ptrSize]: saved esp 176 178 177 179 "movl %esp, %eax" "\n" 178 "subl $" STRINGIZE_VALUE_OF(PROBE_ SIZE) ", %esp" "\n"180 "subl $" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %esp" "\n" 179 181 180 182 // The X86_64 ABI specifies that the worse case stack alignment requirement … … 198 200 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "(%ebp)" "\n" 199 201 "movl 3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n" 200 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ARG 1_OFFSET) "(%ebp)" "\n"202 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "(%ebp)" "\n" 201 203 "movl 4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n" 202 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ ARG2_OFFSET) "(%ebp)" "\n"204 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%ebp)" "\n" 203 205 "movl 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n" 204 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%ebp)" "\n"205 "movl 6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"206 206 "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%ebp)" "\n" 207 207 … … 264 264 // Locate the "safe area" at 2x sizeof(ProbeContext) below where the new 265 265 // rsp will be. This time we don't have to 32-byte align it because we're 266 // not using t o store any xmm regs.266 // not using this area to store any xmm regs. 267 267 "movl " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%ebp), %eax" "\n" 268 "subl $2 * " STRINGIZE_VALUE_OF(PROBE_ SIZE) ", %eax" "\n"268 "subl $2 * " STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %eax" "\n" 269 269 "movl %eax, %esp" "\n" 270 270 … … 324 324 // esp[2 * ptrSize]: probeFunction 325 325 // esp[3 * ptrSize]: arg1 326 // esp[4 * ptrSize]: arg2 327 // esp[5 * ptrSize]: saved rax 328 // esp[6 * ptrSize]: saved rsp 326 // esp[4 * ptrSize]: saved rax 327 // esp[5 * ptrSize]: saved rsp 329 328 330 329 "movq %rsp, %rax" "\n" 331 "subq $" STRINGIZE_VALUE_OF(PROBE_ SIZE) ", %rsp" "\n"330 "subq $" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %rsp" "\n" 332 331 333 332 // The X86_64 ABI specifies that the worse case stack alignment requirement … … 351 350 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "(%rbp)" "\n" 352 351 "movq 3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n" 353 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ARG 1_OFFSET) "(%rbp)" "\n"352 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "(%rbp)" "\n" 354 353 "movq 4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n" 355 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ ARG2_OFFSET) "(%rbp)" "\n"354 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%rbp)" "\n" 356 355 "movq 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n" 357 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%rbp)" "\n"358 "movq 6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"359 356 "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%rbp)" "\n" 360 357 … … 449 446 // not using to store any xmm regs. 450 447 "movq " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%rbp), %rax" "\n" 451 "subq $2 * " STRINGIZE_VALUE_OF(PROBE_ SIZE) ", %rax" "\n"448 "subq $2 * " STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %rax" "\n" 452 449 "movq %rax, %rsp" "\n" 453 450 … … 532 529 // the address of the instruction immediately following the probe. 533 530 534 void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg 1, void* arg2)531 void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg) 535 532 { 536 533 push(RegisterID::esp); 537 534 push(RegisterID::eax); 538 move(TrustedImmPtr(arg2), RegisterID::eax); 539 push(RegisterID::eax); 540 move(TrustedImmPtr(arg1), RegisterID::eax); 535 move(TrustedImmPtr(arg), RegisterID::eax); 541 536 push(RegisterID::eax); 542 537 move(TrustedImmPtr(reinterpret_cast<void*>(function)), RegisterID::eax);
Note:
See TracChangeset
for help on using the changeset viewer.