Update the MASM probe to only take 1 arg instead of 2 (in addition to the callback...
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 23:55:45 +0000 (23:55 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 23:55:45 +0000 (23:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171088

Reviewed by Michael Saboff and Saam Barati.

Experience shows that we never use the 2nd arg.  So, let's remove it to reduce
the footprint at each probe site.

Also fix the MacroAssembler::print() function so that it is a no-op when
!ENABLE(MASM_PROBE).  This will allow us to have print() statements in JIT code
without a lot of #if ENABLE(MASM_PROBE)s later.

* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssembler.cpp:
(JSC::stdFunctionCallback):
(JSC::MacroAssembler::probe):
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerARM.cpp:
(JSC::MacroAssemblerARM::probe):
* assembler/MacroAssemblerARM.h:
* assembler/MacroAssemblerARM64.cpp:
(JSC::MacroAssemblerARM64::probe):
* assembler/MacroAssemblerARM64.h:
* assembler/MacroAssemblerARMv7.cpp:
(JSC::MacroAssemblerARMv7::probe):
* assembler/MacroAssemblerARMv7.h:
* assembler/MacroAssemblerPrinter.cpp:
(JSC::MacroAssemblerPrinter::printCallback):
* assembler/MacroAssemblerPrinter.h:
(JSC::MacroAssemblerPrinter::print):
(JSC::MacroAssembler::print):
* assembler/MacroAssemblerX86Common.cpp:
(JSC::MacroAssemblerX86Common::probe):
* assembler/MacroAssemblerX86Common.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215592 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
Source/JavaScriptCore/assembler/MacroAssembler.cpp
Source/JavaScriptCore/assembler/MacroAssembler.h
Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
Source/JavaScriptCore/assembler/MacroAssemblerARM.h
Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp
Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp
Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

index b693a68d262628df0936ec4bdd72372923a58040..877ecc233375564d649c3edd338555ed35592658 100644 (file)
@@ -1,3 +1,40 @@
+2017-04-20  Mark Lam  <mark.lam@apple.com>
+
+        Update the MASM probe to only take 1 arg instead of 2 (in addition to the callback function).
+        https://bugs.webkit.org/show_bug.cgi?id=171088
+
+        Reviewed by Michael Saboff and Saam Barati.
+
+        Experience shows that we never use the 2nd arg.  So, let's remove it to reduce
+        the footprint at each probe site.
+
+        Also fix the MacroAssembler::print() function so that it is a no-op when
+        !ENABLE(MASM_PROBE).  This will allow us to have print() statements in JIT code
+        without a lot of #if ENABLE(MASM_PROBE)s later.
+
+        * assembler/AbstractMacroAssembler.h:
+        * assembler/MacroAssembler.cpp:
+        (JSC::stdFunctionCallback):
+        (JSC::MacroAssembler::probe):
+        * assembler/MacroAssembler.h:
+        * assembler/MacroAssemblerARM.cpp:
+        (JSC::MacroAssemblerARM::probe):
+        * assembler/MacroAssemblerARM.h:
+        * assembler/MacroAssemblerARM64.cpp:
+        (JSC::MacroAssemblerARM64::probe):
+        * assembler/MacroAssemblerARM64.h:
+        * assembler/MacroAssemblerARMv7.cpp:
+        (JSC::MacroAssemblerARMv7::probe):
+        * assembler/MacroAssemblerARMv7.h:
+        * assembler/MacroAssemblerPrinter.cpp:
+        (JSC::MacroAssemblerPrinter::printCallback):
+        * assembler/MacroAssemblerPrinter.h:
+        (JSC::MacroAssemblerPrinter::print):
+        (JSC::MacroAssembler::print):
+        * assembler/MacroAssemblerX86Common.cpp:
+        (JSC::MacroAssemblerX86Common::probe):
+        * assembler/MacroAssemblerX86Common.h:
+
 2017-04-20  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: Add regular expression support to XHR breakpoints
index a38e65a396317ac3154ffea61bc7d844f61c3fd2..2eb451d5d41792e272afb44face7c02e30c2d72c 100644 (file)
@@ -922,7 +922,7 @@ public:
     // Note: probe() should be implemented by the target specific MacroAssembler.
     // This prototype is only provided here to document the interface.
 
-    void probe(ProbeFunction, void* arg1, void* arg2);
+    void probe(ProbeFunction, void* arg);
 
 #endif // ENABLE(MASM_PROBE)
 
index ba652cd13747d06fcf296a0976afe41ffccbd59d..7300157132dacc814bdff3b31c5cf137d5e97754 100644 (file)
@@ -37,13 +37,13 @@ const double MacroAssembler::twoToThe32 = (double)0x100000000ull;
 #if ENABLE(MASM_PROBE)
 static void stdFunctionCallback(ProbeContext* context)
 {
-    auto func = static_cast<const std::function<void(ProbeContext*)>*>(context->arg1);
+    auto func = static_cast<const std::function<void(ProbeContext*)>*>(context->arg);
     (*func)(context);
 }
     
 void MacroAssembler::probe(std::function<void(ProbeContext*)> func)
 {
-    probe(stdFunctionCallback, new std::function<void(ProbeContext*)>(func), 0);
+    probe(stdFunctionCallback, new std::function<void(ProbeContext*)>(func));
 }
 #endif // ENABLE(MASM_PROBE)
 
index e5477eb4203a89e7c17a29d3abfc3e14feefc2a6..ee3973a5cbd2f386e87da97fc140b7766f2db093 100644 (file)
@@ -1813,13 +1813,14 @@ public:
 #if ENABLE(MASM_PROBE)
     using MacroAssemblerBase::probe;
 
+    void probe(std::function<void(ProbeContext*)>);
+#endif
+
     // Let's you print from your JIT generated code.
+    // This only works if ENABLE(MASM_PROBE). Otherwise, print() is a no-op.
     // See comments in MacroAssemblerPrinter.h for examples of how to use this.
     template<typename... Arguments>
     void print(Arguments... args);
-
-    void probe(std::function<void (ProbeContext*)>);
-#endif
 };
 
 #if ENABLE(MASM_PROBE)
@@ -1829,8 +1830,7 @@ struct ProbeContext {
     using FPRegisterID = MacroAssembler::FPRegisterID;
 
     ProbeFunction probeFunction;
-    void* arg1;
-    void* arg2;
+    void* arg;
     CPUState cpu;
 
     // Convenience methods:
index 454b7baca68b86d103d9205cb1427b22eec7104b..e509eb4555aa2a11170e311de36588621b12afe5 100644 (file)
@@ -107,10 +107,9 @@ extern "C" void ctiMasmProbeTrampoline();
 
 #define PTR_SIZE 4
 #define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
-#define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
-#define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
+#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
 
-#define PROBE_FIRST_GPREG_OFFSET (4 * PTR_SIZE)
+#define PROBE_FIRST_GPREG_OFFSET (2 * PTR_SIZE)
 
 #define GPREG_SIZE 4
 #define PROBE_CPU_R0_OFFSET (PROBE_FIRST_GPREG_OFFSET + (0 * GPREG_SIZE))
@@ -154,13 +153,15 @@ extern "C" void ctiMasmProbeTrampoline();
 #define PROBE_CPU_D15_OFFSET (PROBE_FIRST_FPREG_OFFSET + (15 * FPREG_SIZE))
 
 #define PROBE_SIZE (PROBE_FIRST_FPREG_OFFSET + (16 * FPREG_SIZE))
+#define PROBE_ALIGNED_SIZE (PROBE_SIZE)
 
 // These ASSERTs remind you that if you change the layout of ProbeContext,
 // you need to change ctiMasmProbeTrampoline offsets above to match.
 #define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
+
+COMPILE_ASSERT(!(PROBE_CPU_R0_OFFSET & 0x3), ProbeContext_cpu_r0_offset_should_be_4_byte_aligned);
 
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r0) == PROBE_CPU_R0_OFFSET, ProbeContext_cpu_r0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r1) == PROBE_CPU_R1_OFFSET, ProbeContext_cpu_r1_offset_matches_ctiMasmProbeTrampoline);
@@ -182,6 +183,8 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.pc) == PROBE_CPU_PC_OFFSET, ProbeContext_cpu_p
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.apsr) == PROBE_CPU_APSR_OFFSET, ProbeContext_cpu_apsr_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.fpscr) == PROBE_CPU_FPSCR_OFFSET, ProbeContext_cpu_fpscr_offset_matches_ctiMasmProbeTrampoline);
 
+COMPILE_ASSERT(!(PROBE_CPU_D0_OFFSET & 0xf), ProbeContext_cpu_d0_offset_should_be_16_byte_aligned);
+
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d0) == PROBE_CPU_D0_OFFSET, ProbeContext_cpu_d0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d1) == PROBE_CPU_D1_OFFSET, ProbeContext_cpu_d1_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d2) == PROBE_CPU_D2_OFFSET, ProbeContext_cpu_d2_offset_matches_ctiMasmProbeTrampoline);
@@ -198,7 +201,9 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d12) == PROBE_CPU_D12_OFFSET, ProbeContext_cpu
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d13) == PROBE_CPU_D13_OFFSET, ProbeContext_cpu_d13_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d14) == PROBE_CPU_D14_OFFSET, ProbeContext_cpu_d14_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d15) == PROBE_CPU_D15_OFFSET, ProbeContext_cpu_d15_offset_matches_ctiMasmProbeTrampoline);
+
 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0xf), ProbeContext_aligned_size_offset_should_be_16_byte_aligned);
 #undef PROBE_OFFSETOF
 
 asm (
@@ -211,16 +216,15 @@ asm (
     // MacroAssemblerARM::probe() has already generated code to store some values.
     // The top of stack now looks like this:
     //     esp[0 * ptrSize]: probeFunction
-    //     esp[1 * ptrSize]: arg1
-    //     esp[2 * ptrSize]: arg2
-    //     esp[3 * ptrSize]: saved r3 / S0
-    //     esp[4 * ptrSize]: saved ip
-    //     esp[5 * ptrSize]: saved lr
-    //     esp[6 * ptrSize]: saved sp
+    //     esp[1 * ptrSize]: arg
+    //     esp[2 * ptrSize]: saved r3 / S0
+    //     esp[3 * ptrSize]: saved ip
+    //     esp[4 * ptrSize]: saved lr
+    //     esp[5 * ptrSize]: saved sp
 
     "mov       ip, sp" "\n"
     "mov       r3, sp" "\n"
-    "sub       r3, r3, #" STRINGIZE_VALUE_OF(PROBE_SIZE) "\n"
+    "sub       r3, r3, #" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) "\n"
 
     // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     "bic       r3, r3, #0xf" "\n"
@@ -237,16 +241,14 @@ asm (
     "ldr       lr, [ip, #0 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
     "ldr       lr, [ip, #1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "]" "\n"
+    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
     "ldr       lr, [ip, #2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R3_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n"
 
     "ldr       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n"
@@ -347,15 +349,14 @@ asm (
 );
 #endif // COMPILER(GCC_OR_CLANG)
 
-void MacroAssemblerARM::probe(ProbeFunction function, void* arg1, void* arg2)
+void MacroAssemblerARM::probe(ProbeFunction function, void* arg)
 {
     push(RegisterID::sp);
     push(RegisterID::lr);
     push(RegisterID::ip);
     push(RegisterID::S0);
     // The following uses RegisterID::S0. So, they must come after we push S0 above.
-    push(trustedImm32FromPtr(arg2));
-    push(trustedImm32FromPtr(arg1));
+    push(trustedImm32FromPtr(arg));
     push(trustedImm32FromPtr(function));
 
     move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::S0);
index 0b40af2bf609d0f3c93676384b4e06e96be7343b..dbe3c25c0218de3b8204a3c72e50d9faf9253cd0 100644 (file)
@@ -1559,7 +1559,7 @@ public:
     }
 
 #if ENABLE(MASM_PROBE)
-    void probe(ProbeFunction, void* arg1, void* arg2);
+    void probe(ProbeFunction, void* arg);
 #endif // ENABLE(MASM_PROBE)
 
 protected:
index a449ee33cc5400c9f7f334a93e9d98e47eea41a0..954acb4f8d98b6efa8802eeff2e2ca57d3c93c8e 100644 (file)
@@ -44,10 +44,9 @@ using namespace ARM64Registers;
 // by the ctiMasmProbeTrampoline stub.
 #define PTR_SIZE 8
 #define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
-#define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
-#define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
+#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
 
-#define PROBE_FIRST_GPREG_OFFSET (3 * PTR_SIZE)
+#define PROBE_FIRST_GPREG_OFFSET (2 * PTR_SIZE)
 
 #define GPREG_SIZE 8
 #define PROBE_CPU_X0_OFFSET (PROBE_FIRST_GPREG_OFFSET + (0 * GPREG_SIZE))
@@ -125,13 +124,15 @@ using namespace ARM64Registers;
 #define PROBE_SIZE (PROBE_FIRST_FPREG_OFFSET + (32 * FPREG_SIZE))
 #define SAVED_CALLER_SP PROBE_SIZE
 #define PROBE_SIZE_PLUS_SAVED_CALLER_SP (SAVED_CALLER_SP + PTR_SIZE)
+#define PROBE_ALIGNED_SIZE (PROBE_SIZE_PLUS_SAVED_CALLER_SP)
 
 // These ASSERTs remind you that if you change the layout of ProbeContext,
 // you need to change ctiMasmProbeTrampoline offsets above to match.
 #define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
+
+COMPILE_ASSERT(!(PROBE_CPU_X0_OFFSET & 0x7), ProbeContext_cpu_r0_offset_should_be_8_byte_aligned);
 
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.x0) == PROBE_CPU_X0_OFFSET, ProbeContext_cpu_x0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.x1) == PROBE_CPU_X1_OFFSET, ProbeContext_cpu_x1_offset_matches_ctiMasmProbeTrampoline);
@@ -171,6 +172,8 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.pc) == PROBE_CPU_PC_OFFSET, ProbeContext_cpu_p
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.nzcv) == PROBE_CPU_NZCV_OFFSET, ProbeContext_cpu_nzcv_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.fpsr) == PROBE_CPU_FPSR_OFFSET, ProbeContext_cpu_fpsr_offset_matches_ctiMasmProbeTrampoline);
 
+COMPILE_ASSERT(!(PROBE_CPU_Q0_OFFSET & 0x7), ProbeContext_cpu_q0_offset_should_be_8_byte_aligned);
+
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q0) == PROBE_CPU_Q0_OFFSET, ProbeContext_cpu_q0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q1) == PROBE_CPU_Q1_OFFSET, ProbeContext_cpu_q1_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q2) == PROBE_CPU_Q2_OFFSET, ProbeContext_cpu_q2_offset_matches_ctiMasmProbeTrampoline);
@@ -206,6 +209,7 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q30) == PROBE_CPU_Q30_OFFSET, ProbeContext_cpu
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q31) == PROBE_CPU_Q31_OFFSET, ProbeContext_cpu_q31_offset_matches_ctiMasmProbeTrampoline);
 
 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0xf), ProbeContext_aligned_size_offset_should_be_16_byte_aligned);
 
 #undef PROBE_OFFSETOF
 
@@ -220,17 +224,16 @@ asm (
     // The top of stack (the caller save buffer) now looks like this:
     //     sp[0 * ptrSize]: probeFunction
     //     sp[1 * ptrSize]: arg1
-    //     sp[2 * ptrSize]: arg2
-    //     sp[3 * ptrSize]: address of arm64ProbeTrampoline()
-    //     sp[4 * ptrSize]: saved x27
-    //     sp[5 * ptrSize]: saved x28
-    //     sp[6 * ptrSize]: saved lr
-    //     sp[7 * ptrSize]: saved sp
+    //     sp[2 * ptrSize]: address of arm64ProbeTrampoline()
+    //     sp[3 * ptrSize]: saved x27
+    //     sp[4 * ptrSize]: saved x28
+    //     sp[5 * ptrSize]: saved lr
+    //     sp[6 * ptrSize]: saved sp
 
     "mov       x27, sp" "\n"
     "mov       x28, sp" "\n"
 
-    "sub       x28, x28, #" STRINGIZE_VALUE_OF(PROBE_SIZE_PLUS_SAVED_CALLER_SP) "\n"
+    "sub       x28, x28, #" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) "\n"
 
     // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     "bic       x28, x28, #0xf" "\n"
@@ -266,16 +269,16 @@ asm (
     "str       x25, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X25_OFFSET) "]" "\n"
     "str       x26, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X26_OFFSET) "]" "\n"
 
-    "ldr       x0, [x27, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       x0, [x27, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X27_OFFSET) "]" "\n"
-    "ldr       x0, [x27, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       x0, [x27, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X28_OFFSET) "]" "\n"
 
     "str       fp, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_FP_OFFSET) "]" "\n"
 
-    "ldr       x0, [x27, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       x0, [x27, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
-    "ldr       x0, [x27, #7 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       x0, [x27, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n"
 
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n"
@@ -288,9 +291,7 @@ asm (
     "ldr       x0, [x27, #0 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
     "ldr       x0, [x27, #1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "]" "\n"
-    "ldr       x0, [x27, #2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "]" "\n"
+    "str       x0, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
 
     "str       d0, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_Q0_OFFSET) "]" "\n"
     "str       d1, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_Q1_OFFSET) "]" "\n"
@@ -471,33 +472,31 @@ static void arm64ProbeTrampoline(ProbeContext* context)
     }
 }
 
-void MacroAssemblerARM64::probe(ProbeFunction function, void* arg1, void* arg2)
+void MacroAssemblerARM64::probe(ProbeFunction function, void* arg)
 {
-    sub64(TrustedImm32(8 * 8), sp);
+    sub64(TrustedImm32(7 * 8), sp);
 
-    store64(x27, Address(sp, 4 * 8));
-    store64(x28, Address(sp, 5 * 8));
-    store64(lr, Address(sp, 6 * 8));
+    store64(x27, Address(sp, 3 * 8));
+    store64(x28, Address(sp, 4 * 8));
+    store64(lr, Address(sp, 5 * 8));
 
-    add64(TrustedImm32(8 * 8), sp, x28);
-    store64(x28, Address(sp, 7 * 8)); // Save original sp value.
+    add64(TrustedImm32(7 * 8), sp, x28);
+    store64(x28, Address(sp, 6 * 8)); // Save original sp value.
 
     move(TrustedImmPtr(reinterpret_cast<void*>(function)), x28);
     store64(x28, Address(sp));
-    move(TrustedImmPtr(arg1), x28);
+    move(TrustedImmPtr(arg), x28);
     store64(x28, Address(sp, 1 * 8));
-    move(TrustedImmPtr(arg2), x28);
-    store64(x28, Address(sp, 2 * 8));
     move(TrustedImmPtr(reinterpret_cast<void*>(arm64ProbeTrampoline)), x28);
-    store64(x28, Address(sp, 3 * 8));
+    store64(x28, Address(sp, 2 * 8));
 
     move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), x28);
     m_assembler.blr(x28);
 
     // ctiMasmProbeTrampoline should have restored every register except for
     // lr and the sp.
-    load64(Address(sp, 6 * 8), lr);
-    add64(TrustedImm32(8 * 8), sp);
+    load64(Address(sp, 5 * 8), lr);
+    add64(TrustedImm32(7 * 8), sp);
 }
 #endif // ENABLE(MASM_PROBE)
 
index abcbd1e40b81c7b414b2c441070688f4a498c3ff..ef0de364f4b40ddfec1da957890ecc88034300b8 100644 (file)
@@ -3763,7 +3763,7 @@ public:
     }
 
 #if ENABLE(MASM_PROBE)
-    void probe(ProbeFunction, void* arg1, void* arg2);
+    void probe(ProbeFunction, void* arg);
 #endif // ENABLE(MASM_PROBE)
 
 protected:
index c3bf4f86f735c33813d4fe9bfdbba7c265e3b1d9..40830513915f62cd7d1c5a31ba7b0eb96d82a35f 100644 (file)
@@ -43,10 +43,9 @@ extern "C" void ctiMasmProbeTrampoline();
 
 #define PTR_SIZE 4
 #define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
-#define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
-#define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
+#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
 
-#define PROBE_FIRST_GPREG_OFFSET (3 * PTR_SIZE)
+#define PROBE_FIRST_GPREG_OFFSET (2 * PTR_SIZE)
 
 #define GPREG_SIZE 4
 #define PROBE_CPU_R0_OFFSET (PROBE_FIRST_GPREG_OFFSET + (0 * GPREG_SIZE))
@@ -105,13 +104,15 @@ extern "C" void ctiMasmProbeTrampoline();
 #define PROBE_CPU_D30_OFFSET (PROBE_FIRST_FPREG_OFFSET + (30 * FPREG_SIZE))
 #define PROBE_CPU_D31_OFFSET (PROBE_FIRST_FPREG_OFFSET + (31 * FPREG_SIZE))
 #define PROBE_SIZE (PROBE_FIRST_FPREG_OFFSET + (32 * FPREG_SIZE))
+#define PROBE_ALIGNED_SIZE (PROBE_SIZE)
 
 // These ASSERTs remind you that if you change the layout of ProbeContext,
 // you need to change ctiMasmProbeTrampoline offsets above to match.
 #define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
+
+COMPILE_ASSERT(!(PROBE_CPU_R0_OFFSET & 0x3), ProbeContext_cpu_r0_offset_should_be_4_byte_aligned);
 
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r0) == PROBE_CPU_R0_OFFSET, ProbeContext_cpu_r0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r1) == PROBE_CPU_R1_OFFSET, ProbeContext_cpu_r1_offset_matches_ctiMasmProbeTrampoline);
@@ -133,6 +134,8 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.pc) == PROBE_CPU_PC_OFFSET, ProbeContext_cpu_p
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.apsr) == PROBE_CPU_APSR_OFFSET, ProbeContext_cpu_apsr_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.fpscr) == PROBE_CPU_FPSCR_OFFSET, ProbeContext_cpu_fpscr_offset_matches_ctiMasmProbeTrampoline);
 
+COMPILE_ASSERT(!(PROBE_CPU_D0_OFFSET & 0xf), ProbeContext_cpu_d0_offset_should_be_16_byte_aligned);
+
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d0) == PROBE_CPU_D0_OFFSET, ProbeContext_cpu_d0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d1) == PROBE_CPU_D1_OFFSET, ProbeContext_cpu_d1_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d2) == PROBE_CPU_D2_OFFSET, ProbeContext_cpu_d2_offset_matches_ctiMasmProbeTrampoline);
@@ -168,6 +171,7 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d30) == PROBE_CPU_D30_OFFSET, ProbeContext_cpu
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d31) == PROBE_CPU_D31_OFFSET, ProbeContext_cpu_d31_offset_matches_ctiMasmProbeTrampoline);
 
 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0xf), ProbeContext_aligned_size_offset_should_be_16_byte_aligned);
 
 #undef PROBE_OFFSETOF
     
@@ -183,16 +187,15 @@ asm (
     // MacroAssemblerARMv7::probe() has already generated code to store some values.
     // The top of stack now looks like this:
     //     esp[0 * ptrSize]: probeFunction
-    //     esp[1 * ptrSize]: arg1
-    //     esp[2 * ptrSize]: arg2
-    //     esp[3 * ptrSize]: saved r0
-    //     esp[4 * ptrSize]: saved ip
-    //     esp[5 * ptrSize]: saved lr
-    //     esp[6 * ptrSize]: saved sp
+    //     esp[1 * ptrSize]: arg
+    //     esp[2 * ptrSize]: saved r0
+    //     esp[3 * ptrSize]: saved ip
+    //     esp[4 * ptrSize]: saved lr
+    //     esp[5 * ptrSize]: saved sp
 
     "mov       ip, sp" "\n"
     "mov       r0, sp" "\n"
-    "sub       r0, r0, #" STRINGIZE_VALUE_OF(PROBE_SIZE) "\n"
+    "sub       r0, r0, #" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) "\n"
 
     // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     "bic       r0, r0, #0xf" "\n"
@@ -209,16 +212,14 @@ asm (
     "ldr       lr, [ip, #0 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
     "ldr       lr, [ip, #1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "]" "\n"
+    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
     "ldr       lr, [ip, #2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
-    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R0_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
-    "ldr       lr, [ip, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
+    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n"
 
     "ldr       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n"
@@ -324,7 +325,7 @@ asm (
 );
 #endif // COMPILER(GCC_OR_CLANG)
 
-void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg1, void* arg2)
+void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg)
 {
     push(RegisterID::lr);
     push(RegisterID::lr);
@@ -333,8 +334,7 @@ void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg1, void* arg2)
     push(RegisterID::ip);
     push(RegisterID::r0);
     // The following uses RegisterID::ip. So, they must come after we push ip above.
-    push(trustedImm32FromPtr(arg2));
-    push(trustedImm32FromPtr(arg1));
+    push(trustedImm32FromPtr(arg));
     push(trustedImm32FromPtr(function));
 
     move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::ip);
index 77175b8e00a4db9980ce350facc35c50af1fafb8..f0f15356df0c609f95ab7ef4136cb826f63ca6cb 100644 (file)
@@ -2016,7 +2016,7 @@ public:
     }
 
 #if ENABLE(MASM_PROBE)
-    void probe(ProbeFunction, void* arg1, void* arg2);
+    void probe(ProbeFunction, void* arg);
 #endif // ENABLE(MASM_PROBE)
 
 protected:
index e0bc641dcbd7c1adfa578d50f9667ed6cbfbd901..718f10ecd7a6373e9234bf07b03fc72d381e8599 100644 (file)
@@ -175,7 +175,7 @@ void MacroAssemblerPrinter::printCallback(ProbeContext* context)
 {
     typedef PrintArg Arg;
     PrintArgsList& argsList =
-    *reinterpret_cast<PrintArgsList*>(context->arg1);
+    *reinterpret_cast<PrintArgsList*>(context->arg);
     for (size_t i = 0; i < argsList.size(); i++) {
         auto& arg = argsList[i];
         switch (arg.type) {
index ae97b21fe41c4605fd01038f25ddd1f4dd724697..94cb70780a81f1bb657c23f03039b9649ab1b167 100644 (file)
 
 #pragma once
 
-#if ENABLE(MASM_PROBE)
-
 #include "MacroAssembler.h"
 
 namespace JSC {
 
+#if ENABLE(MASM_PROBE)
+    
 // What is MacroAssembler::print()?
 // ===============================
 // The MacroAsssembler::print() makes it easy to add print logging
@@ -167,7 +167,7 @@ public:
     {
         auto argsList = std::make_unique<PrintArgsList>();
         appendPrintArg(argsList.get(), args...);
-        masm->probe(printCallback, argsList.release(), 0);
+        masm->probe(printCallback, argsList.release());
     }
     
 private:
@@ -296,6 +296,11 @@ void printRegister(MacroAssembler::CPUState&, MacroAssembler::RegisterID);
 void printRegister(MacroAssembler::CPUState&, MacroAssembler::FPRegisterID);
 void printMemory(MacroAssembler::CPUState&, const Memory&);
 
-} // namespace JSC
+#else // ENABLE(MASM_PROBE)
+
+template<typename... Arguments>
+void MacroAssembler::print(Arguments...) { }
 
 #endif // ENABLE(MASM_PROBE)
+
+} // namespace JSC
index 250bb8edc9f414a6e83b7a844aaeeb7e32b7d396..a51f75a823ac0ce32e8fef8b79cf845ce56fb4da 100644 (file)
@@ -47,10 +47,9 @@ extern "C" void ctiMasmProbeTrampoline();
 #endif
 
 #define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
-#define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
-#define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
+#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
 
-#define PROBE_FIRST_GPR_OFFSET (3 * PTR_SIZE)
+#define PROBE_FIRST_GPR_OFFSET (2 * PTR_SIZE)
 #define PROBE_CPU_EAX_OFFSET (PROBE_FIRST_GPR_OFFSET + (0 * PTR_SIZE))
 #define PROBE_CPU_ECX_OFFSET (PROBE_FIRST_GPR_OFFSET + (1 * PTR_SIZE))
 #define PROBE_CPU_EDX_OFFSET (PROBE_FIRST_GPR_OFFSET + (2 * PTR_SIZE))
@@ -90,6 +89,7 @@ extern "C" void ctiMasmProbeTrampoline();
 
 #if CPU(X86)
 #define PROBE_SIZE (PROBE_CPU_XMM7_OFFSET + XMM_SIZE)
+#define PROBE_ALIGNED_SIZE (PROBE_SIZE + (2 * XMM_SIZE))
 #else // CPU(X86_64)
 #define PROBE_CPU_XMM8_OFFSET (PROBE_FIRST_XMM_OFFSET + (8 * XMM_SIZE))
 #define PROBE_CPU_XMM9_OFFSET (PROBE_FIRST_XMM_OFFSET + (9 * XMM_SIZE))
@@ -100,14 +100,14 @@ extern "C" void ctiMasmProbeTrampoline();
 #define PROBE_CPU_XMM14_OFFSET (PROBE_FIRST_XMM_OFFSET + (14 * XMM_SIZE))
 #define PROBE_CPU_XMM15_OFFSET (PROBE_FIRST_XMM_OFFSET + (15 * XMM_SIZE))
 #define PROBE_SIZE (PROBE_CPU_XMM15_OFFSET + XMM_SIZE)
+#define PROBE_ALIGNED_SIZE (PROBE_SIZE + (4 * XMM_SIZE))
 #endif // CPU(X86_64)
 
 // These ASSERTs remind you that if you change the layout of ProbeContext,
 // you need to change ctiMasmProbeTrampoline offsets above to match.
 #define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
-COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
 
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.eax) == PROBE_CPU_EAX_OFFSET, ProbeContext_cpu_eax_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.ecx) == PROBE_CPU_ECX_OFFSET, ProbeContext_cpu_ecx_offset_matches_ctiMasmProbeTrampoline);
@@ -131,6 +131,8 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r14) == PROBE_CPU_R14_OFFSET, ProbeContext_cpu
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r15) == PROBE_CPU_R15_OFFSET, ProbeContext_cpu_r15_offset_matches_ctiMasmProbeTrampoline);
 #endif // CPU(X86_64)
 
+COMPILE_ASSERT(!(PROBE_CPU_XMM0_OFFSET & 0x7), ProbeContext_cpu_xmm0_offset_should_be_8_byte_aligned);
+
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm0) == PROBE_CPU_XMM0_OFFSET, ProbeContext_cpu_xmm0_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm1) == PROBE_CPU_XMM1_OFFSET, ProbeContext_cpu_xmm1_offset_matches_ctiMasmProbeTrampoline);
 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm2) == PROBE_CPU_XMM2_OFFSET, ProbeContext_cpu_xmm2_offset_matches_ctiMasmProbeTrampoline);
@@ -152,6 +154,7 @@ COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm15) == PROBE_CPU_XMM15_OFFSET, ProbeContext
 #endif // CPU(X86_64)
 
 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
+COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0x1f), ProbeContext_aligned_size_offset_should_be_32_byte_aligned);
 
 #undef PROBE_OFFSETOF
 
@@ -170,12 +173,11 @@ asm (
     //     esp[1 * ptrSize]: return address / saved eip
     //     esp[2 * ptrSize]: probeFunction
     //     esp[3 * ptrSize]: arg1
-    //     esp[4 * ptrSize]: arg2
-    //     esp[5 * ptrSize]: saved eax
-    //     esp[6 * ptrSize]: saved esp
+    //     esp[4 * ptrSize]: saved eax
+    //     esp[5 * ptrSize]: saved esp
 
     "movl %esp, %eax" "\n"
-    "subl $" STRINGIZE_VALUE_OF(PROBE_SIZE) ", %esp" "\n"
+    "subl $" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %esp" "\n"
 
     // The X86_64 ABI specifies that the worse case stack alignment requirement
     // is 32 bytes.
@@ -197,12 +199,10 @@ asm (
     "movl 2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
     "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "(%ebp)" "\n"
     "movl 3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
-    "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "(%ebp)" "\n"
+    "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "(%ebp)" "\n"
     "movl 4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
-    "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "(%ebp)" "\n"
-    "movl 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
     "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%ebp)" "\n"
-    "movl 6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
+    "movl 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%eax), %ecx" "\n"
     "movl %ecx, " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%ebp)" "\n"
 
     "movq %xmm0, " STRINGIZE_VALUE_OF(PROBE_CPU_XMM0_OFFSET) "(%ebp)" "\n"
@@ -263,9 +263,9 @@ asm (
 
     // Locate the "safe area" at 2x sizeof(ProbeContext) below where the new
     // rsp will be. This time we don't have to 32-byte align it because we're
-    // not using to store any xmm regs.
+    // not using this area to store any xmm regs.
     "movl " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%ebp), %eax" "\n"
-    "subl $2 * " STRINGIZE_VALUE_OF(PROBE_SIZE) ", %eax" "\n"
+    "subl $2 * " STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %eax" "\n"
     "movl %eax, %esp" "\n"
 
     "subl $" STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) ", %eax" "\n"
@@ -323,12 +323,11 @@ asm (
     //     esp[1 * ptrSize]: return address / saved rip
     //     esp[2 * ptrSize]: probeFunction
     //     esp[3 * ptrSize]: arg1
-    //     esp[4 * ptrSize]: arg2
-    //     esp[5 * ptrSize]: saved rax
-    //     esp[6 * ptrSize]: saved rsp
+    //     esp[4 * ptrSize]: saved rax
+    //     esp[5 * ptrSize]: saved rsp
 
     "movq %rsp, %rax" "\n"
-    "subq $" STRINGIZE_VALUE_OF(PROBE_SIZE) ", %rsp" "\n"
+    "subq $" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %rsp" "\n"
 
     // The X86_64 ABI specifies that the worse case stack alignment requirement
     // is 32 bytes.
@@ -350,12 +349,10 @@ asm (
     "movq 2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "(%rbp)" "\n"
     "movq 3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
-    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "(%rbp)" "\n"
+    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "(%rbp)" "\n"
     "movq 4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
-    "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "(%rbp)" "\n"
-    "movq 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%rbp)" "\n"
-    "movq 6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
+    "movq 5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "(%rax), %rcx" "\n"
     "movq %rcx, " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%rbp)" "\n"
 
     "movq %r8, " STRINGIZE_VALUE_OF(PROBE_CPU_R8_OFFSET) "(%rbp)" "\n"
@@ -448,7 +445,7 @@ asm (
     // rsp will be. This time we don't have to 32-byte align it because we're
     // not using to store any xmm regs.
     "movq " STRINGIZE_VALUE_OF(PROBE_CPU_ESP_OFFSET) "(%rbp), %rax" "\n"
-    "subq $2 * " STRINGIZE_VALUE_OF(PROBE_SIZE) ", %rax" "\n"
+    "subq $2 * " STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) ", %rax" "\n"
     "movq %rax, %rsp" "\n"
 
     "movq " STRINGIZE_VALUE_OF(PROBE_CPU_EAX_OFFSET) "(%rbp), %rcx" "\n"
@@ -531,13 +528,11 @@ asm (
 // position before we push the ProbeContext frame. The saved rip will point to
 // the address of the instruction immediately following the probe. 
 
-void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg1, void* arg2)
+void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg)
 {
     push(RegisterID::esp);
     push(RegisterID::eax);
-    move(TrustedImmPtr(arg2), RegisterID::eax);
-    push(RegisterID::eax);
-    move(TrustedImmPtr(arg1), RegisterID::eax);
+    move(TrustedImmPtr(arg), RegisterID::eax);
     push(RegisterID::eax);
     move(TrustedImmPtr(reinterpret_cast<void*>(function)), RegisterID::eax);
     push(RegisterID::eax);
index df007d47c711bbc12900cfcf13e40035fc23f153..dcf807ef34d0cd88d24770bc917e344a2e50d753 100644 (file)
@@ -3951,7 +3951,7 @@ public:
     }
 
 #if ENABLE(MASM_PROBE)
-    void probe(ProbeFunction, void* arg1, void* arg2);
+    void probe(ProbeFunction, void* arg);
 #endif // ENABLE(MASM_PROBE)
 
 protected: