Title: [281718] trunk/Source/_javascript_Core
Revision
281718
Author
[email protected]
Date
2021-08-27 13:49:34 -0700 (Fri, 27 Aug 2021)

Log Message

Make ARM64 and X86_64 probe code a little bit more efficient.
https://bugs.webkit.org/show_bug.cgi?id=229618
rdar://82445743

Reviewed by Yusuke Suzuki.

We were using an unnecessary indirect call to call Probe::executeProbe() when we
can be using a direct call, which emits less JIT code.  This patch changes the
ARM64 and X86_64 ports to use a direct call now.

Also rename executeProbe to executeJSCJITProbe to make it more unique since we're
switching to extern "C" linkage for this function now.

For MacroAssemblerX86Common.cpp, we left the X86 and MSVC implementations unchanged.
For X86, I don't know the stack alignment requirements (if any) plus we might want
to delete this code eventually since we're not supporting the X86 JIT anymore.
For MSVC, I don't know the way to express a direct call in MSVC assembly, and have
no way to test it.  Will leave that as an exercise for folks working on the Windows
ports if they are interested.

Also remove JITProbeExecutorPtrTag since it's no longer needed.

* assembler/MacroAssemblerARM64.cpp:
(JSC::MacroAssembler::probe):
* assembler/MacroAssemblerARMv7.cpp:
(JSC::MacroAssembler::probe):
* assembler/MacroAssemblerMIPS.cpp:
(JSC::MacroAssembler::probe):
* assembler/MacroAssemblerX86Common.cpp:
(JSC::ctiMasmProbeTrampoline):
(JSC::MacroAssembler::probe):
* assembler/ProbeContext.cpp:
(JSC::Probe::executeJSCJITProbe):
(JSC::Probe::executeProbe): Deleted.
* assembler/ProbeContext.h:
* runtime/JSCPtrTag.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (281717 => 281718)


--- trunk/Source/_javascript_Core/ChangeLog	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-08-27 20:49:34 UTC (rev 281718)
@@ -1,3 +1,42 @@
+2021-08-27  Mark Lam  <[email protected]>
+
+        Make ARM64 and X86_64 probe code a little bit more efficient.
+        https://bugs.webkit.org/show_bug.cgi?id=229618
+        rdar://82445743
+
+        Reviewed by Yusuke Suzuki.
+
+        We were using an unnecessary indirect call to call Probe::executeProbe() when we
+        can be using a direct call, which emits less JIT code.  This patch changes the
+        ARM64 and X86_64 ports to use a direct call now.
+
+        Also rename executeProbe to executeJSCJITProbe to make it more unique since we're
+        switching to extern "C" linkage for this function now.
+
+        For MacroAssemblerX86Common.cpp, we left the X86 and MSVC implementations unchanged.
+        For X86, I don't know the stack alignment requirements (if any) plus we might want
+        to delete this code eventually since we're not supporting the X86 JIT anymore.
+        For MSVC, I don't know the way to express a direct call in MSVC assembly, and have
+        no way to test it.  Will leave that as an exercise for folks working on the Windows
+        ports if they are interested.
+
+        Also remove JITProbeExecutorPtrTag since it's no longer needed.
+
+        * assembler/MacroAssemblerARM64.cpp:
+        (JSC::MacroAssembler::probe):
+        * assembler/MacroAssemblerARMv7.cpp:
+        (JSC::MacroAssembler::probe):
+        * assembler/MacroAssemblerMIPS.cpp:
+        (JSC::MacroAssembler::probe):
+        * assembler/MacroAssemblerX86Common.cpp:
+        (JSC::ctiMasmProbeTrampoline):
+        (JSC::MacroAssembler::probe):
+        * assembler/ProbeContext.cpp:
+        (JSC::Probe::executeJSCJITProbe):
+        (JSC::Probe::executeProbe): Deleted.
+        * assembler/ProbeContext.h:
+        * runtime/JSCPtrTag.h:
+
 2021-08-27  Saam Barati  <[email protected]>
 
         Update ARM64EHash

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp	2021-08-27 20:49:34 UTC (rev 281718)
@@ -255,25 +255,24 @@
     UCPURegister x24;
     UCPURegister x25;
     UCPURegister x26;
-    UCPURegister x27;
-    UCPURegister x28;
     UCPURegister x30; // lr
+    UCPURegister x27; // Saved in trampoline to use as scratch.
+    UCPURegister unusedForAlignment;
 };
 
 #define IN_X24_OFFSET (0 * GPREG_SIZE)
 #define IN_X25_OFFSET (1 * GPREG_SIZE)
 #define IN_X26_OFFSET (2 * GPREG_SIZE)
-#define IN_X27_OFFSET (3 * GPREG_SIZE)
-#define IN_X28_OFFSET (4 * GPREG_SIZE)
-#define IN_X30_OFFSET (5 * GPREG_SIZE)
+#define IN_X30_OFFSET (3 * GPREG_SIZE)
+#define IN_X27_OFFSET (4 * GPREG_SIZE)
+// The 5th slot is unused. It's only there for alignment.
 #define IN_SIZE       (6 * GPREG_SIZE)
 
 static_assert(IN_X24_OFFSET == offsetof(IncomingProbeRecord, x24), "IN_X24_OFFSET is incorrect");
 static_assert(IN_X25_OFFSET == offsetof(IncomingProbeRecord, x25), "IN_X25_OFFSET is incorrect");
 static_assert(IN_X26_OFFSET == offsetof(IncomingProbeRecord, x26), "IN_X26_OFFSET is incorrect");
+static_assert(IN_X30_OFFSET == offsetof(IncomingProbeRecord, x30), "IN_X23_OFFSET is incorrect");
 static_assert(IN_X27_OFFSET == offsetof(IncomingProbeRecord, x27), "IN_X27_OFFSET is incorrect");
-static_assert(IN_X28_OFFSET == offsetof(IncomingProbeRecord, x28), "IN_X22_OFFSET is incorrect");
-static_assert(IN_X30_OFFSET == offsetof(IncomingProbeRecord, x30), "IN_X23_OFFSET is incorrect");
 static_assert(IN_SIZE == sizeof(IncomingProbeRecord), "IN_SIZE is incorrect");
 static_assert(!(sizeof(IncomingProbeRecord) & 0xf), "IncomingProbeStack must be 16-byte aligned");
 
@@ -317,10 +316,8 @@
 
 #if CPU(ARM64E)
 #define JIT_PROBE_PC_PTR_TAG 0xeeac
-#define JIT_PROBE_EXECUTOR_PTR_TAG 0x28de
 #define JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG 0x315c
 static_assert(JIT_PROBE_PC_PTR_TAG == JITProbePCPtrTag);
-static_assert(JIT_PROBE_EXECUTOR_PTR_TAG == JITProbeExecutorPtrTag);
 static_assert(JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG == JITProbeStackInitializationFunctionPtrTag);
 #endif
 
@@ -340,17 +337,13 @@
     //     x24: probe function
     //     x25: probe arg
     //     x26: scratch, was ctiMasmProbeTrampoline
-    //     x27: scratch
-    //     x28: Probe::executeProbe
     //     x30: return address
 
+    "str       x27, [sp, #" STRINGIZE_VALUE_OF(IN_X27_OFFSET) "]" "\n"
     "mov       x26, sp" "\n"
-    "mov       x27, sp" "\n"
+    "sub       x27, sp, #" STRINGIZE_VALUE_OF(PROBE_SIZE_PLUS_EXTRAS + OUT_SIZE) "\n"
+    "bic       sp, x27, #0xf" "\n" // The ARM EABI specifies that the stack needs to be 16 byte aligned.
 
-    "sub       x27, x27, #" STRINGIZE_VALUE_OF(PROBE_SIZE_PLUS_EXTRAS + OUT_SIZE) "\n"
-    "bic       x27, x27, #0xf" "\n" // The ARM EABI specifies that the stack needs to be 16 byte aligned.
-    "mov       sp, x27" "\n" // Set the sp to protect the Probe::State from interrupts before we initialize it.
-
     "stp       x24, x25, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n" // Store the probe handler function and arg (preloaded into x24 and x25
 
     "stp       x0, x1, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X0_OFFSET) "]" "\n"
@@ -362,8 +355,9 @@
     "stp       x8, x9, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X8_OFFSET) "]" "\n"
 
     "ldp       x2, x3, [x26, #" STRINGIZE_VALUE_OF(IN_X24_OFFSET) "]" "\n" // Preload saved x24 and x25.
-    "ldp       x4, x5, [x26, #" STRINGIZE_VALUE_OF(IN_X26_OFFSET) "]" "\n" // Preload saved x26 and x27.
-    "ldp       x6, x7, [x26, #" STRINGIZE_VALUE_OF(IN_X28_OFFSET) "]" "\n" // Preload saved x28 and lr.
+    "ldp       x4, x5, [x26, #" STRINGIZE_VALUE_OF(IN_X26_OFFSET) "]" "\n" // Preload saved x26 and lr.
+    "ldr       x27, [x26, #" STRINGIZE_VALUE_OF(IN_X27_OFFSET) "]" "\n"
+
     "add       x26, x26, #" STRINGIZE_VALUE_OF(IN_SIZE) "\n" // Compute the sp before the probe.
 
     "stp       x10, x11, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X10_OFFSET) "]" "\n"
@@ -373,10 +367,10 @@
     "stp       x18, x19, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X18_OFFSET) "]" "\n"
     "stp       x20, x21, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X20_OFFSET) "]" "\n"
     "stp       x22, x23, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X22_OFFSET) "]" "\n"
-    "stp       x2, x3, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X24_OFFSET) "]" "\n" // Store saved r24 and r25 (preloaded into x2 and x3 above).
-    "stp       x4, x5, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X26_OFFSET) "]" "\n" // Store saved r26 and r27 (preloaded into x4 and x5 above).
-    "stp       x6, x29, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X28_OFFSET) "]" "\n"
-    "stp       x7, x26, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n" // Save values lr and sp (original sp value computed into x26 above).
+    "stp       x2,  x3,  [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X24_OFFSET) "]" "\n" // Store saved r24 and r25 (preloaded into x2 and x3 above).
+    "stp       x4,  x27, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X26_OFFSET) "]" "\n" // Store saved r26 (preloaded into x4) and r27.
+    "stp       x28, x29, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X28_OFFSET) "]" "\n"
+    "stp       x5,  x26, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n" // Save values lr and sp (original sp value computed into x26 above).
 
     "add       x30, x30, #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" // The PC after the probe is at 2 instructions past the return point.
 #if CPU(ARM64E)
@@ -411,12 +405,7 @@
     // Note: we haven't changed the value of fp. Hence, it is still pointing to the frame of
     // the caller of the probe (which is what we want in order to play nice with debuggers e.g. lldb).
     "mov       x0, sp" "\n" // Set the Probe::State* arg.
-#if CPU(ARM64E)
-    "movz      lr, #" STRINGIZE_VALUE_OF(JIT_PROBE_EXECUTOR_PTR_TAG) "\n"
-    "blrab     x28, lr" "\n" // Call the probe handler.
-#else
-    "blr       x28" "\n" // Call the probe handler.
-#endif
+    "bl      " SYMBOL_STRING(executeJSCJITProbe) "\n"
 
     // Make sure the Probe::State is entirely below the result stack pointer so
     // that register values are still preserved when we call the initializeStack
@@ -511,7 +500,7 @@
     // returns. So, the ARM64 probe implementation will allow the probe handler to
     // either modify lr or pc, but not both in the same probe invocation. The probe
     // mechanism ensures that we never try to modify both lr and pc with a RELEASE_ASSERT
-    // in Probe::executeProbe().
+    // in Probe::().
 
     // Determine if the probe handler changed the pc.
     "ldr       x30, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n" // preload the target sp.
@@ -561,8 +550,6 @@
     "and       x27, x27, #0xff000000000000" "\n"
     "orr       x27, x27, x28" "\n"
     "ldrb      w27, [x27]" "\n"
-    "add       x27, x30, #48" "\n" // Compute sp at return point.
-    "pacib     x28, x27" "\n"
 #endif
     "ldr       x27, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_FP_OFFSET) "]" "\n"
     "stp       x27, x28, [x30, #" STRINGIZE_VALUE_OF(OUT_FP_OFFSET) "]" "\n"
@@ -587,10 +574,8 @@
     sub64(TrustedImm32(sizeof(IncomingProbeRecord)), sp);
 
     storePair64(x24, x25, sp, TrustedImm32(offsetof(IncomingProbeRecord, x24)));
-    storePair64(x26, x27, sp, TrustedImm32(offsetof(IncomingProbeRecord, x26)));
-    storePair64(x28, x30, sp, TrustedImm32(offsetof(IncomingProbeRecord, x28))); // Note: x30 is lr.
+    storePair64(x26, x30, sp, TrustedImm32(offsetof(IncomingProbeRecord, x26))); // Note: x30 is lr.
     move(TrustedImmPtr(tagCFunction<OperationPtrTag>(ctiMasmProbeTrampoline)), x26);
-    move(TrustedImmPtr(tagCFunction<JITProbeExecutorPtrTag>(Probe::executeProbe)), x28);
 #if CPU(ARM64E)
     assertIsTaggedWith<JITProbePtrTag>(function);
 #endif

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.cpp (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.cpp	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.cpp	2021-08-27 20:49:34 UTC (rev 281718)
@@ -228,12 +228,12 @@
     // Incoming register values:
     //     r0: probe function
     //     r1: probe arg
-    //     r2: Probe::executeProbe
+    //     r2: Probe::executeJSCJITProbe
     //     ip: scratch, was ctiMasmProbeTrampoline
     //     lr: return address
 
     "mov       ip, sp" "\n"
-    "str       r2, [ip, #-" STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n" // Stash Probe::executeProbe.
+    "str       r2, [ip, #-" STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n" // Stash Probe::executeJSCJITProbe.
 
     "mov       r2, sp" "\n"
     "sub       r2, r2, #" STRINGIZE_VALUE_OF(PROBE_SIZE + OUT_SIZE) "\n"
@@ -241,7 +241,7 @@
     // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     "bic       r2, r2, #0xf" "\n"
     "mov       sp, r2" "\n" // Set the sp to protect the Probe::State from interrupts before we initialize it.
-    "ldr       r2, [ip, #-" STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n" // Reload Probe::executeProbe.
+    "ldr       r2, [ip, #-" STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n" // Reload Probe::executeJSCJITProbe.
 
     "str       r0, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
     "str       r1, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
@@ -280,7 +280,7 @@
     "mov       r5, sp" "\n"
 
     "mov       r0, sp" "\n" // the Probe::State* arg.
-    "blx       r2" "\n" // Call Probe::executeProbe.
+    "blx       r2" "\n" // Call Probe::executeJSCJITProbe.
 
     // Make sure the Probe::State is entirely below the result stack pointer so
     // that register values are still preserved when we call the initializeStack
@@ -380,7 +380,7 @@
     // This means we must first preserve the apsr flags above first.
     move(TrustedImmPtr(reinterpret_cast<void*>(function)), r0);
     move(TrustedImmPtr(arg), r1);
-    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), r2);
+    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeJSCJITProbe)), r2);
     move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), ip);
     m_assembler.blx(ip);
 }

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.cpp (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.cpp	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.cpp	2021-08-27 20:49:34 UTC (rev 281718)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -304,7 +304,7 @@
     // Incoming register values:
     //     a0: probe function
     //     a1: probe arg
-    //     a2: Probe::executeProbe
+    //     a2: Probe::executeJSCJITProbe
     //     s0: scratch, was ctiMasmProbeTrampoline
     //     s1: scratch
     //     ra: return address
@@ -394,7 +394,7 @@
 
     "move      $a0, $sp" "\n" // Set the Probe::State* arg.
     "addiu     $sp, $sp, -16" "\n" // Allocate stack space for (unused) 16 bytes (8-byte aligned) for 4 arguments.
-    "move      $t9, $a2" "\n" // Probe::executeProbe()
+    "move      $t9, $a2" "\n" // Probe::executeJSCJITProbe()
     "jalr      $t9" "\n" // Call the probe handler.
     "nop" "\n"
 
@@ -508,7 +508,7 @@
     // returns. So, the MIPS probe implementation will allow the probe handler to
     // either modify ra or pc, but not both in the same probe invocation. The probe
     // mechanism ensures that we never try to modify both ra and pc with a RELEASE_ASSERT
-    // in Probe::executeProbe().
+    // in Probe::executeJSCJITProbe().
 
     // Determine if the probe handler changed the pc.
     "lw        $ra, " STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "($sp)" "\n" // preload the target sp.
@@ -563,7 +563,7 @@
     store32(ra, Address(sp, offsetof(IncomingRecord, ra)));
     move(TrustedImmPtr(reinterpret_cast<void*>(function)), a0);
     move(TrustedImmPtr(arg), a1);
-    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), a2);
+    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeJSCJITProbe)), a2);
     move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), s0);
     m_assembler.jalr(s0);
     m_assembler.nop();

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp	2021-08-27 20:49:34 UTC (rev 281718)
@@ -105,7 +105,9 @@
 #define PROBE_SIZE (PROBE_CPU_XMM15_OFFSET + XMM_SIZE)
 #endif // CPU(X86_64)
 
-#define PROBE_EXECUTOR_OFFSET PROBE_SIZE // Stash the executeProbe function pointer at the end of the ProbeContext.
+#if COMPILER(MSVC) || CPU(X86)
+#define PROBE_EXECUTOR_OFFSET PROBE_SIZE // Stash the executeJSCJITProbe function pointer at the end of the ProbeContext.
+#endif
 
 // The outgoing record to be popped off the stack at the end consists of:
 // eflags, eax, ecx, ebp, eip.
@@ -165,7 +167,9 @@
 #endif // CPU(X86_64)
 
 static_assert(sizeof(Probe::State) == PROBE_SIZE, "Probe::State::size's matches ctiMasmProbeTrampoline");
+#if COMPILER(MSVC) || CPU(X86)
 static_assert((PROBE_EXECUTOR_OFFSET + PTR_SIZE) <= (PROBE_SIZE + OUT_SIZE), "Must have room after ProbeContext to stash the probe handler");
+#endif
 
 #undef PROBE_OFFSETOF
 
@@ -189,7 +193,7 @@
     //     esp[5 * ptrSize]: saved eax
     //
     // Incoming registers contain:
-    //     ecx: Probe::executeProbe
+    //     ecx: Probe::executeJSCJITProbe
     //     edx: probe function
     //     ebx: probe arg
     //     eax: scratch (was ctiMasmProbeTrampoline)
@@ -356,7 +360,7 @@
         //     esp[5 * ptrSize]: saved eax
         //
         // Incoming registers contain:
-        //     ecx: Probe::executeProbe
+        //     ecx: Probe::executeJSCJITProbe
         //     edx: probe function
         //     ebx: probe arg
         //     eax: scratch (was ctiMasmProbeTrampoline)
@@ -528,11 +532,9 @@
     //     rbp[1 * ptrSize]: return address / saved rip
     //     rbp[2 * ptrSize]: saved rbx
     //     rbp[3 * ptrSize]: saved rdx
-    //     rbp[4 * ptrSize]: saved rcx
-    //     rbp[5 * ptrSize]: saved rax
+    //     rbp[4 * ptrSize]: saved rax
     //
     // Incoming registers contain:
-    //     rcx: Probe::executeProbe
     //     rdx: probe function
     //     rbx: probe arg
     //     rax: scratch (was ctiMasmProbeTrampoline)
@@ -543,12 +545,13 @@
     "andq $~0x1f, %rsp" "\n"
     // Since sp points to the Probe::State, we've ensured that it's protected from interrupts before we initialize it.
 
-    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_EXECUTOR_OFFSET) "(%rsp)" "\n"
     "movq %rdx, " STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "(%rsp)" "\n"
     "movq %rbx, " STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "(%rsp)" "\n"
     "movq %rsi, " STRINGIZE_VALUE_OF(PROBE_CPU_ESI_OFFSET) "(%rsp)" "\n"
     "movq %rdi, " STRINGIZE_VALUE_OF(PROBE_CPU_EDI_OFFSET) "(%rsp)" "\n"
 
+    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_ECX_OFFSET) "(%rsp)" "\n"
+
     "movq -1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rbp), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EFLAGS_OFFSET) "(%rsp)" "\n"
     "movq 0 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rbp), %rcx" "\n"
@@ -560,8 +563,6 @@
     "movq 3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rbp), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EDX_OFFSET) "(%rsp)" "\n"
     "movq 4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rbp), %rcx" "\n"
-    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_ECX_OFFSET) "(%rsp)" "\n"
-    "movq 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rbp), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%rsp)" "\n"
 
     "movq %rbp, %rcx" "\n"
@@ -595,7 +596,7 @@
     "movq %xmm15, " STRINGIZE_VALUE_OF(PROBE_CPU_XMM15_OFFSET) "(%rsp)" "\n"
 
     "movq %rsp, %rdi" "\n" // the Probe::State* arg.
-    "call *" STRINGIZE_VALUE_OF(PROBE_EXECUTOR_OFFSET) "(%rsp)" "\n"
+    "call " SYMBOL_STRING(executeJSCJITProbe) "\n"
 
     // Make sure the Probe::State is entirely below the result stack pointer so
     // that register values are still preserved when we call the initializeStack
@@ -751,10 +752,17 @@
 
 void MacroAssembler::probe(Probe::Function function, void* arg)
 {
+#if CPU(X86_64) && COMPILER(GCC_COMPATIBLE)
+    // Extra push so that the total number of pushes pad out to 32-bytes, and the
+    // stack pointer remains 32 byte aligned as required by the ABI.
     push(RegisterID::eax);
+#endif
+    push(RegisterID::eax);
     move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), RegisterID::eax);
+#if COMPILER(MSVC) || CPU(X86)
     push(RegisterID::ecx);
-    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), RegisterID::ecx);
+    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeJSCJITProbe)), RegisterID::ecx);
+#endif
     push(RegisterID::edx);
     move(TrustedImmPtr(reinterpret_cast<void*>(function)), RegisterID::edx);
     push(RegisterID::ebx);

Modified: trunk/Source/_javascript_Core/assembler/ProbeContext.cpp (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/ProbeContext.cpp	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/ProbeContext.cpp	2021-08-27 20:49:34 UTC (rev 281718)
@@ -33,7 +33,7 @@
 
 static void flushDirtyStackPages(State*);
 
-void executeProbe(State* state)
+void executeJSCJITProbe(State* state)
 {
     Context context(state);
 #if CPU(ARM64)

Modified: trunk/Source/_javascript_Core/assembler/ProbeContext.h (281717 => 281718)


--- trunk/Source/_javascript_Core/assembler/ProbeContext.h	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/assembler/ProbeContext.h	2021-08-27 20:49:34 UTC (rev 281718)
@@ -243,7 +243,7 @@
     friend JS_EXPORT_PRIVATE void* probeStateForContext(Context&); // Not for general use. This should only be for writing tests.
 };
 
-void executeProbe(State*);
+extern "C" void executeJSCJITProbe(State*);
 
 } // namespace Probe
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSCPtrTag.h (281717 => 281718)


--- trunk/Source/_javascript_Core/runtime/JSCPtrTag.h	2021-08-27 19:53:12 UTC (rev 281717)
+++ trunk/Source/_javascript_Core/runtime/JSCPtrTag.h	2021-08-27 20:49:34 UTC (rev 281718)
@@ -56,7 +56,6 @@
     v(CustomAccessorPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
     v(HostFunctionPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
     v(JITProbePtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
-    v(JITProbeExecutorPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
     v(JITProbePCPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
     v(JITProbeStackInitializationFunctionPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
     v(ReturnAddressPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to