Title: [160821] branches/jsCStack/Source/_javascript_Core
Revision
160821
Author
[email protected]
Date
2013-12-18 19:48:08 -0800 (Wed, 18 Dec 2013)

Log Message

CStack: Fix baseline to DFG JIT OSR.
https://bugs.webkit.org/show_bug.cgi?id=125969.

Reviewed by Filip Pizlo.

1. Change operationOptimize() to return a tuple of OSR target address
   and new topOfFrame value (as opposed to just the OSR target address).
2. Change emitEnterOptimizationCheck() and emitSlow_op_loop_hint() to
   emit code to set the stackPointer with the returned topOfFrame value
   if we take the OSR path.

* jit/JIT.cpp:
(JSC::JIT::emitEnterOptimizationCheck):
* jit/JIT.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emitSlow_op_loop_hint):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* runtime/Options.h:

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2013-12-19 03:48:08 UTC (rev 160821)
@@ -1,3 +1,27 @@
+2013-12-18  Mark Lam  <[email protected]>
+
+        CStack: Fix baseline to DFG JIT OSR.
+        https://bugs.webkit.org/show_bug.cgi?id=125969.
+
+        Reviewed by Filip Pizlo.
+
+        1. Change operationOptimize() to return a tuple of OSR target address
+           and new topOfFrame value (as opposed to just the OSR target address).
+        2. Change emitEnterOptimizationCheck() and emitSlow_op_loop_hint() to
+           emit code to set the stackPointer with the returned topOfFrame value
+           if we take the OSR path.
+
+        * jit/JIT.cpp:
+        (JSC::JIT::emitEnterOptimizationCheck):
+        * jit/JIT.h:
+        * jit/JITInlines.h:
+        (JSC::JIT::callOperation):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emitSlow_op_loop_hint):
+        * jit/JITOperations.cpp:
+        * jit/JITOperations.h:
+        * runtime/Options.h:
+
 2013-12-18  Michael Saboff  <[email protected]>
 
         CStack Branch: Stop threading callFrameRegister through LLIntSlowCalls

Modified: branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JIT.cpp	2013-12-19 03:48:08 UTC (rev 160821)
@@ -102,6 +102,7 @@
     ASSERT(!m_bytecodeOffset);
     callOperation(operationOptimize, m_bytecodeOffset);
     skipOptimize.append(branchTestPtr(Zero, returnValueGPR));
+    move(returnValueGPR2, stackPointerRegister);
     jump(returnValueGPR);
     skipOptimize.link(this);
 }

Modified: branches/jsCStack/Source/_javascript_Core/jit/JIT.h (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JIT.h	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JIT.h	2013-12-19 03:48:08 UTC (rev 160821)
@@ -690,11 +690,11 @@
         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*);
         MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
-        MacroAssembler::Call callOperation(P_JITOperation_EZ, int32_t);
         MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
         MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID);
         MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID);
+        MacroAssembler::Call callOperation(Sprt_JITOperation_EZ, int32_t);
         MacroAssembler::Call callOperation(V_JITOperation_E);
         MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
         MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITInlines.h (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JITInlines.h	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITInlines.h	2013-12-19 03:48:08 UTC (rev 160821)
@@ -217,21 +217,21 @@
     return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
 }
 
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EZ operation, int32_t op)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
 {
-    setupArgumentsWithExecState(TrustedImm32(op));
+    setupArgumentsWithExecState(regOp1, regOp2);
     return appendCallWithExceptionCheck(operation);
 }
 
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_EOJss operation, RegisterID regOp1, RegisterID regOp2)
 {
     setupArgumentsWithExecState(regOp1, regOp2);
     return appendCallWithExceptionCheck(operation);
 }
 
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_EOJss operation, RegisterID regOp1, RegisterID regOp2)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(Sprt_JITOperation_EZ operation, int32_t op)
 {
-    setupArgumentsWithExecState(regOp1, regOp2);
+    setupArgumentsWithExecState(TrustedImm32(op));
     return appendCallWithExceptionCheck(operation);
 }
 

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-19 03:48:08 UTC (rev 160821)
@@ -1116,6 +1116,7 @@
         
         callOperation(operationOptimize, m_bytecodeOffset);
         Jump noOptimizedEntry = branchTestPtr(Zero, returnValueGPR);
+        move(returnValueGPR2, stackPointerRegister);
         jump(returnValueGPR);
         noOptimizedEntry.link(this);
 

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITOperations.cpp (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JITOperations.cpp	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITOperations.cpp	2013-12-19 03:48:08 UTC (rev 160821)
@@ -30,7 +30,6 @@
 #include "Arguments.h"
 #include "ArrayConstructor.h"
 #include "CallFrameInlines.h"
-#include "CommonSlowPaths.h"
 #include "DFGCompilationMode.h"
 #include "DFGDriver.h"
 #include "DFGOSREntry.h"
@@ -974,7 +973,7 @@
 }
 
 #if ENABLE(DFG_JIT)
-char* JIT_OPERATION operationOptimize(ExecState* exec, int32_t bytecodeIndex)
+SlowPathReturnType JIT_OPERATION operationOptimize(ExecState* exec, int32_t bytecodeIndex)
 {
     VM& vm = exec->vm();
     NativeCallFrameTracer tracer(&vm, exec);
@@ -1024,7 +1023,7 @@
         codeBlock->updateAllPredictions();
         if (Options::verboseOSR())
             dataLog("Choosing not to optimize ", *codeBlock, " yet, because the threshold hasn't been reached.\n");
-        return 0;
+        return encodeResult(0, 0);
     }
     
     if (codeBlock->m_shouldAlwaysBeInlined) {
@@ -1032,7 +1031,7 @@
         codeBlock->optimizeAfterWarmUp();
         if (Options::verboseOSR())
             dataLog("Choosing not to optimize ", *codeBlock, " yet, because m_shouldAlwaysBeInlined == true.\n");
-        return 0;
+        return encodeResult(0, 0);
     }
 
     // We cannot be in the process of asynchronous compilation and also have an optimized
@@ -1072,7 +1071,7 @@
         // replacement.
         RELEASE_ASSERT(!codeBlock->hasOptimizedReplacement());
         codeBlock->setOptimizationThresholdBasedOnCompilationResult(CompilationDeferred);
-        return 0;
+        return encodeResult(0, 0);
     }
 
     if (worklistState == DFG::Worklist::Compiled) {
@@ -1085,7 +1084,7 @@
             codeBlock->updateAllPredictions();
             if (Options::verboseOSR())
                 dataLog("Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.\n");
-            return 0;
+            return encodeResult(0, 0);
         }
     } else if (codeBlock->hasOptimizedReplacement()) {
         if (Options::verboseOSR())
@@ -1110,7 +1109,7 @@
                     "(", *codeBlock->replacement(), ") (in loop).\n");
             }
             codeBlock->replacement()->jettison(CountReoptimization);
-            return 0;
+            return encodeResult(0, 0);
         }
     } else {
         if (!codeBlock->shouldOptimizeNow()) {
@@ -1119,7 +1118,7 @@
                     "Delaying optimization for ", *codeBlock,
                     " because of insufficient profiling.\n");
             }
-            return 0;
+            return encodeResult(0, 0);
         }
 
         if (Options::verboseOSR())
@@ -1152,7 +1151,7 @@
             vm.ensureWorklist());
         
         if (result != CompilationSuccessful)
-            return 0;
+            return encodeResult(0, 0);
     }
     
     CodeBlock* optimizedCodeBlock = codeBlock->replacement();
@@ -1166,7 +1165,8 @@
         }
 
         codeBlock->optimizeSoon();
-        return static_cast<char*>(address);
+        ASSERT(exec->codeBlock() == optimizedCodeBlock);
+        return encodeResult(address, exec->topOfFrame());
     }
 
     if (Options::verboseOSR()) {
@@ -1195,14 +1195,14 @@
                 *codeBlock->replacement(), " (after OSR fail).\n");
         }
         optimizedCodeBlock->jettison(CountReoptimization);
-        return 0;
+        return encodeResult(0, 0);
     }
 
     // OSR failed this time, but it might succeed next time! Let the code run a bit
     // longer and then try again.
     codeBlock->optimizeAfterWarmUp();
     
-    return 0;
+    return encodeResult(0, 0);
 }
 #endif
 

Modified: branches/jsCStack/Source/_javascript_Core/jit/JITOperations.h (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/jit/JITOperations.h	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/jit/JITOperations.h	2013-12-19 03:48:08 UTC (rev 160821)
@@ -29,6 +29,7 @@
 #if ENABLE(JIT)
 
 #include "CallFrame.h"
+#include "CommonSlowPaths.h"
 #include "JITExceptions.h"
 #include "JSArray.h"
 #include "JSCJSValue.h"
@@ -72,6 +73,7 @@
     Pc: Instruction* i.e. bytecode PC
     R: Register
     S: size_t
+    Sprt: SlowPathReturnType
     Ssi: StructureStubInfo*
     St: Structure*
     V: void
@@ -133,6 +135,7 @@
 typedef size_t JIT_OPERATION (*S_JITOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
 typedef size_t JIT_OPERATION (*S_JITOperation_EOJss)(ExecState*, JSObject*, JSString*);
 typedef size_t JIT_OPERATION (*S_JITOperation_J)(EncodedJSValue);
+typedef SlowPathReturnType JIT_OPERATION (*Sprt_JITOperation_EZ)(ExecState*, int32_t);
 typedef void JIT_OPERATION (*V_JITOperation_E)(ExecState*);
 typedef void JIT_OPERATION (*V_JITOperation_EC)(ExecState*, JSCell*);
 typedef void JIT_OPERATION (*V_JITOperation_ECb)(ExecState*, CodeBlock*);
@@ -173,7 +176,6 @@
 typedef char* JIT_OPERATION (*P_JITOperation_EStPS)(ExecState*, Structure*, void*, size_t);
 typedef char* JIT_OPERATION (*P_JITOperation_EStSS)(ExecState*, Structure*, size_t, size_t);
 typedef char* JIT_OPERATION (*P_JITOperation_EStZ)(ExecState*, Structure*, int32_t);
-typedef char* JIT_OPERATION (*P_JITOperation_EZ)(ExecState*, int32_t);
 typedef char* JIT_OPERATION (*P_JITOperation_EZZ)(ExecState*, int32_t, int32_t);
 typedef StringImpl* JIT_OPERATION (*I_JITOperation_EJss)(ExecState*, JSString*);
 typedef JSString* JIT_OPERATION (*Jss_JITOperation_EZ)(ExecState*, int32_t);
@@ -241,7 +243,7 @@
 void JIT_OPERATION operationThrow(ExecState*, EncodedJSValue) WTF_INTERNAL;
 void JIT_OPERATION operationDebug(ExecState*, int32_t) WTF_INTERNAL;
 #if ENABLE(DFG_JIT)
-char* JIT_OPERATION operationOptimize(ExecState*, int32_t) WTF_INTERNAL;
+SlowPathReturnType JIT_OPERATION operationOptimize(ExecState*, int32_t) WTF_INTERNAL;
 #endif
 void JIT_OPERATION operationPutByIndex(ExecState*, EncodedJSValue, int32_t, EncodedJSValue);
 #if USE(JSVALUE64)

Modified: branches/jsCStack/Source/_javascript_Core/runtime/Options.h (160820 => 160821)


--- branches/jsCStack/Source/_javascript_Core/runtime/Options.h	2013-12-19 03:13:18 UTC (rev 160820)
+++ branches/jsCStack/Source/_javascript_Core/runtime/Options.h	2013-12-19 03:48:08 UTC (rev 160821)
@@ -120,7 +120,7 @@
     v(bool, reportCompileTimes, false) \
     v(bool, verboseCFA, false) \
     \
-    v(bool, enableOSREntryToDFG, false) \
+    v(bool, enableOSREntryToDFG, true) \
     \
     v(bool, useExperimentalFTL, false) \
     v(bool, useFTLTBAA, true) \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to