Title: [220081] trunk/Source/_javascript_Core
Revision
220081
Author
mark....@apple.com
Date
2017-07-31 16:30:38 -0700 (Mon, 31 Jul 2017)

Log Message

Added some UNLIKELYs to operationOptimize().
https://bugs.webkit.org/show_bug.cgi?id=174976

Reviewed by JF Bastien.

* jit/JITOperations.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (220080 => 220081)


--- trunk/Source/_javascript_Core/ChangeLog	2017-07-31 23:30:25 UTC (rev 220080)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-07-31 23:30:38 UTC (rev 220081)
@@ -1,3 +1,12 @@
+2017-07-31  Mark Lam  <mark....@apple.com>
+
+        Added some UNLIKELYs to operationOptimize().
+        https://bugs.webkit.org/show_bug.cgi?id=174976
+
+        Reviewed by JF Bastien.
+
+        * jit/JITOperations.cpp:
+
 2017-07-31  Keith Miller  <keith_mil...@apple.com>
 
         Make more things LLInt constexprs

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (220080 => 220081)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2017-07-31 23:30:25 UTC (rev 220080)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2017-07-31 23:30:38 UTC (rev 220081)
@@ -1298,7 +1298,7 @@
     DeferGCForAWhile deferGC(vm.heap);
     
     CodeBlock* codeBlock = exec->codeBlock();
-    if (codeBlock->jitType() != JITCode::BaselineJIT) {
+    if (UNLIKELY(codeBlock->jitType() != JITCode::BaselineJIT)) {
         dataLog("Unexpected code block in Baseline->DFG tier-up: ", *codeBlock, "\n");
         RELEASE_ASSERT_NOT_REACHED();
     }
@@ -1309,7 +1309,7 @@
         codeBlock->m_shouldAlwaysBeInlined = false;
     }
 
-    if (Options::verboseOSR()) {
+    if (UNLIKELY(Options::verboseOSR())) {
         dataLog(
             *codeBlock, ": Entered optimize with bytecodeIndex = ", bytecodeIndex,
             ", executeCounter = ", codeBlock->jitExecuteCounter(),
@@ -1325,13 +1325,13 @@
     if (!codeBlock->checkIfOptimizationThresholdReached()) {
         CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("counter = ", codeBlock->jitExecuteCounter()));
         codeBlock->updateAllPredictions();
-        if (Options::verboseOSR())
+        if (UNLIKELY(Options::verboseOSR()))
             dataLog("Choosing not to optimize ", *codeBlock, " yet, because the threshold hasn't been reached.\n");
         return encodeResult(0, 0);
     }
     
     Debugger* debugger = codeBlock->globalObject()->debugger();
-    if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) {
+    if (UNLIKELY(debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests()))) {
         CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("debugger is stepping or has requests"));
         updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
         return encodeResult(0, 0);
@@ -1340,7 +1340,7 @@
     if (codeBlock->m_shouldAlwaysBeInlined) {
         CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should always be inlined"));
         updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
-        if (Options::verboseOSR())
+        if (UNLIKELY(Options::verboseOSR()))
             dataLog("Choosing not to optimize ", *codeBlock, " yet, because m_shouldAlwaysBeInlined == true.\n");
         return encodeResult(0, 0);
     }
@@ -1396,12 +1396,12 @@
         if (!codeBlock->hasOptimizedReplacement()) {
             CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("compiled and failed"));
             codeBlock->updateAllPredictions();
-            if (Options::verboseOSR())
+            if (UNLIKELY(Options::verboseOSR()))
                 dataLog("Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.\n");
             return encodeResult(0, 0);
         }
     } else if (codeBlock->hasOptimizedReplacement()) {
-        if (Options::verboseOSR())
+        if (UNLIKELY(Options::verboseOSR()))
             dataLog("Considering OSR ", *codeBlock, " -> ", *codeBlock->replacement(), ".\n");
         // If we have an optimized replacement, then it must be the case that we entered
         // cti_optimize from a loop. That's because if there's an optimized replacement,
@@ -1418,7 +1418,7 @@
         // additional checking anyway, to reduce the amount of recompilation thrashing.
         if (codeBlock->replacement()->shouldReoptimizeFromLoopNow()) {
             CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should reoptimize from loop now"));
-            if (Options::verboseOSR()) {
+            if (UNLIKELY(Options::verboseOSR())) {
                 dataLog(
                     "Triggering reoptimization of ", *codeBlock,
                     "(", *codeBlock->replacement(), ") (in loop).\n");
@@ -1429,7 +1429,7 @@
     } else {
         if (!codeBlock->shouldOptimizeNow()) {
             CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("insufficient profiling"));
-            if (Options::verboseOSR()) {
+            if (UNLIKELY(Options::verboseOSR())) {
                 dataLog(
                     "Delaying optimization for ", *codeBlock,
                     " because of insufficient profiling.\n");
@@ -1437,7 +1437,7 @@
             return encodeResult(0, 0);
         }
 
-        if (Options::verboseOSR())
+        if (UNLIKELY(Options::verboseOSR()))
             dataLog("Triggering optimized compilation of ", *codeBlock, "\n");
 
         unsigned numVarsWithValues;
@@ -1470,7 +1470,7 @@
     
     if (void* dataBuffer = DFG::prepareOSREntry(exec, optimizedCodeBlock, bytecodeIndex)) {
         CODEBLOCK_LOG_EVENT(optimizedCodeBlock, "osrEntry", ("at bc#", bytecodeIndex));
-        if (Options::verboseOSR()) {
+        if (UNLIKELY(Options::verboseOSR())) {
             dataLog(
                 "Performing OSR ", *codeBlock, " -> ", *optimizedCodeBlock, ".\n");
         }
@@ -1480,7 +1480,7 @@
         return encodeResult(vm.getCTIStub(DFG::osrEntryThunkGenerator).code().executableAddress(), dataBuffer);
     }
 
-    if (Options::verboseOSR()) {
+    if (UNLIKELY(Options::verboseOSR())) {
         dataLog(
             "Optimizing ", *codeBlock, " -> ", *codeBlock->replacement(),
             " succeeded, OSR failed, after a delay of ",
@@ -1501,7 +1501,7 @@
     // reoptimization trigger.
     if (optimizedCodeBlock->shouldReoptimizeNow()) {
         CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should reoptimize now"));
-        if (Options::verboseOSR()) {
+        if (UNLIKELY(Options::verboseOSR())) {
             dataLog(
                 "Triggering reoptimization of ", *codeBlock, " -> ",
                 *codeBlock->replacement(), " (after OSR fail).\n");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to