Title: [230175] trunk/Source/_javascript_Core
Revision
230175
Author
[email protected]
Date
2018-04-02 13:07:47 -0700 (Mon, 02 Apr 2018)

Log Message

We should not trash the stack pointer on OSR entry.
https://bugs.webkit.org/show_bug.cgi?id=184243
<rdar://problem/39114319>

Reviewed by Filip Pizlo.

In the DFG OSR entry path, we momentarily over-write the stack pointer with
returnValueGPR2.  returnValueGPR2 contains a pointer to a side buffer we malloc'ed.
Hence, this assignment is wrong, and it turns out to be unnecessary as well.
The stack pointer does get corrected later in the thunk (generated by
osrEntryThunkGenerator()) that we jump to.  This is why we don't see ill-effects
so far.

This bug only poses an issue if interrupts use the user stack for their stack
frame (e.g. linux), and when we do stack alignment tests during debugging.

The fix is simply to remove the assignment.

* dfg/DFGThunks.cpp:
(JSC::DFG::osrEntryThunkGenerator):
* jit/JIT.cpp:
(JSC::JIT::emitEnterOptimizationCheck):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (230174 => 230175)


--- trunk/Source/_javascript_Core/ChangeLog	2018-04-02 20:05:48 UTC (rev 230174)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-04-02 20:07:47 UTC (rev 230175)
@@ -1,3 +1,28 @@
+2018-04-02  Mark Lam  <[email protected]>
+
+        We should not trash the stack pointer on OSR entry.
+        https://bugs.webkit.org/show_bug.cgi?id=184243
+        <rdar://problem/39114319>
+
+        Reviewed by Filip Pizlo.
+
+        In the DFG OSR entry path, we momentarily over-write the stack pointer with
+        returnValueGPR2.  returnValueGPR2 contains a pointer to a side buffer we malloc'ed.
+        Hence, this assignment is wrong, and it turns out to be unnecessary as well.
+        The stack pointer does get corrected later in the thunk (generated by
+        osrEntryThunkGenerator()) that we jump to.  This is why we don't see ill-effects
+        so far.
+
+        This bug only poses an issue if interrupts use the user stack for their stack
+        frame (e.g. linux), and when we do stack alignment tests during debugging.
+
+        The fix is simply to remove the assignment.
+
+        * dfg/DFGThunks.cpp:
+        (JSC::DFG::osrEntryThunkGenerator):
+        * jit/JIT.cpp:
+        (JSC::JIT::emitEnterOptimizationCheck):
+
 2018-04-02  Stanislav Ocovaj  <[email protected]>
 
         [MIPS] Optimize JIT code generated by methods with TrustedImm32 operand

Modified: trunk/Source/_javascript_Core/dfg/DFGThunks.cpp (230174 => 230175)


--- trunk/Source/_javascript_Core/dfg/DFGThunks.cpp	2018-04-02 20:05:48 UTC (rev 230174)
+++ trunk/Source/_javascript_Core/dfg/DFGThunks.cpp	2018-04-02 20:07:47 UTC (rev 230175)
@@ -112,9 +112,10 @@
 {
     AssemblyHelpers jit(nullptr);
 
-    // We get passed the address of a scratch buffer. The first 8-byte slot of the buffer
-    // is the frame size. The second 8-byte slot is the pointer to where we are supposed to
-    // jump. The remaining bytes are the new call frame header followed by the locals.
+    // We get passed the address of a scratch buffer in GPRInfo::returnValueGPR2.
+    // The first 8-byte slot of the buffer is the frame size. The second 8-byte slot
+    // is the pointer to where we are supposed to jump. The remaining bytes are
+    // the new call frame header followed by the locals.
     
     ptrdiff_t offsetOfFrameSize = 0; // This is the DFG frame count.
     ptrdiff_t offsetOfTargetPC = offsetOfFrameSize + sizeof(EncodedJSValue);

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (230174 => 230175)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2018-04-02 20:05:48 UTC (rev 230174)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2018-04-02 20:07:47 UTC (rev 230175)
@@ -111,7 +111,6 @@
 
     callOperation(operationOptimize, m_bytecodeOffset);
     skipOptimize.append(branchTestPtr(Zero, returnValueGPR));
-    move(returnValueGPR2, stackPointerRegister);
     jump(returnValueGPR, NoPtrTag);
     skipOptimize.link(this);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to