Changeset 220926 in webkit
- Timestamp:
- Aug 18, 2017 12:20:23 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r220921 r220926 1 2017-08-18 Per Arne Vollan <pvollan@apple.com> 2 3 Implement 32-bit MacroAssembler::probe support for Windows. 4 https://bugs.webkit.org/show_bug.cgi?id=175449 5 6 Reviewed by Mark Lam. 7 8 This is needed to enable the DFG. 9 10 * assembler/MacroAssemblerX86Common.cpp: 11 * assembler/testmasm.cpp: 12 (JSC::run): 13 (dllLauncherEntryPoint): 14 * shell/CMakeLists.txt: 15 * shell/PlatformWin.cmake: 16 1 17 2017-08-18 Mark Lam <mark.lam@apple.com> 2 18 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r220921 r220926 37 37 extern "C" void ctiMasmProbeTrampoline(); 38 38 39 #if COMPILER(GCC_OR_CLANG)40 41 39 // The following are offsets for Probe::State fields accessed by the ctiMasmProbeTrampoline stub. 42 40 … … 111 109 // you need to change ctiMasmProbeTrampoline offsets above to match. 112 110 #define PROBE_OFFSETOF(x) offsetof(struct Probe::State, x) 111 #define PROBE_OFFSETOF_REG(x, reg) offsetof(struct Probe::State, x) + reg * sizeof((reinterpret_cast<Probe::State*>(0))->x[reg]) 113 112 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeState_probeFunction_offset_matches_ctiMasmProbeTrampoline); 114 113 COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeState_arg_offset_matches_ctiMasmProbeTrampoline); … … 116 115 COMPILE_ASSERT(PROBE_OFFSETOF(initializeStackArg) == PROBE_INIT_STACK_ARG_OFFSET, ProbeState_initializeStackArg_offset_matches_ctiMasmProbeTrampoline); 117 116 118 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::eax]) == PROBE_CPU_EAX_OFFSET, ProbeState_cpu_eax_offset_matches_ctiMasmProbeTrampoline);119 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::ecx]) == PROBE_CPU_ECX_OFFSET, ProbeState_cpu_ecx_offset_matches_ctiMasmProbeTrampoline);120 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::edx]) == PROBE_CPU_EDX_OFFSET, ProbeState_cpu_edx_offset_matches_ctiMasmProbeTrampoline);121 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::ebx]) == PROBE_CPU_EBX_OFFSET, ProbeState_cpu_ebx_offset_matches_ctiMasmProbeTrampoline);122 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::esp]) == PROBE_CPU_ESP_OFFSET, ProbeState_cpu_esp_offset_matches_ctiMasmProbeTrampoline);123 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::ebp]) == PROBE_CPU_EBP_OFFSET, ProbeState_cpu_ebp_offset_matches_ctiMasmProbeTrampoline);124 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::esi]) == PROBE_CPU_ESI_OFFSET, ProbeState_cpu_esi_offset_matches_ctiMasmProbeTrampoline);125 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::edi]) == PROBE_CPU_EDI_OFFSET, ProbeState_cpu_edi_offset_matches_ctiMasmProbeTrampoline);126 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.sprs[X86Registers::eip]) == PROBE_CPU_EIP_OFFSET, ProbeState_cpu_eip_offset_matches_ctiMasmProbeTrampoline);127 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.sprs[X86Registers::eflags]) == PROBE_CPU_EFLAGS_OFFSET, ProbeState_cpu_eflags_offset_matches_ctiMasmProbeTrampoline);117 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::eax) == PROBE_CPU_EAX_OFFSET, ProbeState_cpu_eax_offset_matches_ctiMasmProbeTrampoline); 118 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::ecx) == PROBE_CPU_ECX_OFFSET, ProbeState_cpu_ecx_offset_matches_ctiMasmProbeTrampoline); 119 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::edx) == PROBE_CPU_EDX_OFFSET, ProbeState_cpu_edx_offset_matches_ctiMasmProbeTrampoline); 120 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::ebx) == PROBE_CPU_EBX_OFFSET, ProbeState_cpu_ebx_offset_matches_ctiMasmProbeTrampoline); 121 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::esp) == PROBE_CPU_ESP_OFFSET, ProbeState_cpu_esp_offset_matches_ctiMasmProbeTrampoline); 122 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::ebp) == PROBE_CPU_EBP_OFFSET, ProbeState_cpu_ebp_offset_matches_ctiMasmProbeTrampoline); 123 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::esi) == PROBE_CPU_ESI_OFFSET, ProbeState_cpu_esi_offset_matches_ctiMasmProbeTrampoline); 124 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::edi) == PROBE_CPU_EDI_OFFSET, ProbeState_cpu_edi_offset_matches_ctiMasmProbeTrampoline); 125 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.sprs, X86Registers::eip) == PROBE_CPU_EIP_OFFSET, ProbeState_cpu_eip_offset_matches_ctiMasmProbeTrampoline); 126 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.sprs, X86Registers::eflags) == PROBE_CPU_EFLAGS_OFFSET, ProbeState_cpu_eflags_offset_matches_ctiMasmProbeTrampoline); 128 127 129 128 #if CPU(X86_64) 130 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r8]) == PROBE_CPU_R8_OFFSET, ProbeState_cpu_r8_offset_matches_ctiMasmProbeTrampoline);131 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r9]) == PROBE_CPU_R9_OFFSET, ProbeState_cpu_r9_offset_matches_ctiMasmProbeTrampoline);132 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r10]) == PROBE_CPU_R10_OFFSET, ProbeState_cpu_r10_offset_matches_ctiMasmProbeTrampoline);133 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r11]) == PROBE_CPU_R11_OFFSET, ProbeState_cpu_r11_offset_matches_ctiMasmProbeTrampoline);134 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r12]) == PROBE_CPU_R12_OFFSET, ProbeState_cpu_r12_offset_matches_ctiMasmProbeTrampoline);135 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r13]) == PROBE_CPU_R13_OFFSET, ProbeState_cpu_r13_offset_matches_ctiMasmProbeTrampoline);136 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r14]) == PROBE_CPU_R14_OFFSET, ProbeState_cpu_r14_offset_matches_ctiMasmProbeTrampoline);137 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.gprs[X86Registers::r15]) == PROBE_CPU_R15_OFFSET, ProbeState_cpu_r15_offset_matches_ctiMasmProbeTrampoline);129 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r8) == PROBE_CPU_R8_OFFSET, ProbeState_cpu_r8_offset_matches_ctiMasmProbeTrampoline); 130 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r9) == PROBE_CPU_R9_OFFSET, ProbeState_cpu_r9_offset_matches_ctiMasmProbeTrampoline); 131 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r10) == PROBE_CPU_R10_OFFSET, ProbeState_cpu_r10_offset_matches_ctiMasmProbeTrampoline); 132 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r11) == PROBE_CPU_R11_OFFSET, ProbeState_cpu_r11_offset_matches_ctiMasmProbeTrampoline); 133 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r12) == PROBE_CPU_R12_OFFSET, ProbeState_cpu_r12_offset_matches_ctiMasmProbeTrampoline); 134 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r13) == PROBE_CPU_R13_OFFSET, ProbeState_cpu_r13_offset_matches_ctiMasmProbeTrampoline); 135 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r14) == PROBE_CPU_R14_OFFSET, ProbeState_cpu_r14_offset_matches_ctiMasmProbeTrampoline); 136 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.gprs, X86Registers::r15) == PROBE_CPU_R15_OFFSET, ProbeState_cpu_r15_offset_matches_ctiMasmProbeTrampoline); 138 137 #endif // CPU(X86_64) 139 138 140 139 COMPILE_ASSERT(!(PROBE_CPU_XMM0_OFFSET & 0x7), ProbeState_cpu_xmm0_offset_should_be_8_byte_aligned); 141 140 142 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm0]) == PROBE_CPU_XMM0_OFFSET, ProbeState_cpu_xmm0_offset_matches_ctiMasmProbeTrampoline);143 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm1]) == PROBE_CPU_XMM1_OFFSET, ProbeState_cpu_xmm1_offset_matches_ctiMasmProbeTrampoline);144 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm2]) == PROBE_CPU_XMM2_OFFSET, ProbeState_cpu_xmm2_offset_matches_ctiMasmProbeTrampoline);145 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm3]) == PROBE_CPU_XMM3_OFFSET, ProbeState_cpu_xmm3_offset_matches_ctiMasmProbeTrampoline);146 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm4]) == PROBE_CPU_XMM4_OFFSET, ProbeState_cpu_xmm4_offset_matches_ctiMasmProbeTrampoline);147 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm5]) == PROBE_CPU_XMM5_OFFSET, ProbeState_cpu_xmm5_offset_matches_ctiMasmProbeTrampoline);148 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm6]) == PROBE_CPU_XMM6_OFFSET, ProbeState_cpu_xmm6_offset_matches_ctiMasmProbeTrampoline);149 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm7]) == PROBE_CPU_XMM7_OFFSET, ProbeState_cpu_xmm7_offset_matches_ctiMasmProbeTrampoline);141 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm0) == PROBE_CPU_XMM0_OFFSET, ProbeState_cpu_xmm0_offset_matches_ctiMasmProbeTrampoline); 142 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm1) == PROBE_CPU_XMM1_OFFSET, ProbeState_cpu_xmm1_offset_matches_ctiMasmProbeTrampoline); 143 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm2) == PROBE_CPU_XMM2_OFFSET, ProbeState_cpu_xmm2_offset_matches_ctiMasmProbeTrampoline); 144 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm3) == PROBE_CPU_XMM3_OFFSET, ProbeState_cpu_xmm3_offset_matches_ctiMasmProbeTrampoline); 145 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm4) == PROBE_CPU_XMM4_OFFSET, ProbeState_cpu_xmm4_offset_matches_ctiMasmProbeTrampoline); 146 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm5) == PROBE_CPU_XMM5_OFFSET, ProbeState_cpu_xmm5_offset_matches_ctiMasmProbeTrampoline); 147 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm6) == PROBE_CPU_XMM6_OFFSET, ProbeState_cpu_xmm6_offset_matches_ctiMasmProbeTrampoline); 148 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm7) == PROBE_CPU_XMM7_OFFSET, ProbeState_cpu_xmm7_offset_matches_ctiMasmProbeTrampoline); 150 149 151 150 #if CPU(X86_64) 152 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm8]) == PROBE_CPU_XMM8_OFFSET, ProbeState_cpu_xmm8_offset_matches_ctiMasmProbeTrampoline);153 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm9]) == PROBE_CPU_XMM9_OFFSET, ProbeState_cpu_xmm9_offset_matches_ctiMasmProbeTrampoline);154 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm10]) == PROBE_CPU_XMM10_OFFSET, ProbeState_cpu_xmm10_offset_matches_ctiMasmProbeTrampoline);155 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm11]) == PROBE_CPU_XMM11_OFFSET, ProbeState_cpu_xmm11_offset_matches_ctiMasmProbeTrampoline);156 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm12]) == PROBE_CPU_XMM12_OFFSET, ProbeState_cpu_xmm12_offset_matches_ctiMasmProbeTrampoline);157 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm13]) == PROBE_CPU_XMM13_OFFSET, ProbeState_cpu_xmm13_offset_matches_ctiMasmProbeTrampoline);158 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm14]) == PROBE_CPU_XMM14_OFFSET, ProbeState_cpu_xmm14_offset_matches_ctiMasmProbeTrampoline);159 COMPILE_ASSERT(PROBE_OFFSETOF (cpu.fprs[X86Registers::xmm15]) == PROBE_CPU_XMM15_OFFSET, ProbeState_cpu_xmm15_offset_matches_ctiMasmProbeTrampoline);151 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm8) == PROBE_CPU_XMM8_OFFSET, ProbeState_cpu_xmm8_offset_matches_ctiMasmProbeTrampoline); 152 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm9) == PROBE_CPU_XMM9_OFFSET, ProbeState_cpu_xmm9_offset_matches_ctiMasmProbeTrampoline); 153 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm10) == PROBE_CPU_XMM10_OFFSET, ProbeState_cpu_xmm10_offset_matches_ctiMasmProbeTrampoline); 154 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm11) == PROBE_CPU_XMM11_OFFSET, ProbeState_cpu_xmm11_offset_matches_ctiMasmProbeTrampoline); 155 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm12) == PROBE_CPU_XMM12_OFFSET, ProbeState_cpu_xmm12_offset_matches_ctiMasmProbeTrampoline); 156 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm13) == PROBE_CPU_XMM13_OFFSET, ProbeState_cpu_xmm13_offset_matches_ctiMasmProbeTrampoline); 157 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm14) == PROBE_CPU_XMM14_OFFSET, ProbeState_cpu_xmm14_offset_matches_ctiMasmProbeTrampoline); 158 COMPILE_ASSERT(PROBE_OFFSETOF_REG(cpu.fprs, X86Registers::xmm15) == PROBE_CPU_XMM15_OFFSET, ProbeState_cpu_xmm15_offset_matches_ctiMasmProbeTrampoline); 160 159 #endif // CPU(X86_64) 161 160 … … 165 164 166 165 #if CPU(X86) 166 #if COMPILER(GCC_OR_CLANG) 167 167 asm ( 168 168 ".globl " SYMBOL_STRING(ctiMasmProbeTrampoline) "\n" … … 324 324 "ret" "\n" 325 325 ); 326 #endif 327 328 #if COMPILER(MSVC) 329 extern "C" __declspec(naked) void ctiMasmProbeTrampoline() 330 { 331 __asm { 332 pushfd; 333 334 // MacroAssemblerX86Common::probe() has already generated code to store some values. 335 // Together with the eflags pushed above, the top of stack now looks like 336 // this: 337 // esp[0 * ptrSize]: eflags 338 // esp[1 * ptrSize]: return address / saved eip 339 // esp[2 * ptrSize]: probe handler function 340 // esp[3 * ptrSize]: probe arg 341 // esp[4 * ptrSize]: saved eax 342 // esp[5 * ptrSize]: saved esp 343 344 mov eax, esp 345 sub esp, PROBE_SIZE + OUT_SIZE 346 347 // The X86_64 ABI specifies that the worse case stack alignment requirement is 32 bytes. 348 and esp, ~0x1f 349 350 mov [PROBE_CPU_EBP_OFFSET + esp], ebp 351 mov ebp, esp // Save the ProbeContext*. 352 353 mov [PROBE_CPU_ECX_OFFSET + ebp], ecx 354 mov [PROBE_CPU_EDX_OFFSET + ebp], edx 355 mov [PROBE_CPU_EBX_OFFSET + ebp], ebx 356 mov [PROBE_CPU_ESI_OFFSET + ebp], esi 357 mov [PROBE_CPU_EDI_OFFSET + ebp], edi 358 359 mov ecx, [0 * PTR_SIZE + eax] 360 mov [PROBE_CPU_EFLAGS_OFFSET + ebp], ecx 361 mov ecx, [1 * PTR_SIZE + eax] 362 mov [PROBE_CPU_EIP_OFFSET + ebp], ecx 363 mov ecx, [2 * PTR_SIZE + eax] 364 mov [PROBE_PROBE_FUNCTION_OFFSET + ebp], ecx 365 mov ecx, [3 * PTR_SIZE + eax] 366 mov [PROBE_ARG_OFFSET + ebp], ecx 367 mov ecx, [4 * PTR_SIZE + eax] 368 mov [PROBE_CPU_EAX_OFFSET + ebp], ecx 369 mov ecx, [5 * PTR_SIZE + eax] 370 mov [PROBE_CPU_ESP_OFFSET + ebp], ecx 371 372 movq qword ptr[PROBE_CPU_XMM0_OFFSET + ebp], xmm0 373 movq qword ptr[PROBE_CPU_XMM1_OFFSET + ebp], xmm1 374 movq qword ptr[PROBE_CPU_XMM2_OFFSET + ebp], xmm2 375 movq qword ptr[PROBE_CPU_XMM3_OFFSET + ebp], xmm3 376 movq qword ptr[PROBE_CPU_XMM4_OFFSET + ebp], xmm4 377 movq qword ptr[PROBE_CPU_XMM5_OFFSET + ebp], xmm5 378 movq qword ptr[PROBE_CPU_XMM6_OFFSET + ebp], xmm6 379 movq qword ptr[PROBE_CPU_XMM7_OFFSET + ebp], xmm7 380 381 xor eax, eax 382 mov [PROBE_INIT_STACK_FUNCTION_OFFSET + ebp], eax 383 384 // Reserve stack space for the arg while maintaining the required stack 385 // pointer 32 byte alignment: 386 sub esp, 0x20 387 mov [0 + esp], ebp // the ProbeContext* arg. 388 389 call [PROBE_PROBE_FUNCTION_OFFSET + ebp] 390 391 // Make sure the ProbeContext is entirely below the result stack pointer so 392 // that register values are still preserved when we call the initializeStack 393 // function. 394 mov ecx, PROBE_SIZE + OUT_SIZE 395 mov eax, ebp 396 mov edx, [PROBE_CPU_ESP_OFFSET + ebp] 397 add eax, ecx 398 cmp edx, eax 399 jge ctiMasmProbeTrampolineProbeContextIsSafe 400 401 // Allocate a safe place on the stack below the result stack pointer to stash the ProbeContext. 402 sub edx, ecx 403 and edx, ~0x1f // Keep the stack pointer 32 bytes aligned. 404 xor eax, eax 405 mov esp, edx 406 407 mov ecx, PROBE_SIZE 408 409 // Copy the ProbeContext to the safe place. 410 ctiMasmProbeTrampolineCopyLoop : 411 mov edx, [ebp + eax] 412 mov [esp + eax], edx 413 add eax, PTR_SIZE 414 cmp ecx, eax 415 jg ctiMasmProbeTrampolineCopyLoop 416 417 mov ebp, esp 418 419 // Call initializeStackFunction if present. 420 ctiMasmProbeTrampolineProbeContextIsSafe : 421 xor ecx, ecx 422 add ecx, [PROBE_INIT_STACK_FUNCTION_OFFSET + ebp] 423 je ctiMasmProbeTrampolineRestoreRegisters 424 425 // Reserve stack space for the arg while maintaining the required stack 426 // pointer 32 byte alignment: 427 sub esp, 0x20 428 mov [0 + esp], ebp // the ProbeContext* arg. 429 call ecx 430 431 ctiMasmProbeTrampolineRestoreRegisters : 432 433 // To enable probes to modify register state, we copy all registers 434 // out of the ProbeContext before returning. 435 436 mov edx, [PROBE_CPU_EDX_OFFSET + ebp] 437 mov ebx, [PROBE_CPU_EBX_OFFSET + ebp] 438 mov esi, [PROBE_CPU_ESI_OFFSET + ebp] 439 mov edi, [PROBE_CPU_EDI_OFFSET + ebp] 440 441 movq xmm0, qword ptr[PROBE_CPU_XMM0_OFFSET + ebp] 442 movq xmm1, qword ptr[PROBE_CPU_XMM1_OFFSET + ebp] 443 movq xmm2, qword ptr[PROBE_CPU_XMM2_OFFSET + ebp] 444 movq xmm3, qword ptr[PROBE_CPU_XMM3_OFFSET + ebp] 445 movq xmm4, qword ptr[PROBE_CPU_XMM4_OFFSET + ebp] 446 movq xmm5, qword ptr[PROBE_CPU_XMM5_OFFSET + ebp] 447 movq xmm6, qword ptr[PROBE_CPU_XMM6_OFFSET + ebp] 448 movq xmm7, qword ptr[PROBE_CPU_XMM7_OFFSET + ebp] 449 450 // There are 6 more registers left to restore: 451 // eax, ecx, ebp, esp, eip, and eflags. 452 453 // The restoration process at ctiMasmProbeTrampolineEnd below works by popping 454 // 5 words off the stack into eflags, eax, ecx, ebp, and eip. These 5 words need 455 // to be pushed on top of the final esp value so that just by popping the 5 words, 456 // we'll get the esp that the probe wants to set. Let's call this area (for storing 457 // these 5 words) the restore area. 458 mov ecx, [PROBE_CPU_ESP_OFFSET + ebp] 459 sub ecx, 5 * PTR_SIZE 460 461 // ecx now points to the restore area. 462 463 // Copy remaining restore values from the ProbeContext to the restore area. 464 // Note: We already ensured above that the ProbeContext is in a safe location before 465 // calling the initializeStackFunction. The initializeStackFunction is not allowed to 466 // change the stack pointer again. 467 mov eax, [PROBE_CPU_EFLAGS_OFFSET + ebp] 468 mov [0 * PTR_SIZE + ecx], eax 469 mov eax, [PROBE_CPU_EAX_OFFSET + ebp] 470 mov [1 * PTR_SIZE + ecx], eax 471 mov eax, [PROBE_CPU_ECX_OFFSET + ebp] 472 mov [2 * PTR_SIZE + ecx], eax 473 mov eax, [PROBE_CPU_EBP_OFFSET + ebp] 474 mov [3 * PTR_SIZE + ecx], eax 475 mov eax, [PROBE_CPU_EIP_OFFSET + ebp] 476 mov [4 * PTR_SIZE + ecx], eax 477 mov esp, ecx 478 479 // Do the remaining restoration by popping off the restore area. 480 popfd 481 pop eax 482 pop ecx 483 pop ebp 484 ret 485 } 486 } 487 #endif 488 326 489 #endif // CPU(X86) 327 490 328 491 #if CPU(X86_64) 492 #if COMPILER(GCC_OR_CLANG) 329 493 asm ( 330 494 ".globl " SYMBOL_STRING(ctiMasmProbeTrampoline) "\n" … … 414 578 "cmpq %rax, %rdx" "\n" 415 579 "jge " LOCAL_LABEL_STRING(ctiMasmProbeTrampolineProbeStateIsSafe) "\n" 416 580 417 581 // Allocate a safe place on the stack below the result stack pointer to stash the Probe::State. 418 582 "subq %rcx, %rdx" "\n" … … 514 678 "ret" "\n" 515 679 ); 680 #endif // COMPILER(GCC_OR_CLANG) 516 681 #endif // CPU(X86_64) 517 682 518 #endif // COMPILER(GCC_OR_CLANG) 519 520 #if OS(WINDOWS) 683 #if OS(WINDOWS) && CPU(X86_64) 521 684 static bool booleanTrueForAvoidingNoReturnDeclaration() { return true; } 522 685 -
trunk/Source/JavaScriptCore/assembler/testmasm.cpp
r220921 r220926 692 692 693 693 auto shouldRun = [&] (const char* testName) -> bool { 694 #if OS(UNIX) 694 695 return !filter || !!strcasestr(testName, filter); 696 #else 697 return !filter || !!strstr(testName, filter); 698 #endif 695 699 }; 696 700 … … 766 770 return 0; 767 771 } 772 773 #if OS(WINDOWS) 774 extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[]) 775 { 776 return main(argc, const_cast<char**>(argv)); 777 } 778 #endif -
trunk/Source/JavaScriptCore/shell/CMakeLists.txt
r219790 r220926 56 56 endif () 57 57 58 if (NOT WIN32)59 58 set(TESTMASM_SOURCES 60 59 ../assembler/testmasm.cpp … … 69 68 ) 70 69 70 if (NOT WIN32) 71 71 add_executable(testmasm ${TESTMASM_SOURCES}) 72 72 target_link_libraries(testmasm ${JSC_LIBRARIES}) -
trunk/Source/JavaScriptCore/shell/PlatformWin.cmake
r217182 r220926 34 34 add_dependencies(testapi testapiLib) 35 35 target_link_libraries(testapiLib JavaScriptCore) 36 37 add_library(testmasmLib SHARED ../assembler/testmasm.cpp) 38 add_executable(testmasm ${JSC_SOURCES}) 39 set_target_properties(testmasm PROPERTIES OUTPUT_NAME "testmasm${DEBUG_SUFFIX}") 40 target_link_libraries(testmasm shlwapi) 41 add_dependencies(testmasm testmasmLib) 42 target_link_libraries(testmasmLib JavaScriptCore) -
trunk/Source/WTF/ChangeLog
r220871 r220926 1 2017-08-18 Per Arne Vollan <pvollan@apple.com> 2 3 Implement 32-bit MacroAssembler::probe support for Windows. 4 https://bugs.webkit.org/show_bug.cgi?id=175449 5 6 Reviewed by Mark Lam. 7 8 Enable the DFG on Win32. 9 10 * wtf/Platform.h: 11 1 12 2017-08-17 Mark Lam <mark.lam@apple.com> 2 13 -
trunk/Source/WTF/wtf/Platform.h
r220871 r220926 798 798 https://bugs.webkit.org/show_bug.cgi?id=175447 799 799 */ 800 /* FIXME: Win dowscannot enable the DFG until it has support for MacroAssembler::probe().801 https://bugs.webkit.org/show_bug.cgi?id=175 449800 /* FIXME: Win64 cannot enable the DFG until it has support for MacroAssembler::probe(). 801 https://bugs.webkit.org/show_bug.cgi?id=175724 802 802 */ 803 #if CPU(X86) && OS(WINDOWS) 804 #define ENABLE_DFG_JIT 1 805 #endif 803 806 #endif 804 807
Note: See TracChangeset
for help on using the changeset viewer.