Title: [157475] trunk/Source/_javascript_Core
Revision
157475
Author
[email protected]
Date
2013-10-15 15:23:49 -0700 (Tue, 15 Oct 2013)

Log Message

[sh4] Some calls don't match sh4 ABI.
https://bugs.webkit.org/show_bug.cgi?id=122863

Patch by Julien Brianceau <[email protected]> on 2013-10-15
Reviewed by Michael Saboff.

* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):
* jit/JITInlines.h:
(JSC::JIT::callOperation):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (157474 => 157475)


--- trunk/Source/_javascript_Core/ChangeLog	2013-10-15 22:16:39 UTC (rev 157474)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-10-15 22:23:49 UTC (rev 157475)
@@ -1,3 +1,17 @@
+2013-10-15  Julien Brianceau  <[email protected]>
+
+        [sh4] Some calls don't match sh4 ABI.
+        https://bugs.webkit.org/show_bug.cgi?id=122863
+
+        Reviewed by Michael Saboff.
+
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::callOperation):
+        * jit/CCallHelpers.h:
+        (JSC::CCallHelpers::setupArgumentsWithExecState):
+        * jit/JITInlines.h:
+        (JSC::JIT::callOperation):
+
 2013-10-15  Daniel Bates  <[email protected]>
 
         [iOS] Upstream _javascript_Core support for ARM64

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (157474 => 157475)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2013-10-15 22:16:39 UTC (rev 157474)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2013-10-15 22:23:49 UTC (rev 157475)
@@ -1407,7 +1407,8 @@
 #endif
 
 // JSVALUE32_64 is a 64-bit integer that cannot be put half in an argument register and half on stack when using SH4 architecture.
-// To avoid this, let's occupy the 4th argument register (r7) with a dummy argument when necessary.
+// To avoid this, let's occupy the 4th argument register (r7) with a dummy argument when necessary. This must only be done when there
+// is no other 32-bit value argument behind this 64-bit JSValue.
 #if CPU(SH4)
 #define SH4_32BIT_DUMMY_ARG      TrustedImm32(0),
 #else
@@ -1622,7 +1623,12 @@
     }
     JITCompiler::Call callOperation(V_JITOperation_EJJI operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Payload, StringImpl* uid)
     {
-        m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid));
+#if CPU(SH4)
+        // We have to put uid in the 4th argument register (r7) as 64-bit value arg2 will be put on stack for sh4 architecure.
+        m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, TrustedImmPtr(uid), arg2Payload, TrustedImm32(JSValue::CellTag));
+#else
+        m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid));
+#endif
         return appendCallWithExceptionCheck(operation);
     }
     JITCompiler::Call callOperation(V_JITOperation_ECJJ operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)

Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (157474 => 157475)


--- trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-10-15 22:16:39 UTC (rev 157474)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-10-15 22:23:49 UTC (rev 157475)
@@ -969,6 +969,13 @@
         move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     }
 
+    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3)
+    {
+        setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR3>(arg1, arg3);
+        move(arg2, GPRInfo::argumentGPR2);
+        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+    }
+
     ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3)
     {
         move(arg1, GPRInfo::argumentGPR1);
@@ -1099,6 +1106,12 @@
         setupArgumentsWithExecState(arg1, arg2, arg3);
     }
 
+    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4)
+    {
+        poke(arg4, POKE_ARGUMENT_OFFSET);
+        setupArgumentsWithExecState(arg1, arg2, arg3);
+    }
+
     ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5)
     {
         poke(arg5, POKE_ARGUMENT_OFFSET + 1);
@@ -1211,6 +1224,13 @@
         setupArgumentsWithExecState(arg1, arg2, arg3);
     }
 
+    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, GPRReg arg4, TrustedImm32 arg5)
+    {
+        poke(arg5, POKE_ARGUMENT_OFFSET + 1);
+        poke(arg4, POKE_ARGUMENT_OFFSET);
+        setupArgumentsWithExecState(arg1, arg2, arg3);
+    }
+
     ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6)
     {
         poke(arg6, POKE_ARGUMENT_OFFSET + 2);
@@ -1219,9 +1239,8 @@
         setupArgumentsWithExecState(arg1, arg2, arg3);
     }
 
-    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5, TrustedImmPtr arg6)
+    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, GPRReg arg4, GPRReg arg5)
     {
-        poke(arg6, POKE_ARGUMENT_OFFSET + 2);
         poke(arg5, POKE_ARGUMENT_OFFSET + 1);
         poke(arg4, POKE_ARGUMENT_OFFSET);
         setupArgumentsWithExecState(arg1, arg2, arg3);

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (157474 => 157475)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2013-10-15 22:16:39 UTC (rev 157474)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2013-10-15 22:23:49 UTC (rev 157475)
@@ -461,7 +461,8 @@
 #endif
 
 // JSVALUE32_64 is a 64-bit integer that cannot be put half in an argument register and half on stack when using SH4 architecture.
-// To avoid this, let's occupy the 4th argument register (r7) with a dummy argument when necessary.
+// To avoid this, let's occupy the 4th argument register (r7) with a dummy argument when necessary. This must only be done when there
+// is no other 32-bit value argument behind this 64-bit JSValue.
 #if CPU(SH4)
 #define SH4_32BIT_DUMMY_ARG      TrustedImm32(0),
 #else
@@ -470,7 +471,12 @@
 
 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EJJZ operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, int32_t arg3)
 {
-    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag, TrustedImm32(arg3));
+#if CPU(SH4)
+    // We have to put arg3 in the 4th argument register (r7) as 64-bit value arg2 will be put on stack for sh4 architecure.
+    setupArgumentsWithExecState(arg1Payload, arg1Tag, TrustedImm32(arg3), arg2Payload, arg2Tag, TrustedImm32(arg3));
+#else
+    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag, TrustedImm32(arg3));
+#endif
     return appendCallWithExceptionCheck(operation);
 }
 
@@ -530,13 +536,18 @@
 
 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EIdJZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3)
 {
-    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3));
+    setupArgumentsWithExecState(TrustedImmPtr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3));
     return appendCallWithExceptionCheck(operation);
 }
 
 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJJI operation, RegisterID regOp1Tag, RegisterID regOp1Payload, RegisterID regOp2Tag, RegisterID regOp2Payload, StringImpl* uid)
 {
-    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG regOp1Payload, regOp1Tag, SH4_32BIT_DUMMY_ARG regOp2Payload, regOp2Tag, TrustedImmPtr(uid));
+#if CPU(SH4)
+    // We have to put uid in the 4th argument register (r7) as 64-bit value regOp2 will be put on stack for sh4 architecure.
+    setupArgumentsWithExecState(regOp1Payload, regOp1Tag, TrustedImmPtr(uid), regOp2Payload, regOp2Tag);
+#else
+    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG regOp1Payload, regOp1Tag, regOp2Payload, regOp2Tag, TrustedImmPtr(uid));
+#endif
     return appendCallWithExceptionCheck(operation);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to