Title: [160506] branches/jsCStack/Source/_javascript_Core
Revision
160506
Author
[email protected]
Date
2013-12-12 14:54:00 -0800 (Thu, 12 Dec 2013)

Log Message

CStack Branch: Eliminate unnecessary add/sub 16 to stack pointer
https://bugs.webkit.org/show_bug.cgi?id=125653

Not yet reviewed.

Changed the DFG stack frame to include outgoing space for at least the two
pointers for returnPC and callerFrame.  Changed the setting of the stack
pointer to not include the space for the outgoing returnPC and callerFrame.
Eliminated the add/sub 16 around calls in the DFG.

Adjusted the LLInt and baseline JIT calculation of the stack pointer for calls.
In both cases, the frame is set up with temp that points to the base of the callee
frame.  The space for the outgoing returnPC and callerFrame is added to the temp
to create the stack pointer for the call.

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::frameRegisterCount):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* interpreter/JSStack.h:
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter64.asm:

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-12 22:54:00 UTC (rev 160506)
@@ -1,3 +1,30 @@
+2013-12-12  Michael Saboff  <[email protected]>
+
+        CStack Branch: Eliminate unnecessary add/sub 16 to stack pointer
+        https://bugs.webkit.org/show_bug.cgi?id=125653
+
+        Not yet reviewed.
+
+        Changed the DFG stack frame to include outgoing space for at least the two
+        pointers for returnPC and callerFrame.  Changed the setting of the stack
+        pointer to not include the space for the outgoing returnPC and callerFrame.
+        Eliminated the add/sub 16 around calls in the DFG.  
+
+        Adjusted the LLInt and baseline JIT calculation of the stack pointer for calls. 
+        In both cases, the frame is set up with temp that points to the base of the callee
+        frame.  The space for the outgoing returnPC and callerFrame is added to the temp 
+        to create the stack pointer for the call.
+
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::frameRegisterCount):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::emitCall):
+        * interpreter/JSStack.h:
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileOpCall):
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter64.asm:
+
 2013-12-12  Mark Lam  <[email protected]>
 
         Fix handling of uncaught exceptions.

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-12-12 22:54:00 UTC (rev 160506)
@@ -703,7 +703,7 @@
 
 unsigned Graph::frameRegisterCount()
 {
-    unsigned result = m_nextMachineLocal + m_parameterSlots;
+    unsigned result = m_nextMachineLocal + std::max(m_parameterSlots, (unsigned)JSStack::CallerFrameAndPCSize);
     result += result & 1; // Align the register count
     return result;
 }

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2013-12-12 22:54:00 UTC (rev 160506)
@@ -714,24 +714,17 @@
     m_jit.loadPtr(MacroAssembler::Address(calleeGPR, OBJECT_OFFSETOF(JSFunction, m_scope)), resultGPR);
     m_jit.store64(resultGPR, calleeFrameSlot(JSStack::ScopeChain));
 
-    // FIXME: CStack - remove the add/sub 16 before and after call.
-    m_jit.addPtr(TrustedImm32(16), MacroAssembler::stackPointerRegister);
-    
     JITCompiler::Call fastCall = m_jit.nearCall();
 
     JITCompiler::Jump done = m_jit.jump();
     
     slowPath.link(&m_jit);
     
-    m_jit.addPtr(TrustedImm32(16), MacroAssembler::stackPointerRegister);
-    
     m_jit.move(calleeGPR, GPRInfo::regT0); // Callee needs to be in regT0
     JITCompiler::Call slowCall = m_jit.nearCall();
     
     done.link(&m_jit);
     
-    m_jit.addPtr(TrustedImm32(-16), MacroAssembler::stackPointerRegister);
-    
     m_jit.move(GPRInfo::returnValueGPR, resultGPR);
     
     jsValueResult(resultGPR, m_currentNode, DataFormatJS, UseChildrenCalledExplicitly);

Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h	2013-12-12 22:54:00 UTC (rev 160506)
@@ -61,8 +61,8 @@
         WTF_MAKE_NONCOPYABLE(JSStack);
     public:
         enum CallFrameHeaderEntry {
-            CallerFrameAndPCSize = 0,
-            CodeBlock = sizeof(CallerFrameAndPC) / sizeof(Register),
+            CallerFrameAndPCSize = sizeof(CallerFrameAndPC) / sizeof(Register),
+            CodeBlock = CallerFrameAndPCSize,
             ScopeChain,
             Callee,
             ArgumentCount,

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITCall.cpp (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/jit/JITCall.cpp	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITCall.cpp	2013-12-12 22:54:00 UTC (rev 160506)
@@ -198,7 +198,7 @@
 
     loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scope)), regT2);
     store64(regT2, Address(regT1, JSStack::ScopeChain * sizeof(Register)));
-    addPtr(TrustedImm32(16), regT1, stackPointerRegister);
+    addPtr(TrustedImm32(JSStack::CallerFrameAndPCSize * static_cast<int>(sizeof(Register))), regT1, stackPointerRegister);
 
     m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
 

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2013-12-12 22:54:00 UTC (rev 160506)
@@ -41,6 +41,8 @@
 end
 const SlotSize = 8
 
+const CallerFrameAndPCSize = 2 * PtrSize
+
 const CallerFrame = 0
 const ReturnPC = CallerFrame + PtrSize
 const CodeBlock = ReturnPC + PtrSize
@@ -264,7 +266,7 @@
     if C_LOOP
         cloopCallJSFunction LLIntCallLinkInfo::machineCodeTarget[callLinkInfo]
     else
-        prepareStackPointerForJSCall(calleeFramePtr)
+        move calleeFramePtr, sp
         call LLIntCallLinkInfo::machineCodeTarget[callLinkInfo]
         restoreStackPointerAfterJSCall()
         dispatchAfterCall()
@@ -278,7 +280,7 @@
             if C_LOOP
                 cloopCallJSFunction callee
             else
-                prepareStackPointerForJSCall(t1) # The slow patch leaves the calle ExecState* in t1
+                addp CallerFrameAndPCSize, t1, sp
                 call callee
                 restoreStackPointerAfterJSCall()
                 dispatchAfterCall()

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (160505 => 160506)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2013-12-12 21:25:34 UTC (rev 160505)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2013-12-12 22:54:00 UTC (rev 160506)
@@ -152,10 +152,6 @@
     subp cfr, t1, sp
 end
 
-macro prepareStackPointerForJSCall(calleeFramePtr)
-    addp 16, calleeFramePtr, sp
-end
-
 macro restoreStackPointerAfterJSCall()
     loadp CodeBlock[cfr], t1
     loadi CodeBlock::m_numCalleeRegisters[t1], t1
@@ -1748,6 +1744,7 @@
     loadisFromInstruction(3, t2)
     storei PC, ArgumentCount + TagOffset[cfr]
     storei t2, ArgumentCount + PayloadOffset[t3]
+    addp CallerFrameAndPCSize, t3
     callTargetFunction(t1,t3)
 
 .opCallSlow:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to