Title: [154837] trunk/Source/_javascript_Core
Revision
154837
Author
[email protected]
Date
2013-08-29 13:27:15 -0700 (Thu, 29 Aug 2013)

Log Message

CodeBlock's magic for scaling tier-up thresholds should be more reusable
https://bugs.webkit.org/show_bug.cgi?id=120486

Reviewed by Oliver Hunt.
        
Removed the counterValueForBlah() methods and exposed the reusable scaling logic
as a adjustedCounterValue() method.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::adjustedCounterValue):
(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::optimizeAfterLongWarmUp):
(JSC::CodeBlock::optimizeSoon):
* bytecode/CodeBlock.h:
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::handleExitCounts):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (154836 => 154837)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-29 20:09:21 UTC (rev 154836)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-29 20:27:15 UTC (rev 154837)
@@ -1,5 +1,24 @@
 2013-08-29  Filip Pizlo  <[email protected]>
 
+        CodeBlock's magic for scaling tier-up thresholds should be more reusable
+        https://bugs.webkit.org/show_bug.cgi?id=120486
+
+        Reviewed by Oliver Hunt.
+        
+        Removed the counterValueForBlah() methods and exposed the reusable scaling logic
+        as a adjustedCounterValue() method.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::adjustedCounterValue):
+        (JSC::CodeBlock::optimizeAfterWarmUp):
+        (JSC::CodeBlock::optimizeAfterLongWarmUp):
+        (JSC::CodeBlock::optimizeSoon):
+        * bytecode/CodeBlock.h:
+        * dfg/DFGOSRExitCompilerCommon.cpp:
+        (JSC::DFG::handleExitCounts):
+
+2013-08-29  Filip Pizlo  <[email protected]>
+
         CodeBlock::prepareForExecution() is silly
         https://bugs.webkit.org/show_bug.cgi?id=120453
 

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (154836 => 154837)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-08-29 20:09:21 UTC (rev 154836)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-08-29 20:27:15 UTC (rev 154837)
@@ -2962,30 +2962,14 @@
     return static_cast<int32_t>(threshold);
 }
 
-int32_t CodeBlock::counterValueForOptimizeAfterWarmUp()
+int32_t CodeBlock::adjustedCounterValue(int32_t desiredThreshold)
 {
     return clipThreshold(
-        Options::thresholdForOptimizeAfterWarmUp() *
+        static_cast<double>(desiredThreshold) *
         optimizationThresholdScalingFactor() *
         (1 << reoptimizationRetryCounter()));
 }
 
-int32_t CodeBlock::counterValueForOptimizeAfterLongWarmUp()
-{
-    return clipThreshold(
-        Options::thresholdForOptimizeAfterLongWarmUp() *
-        optimizationThresholdScalingFactor() *
-        (1 << reoptimizationRetryCounter()));
-}
-
-int32_t CodeBlock::counterValueForOptimizeSoon()
-{
-    return clipThreshold(
-        Options::thresholdForOptimizeSoon() *
-        optimizationThresholdScalingFactor() *
-        (1 << reoptimizationRetryCounter()));
-}
-
 bool CodeBlock::checkIfOptimizationThresholdReached()
 {
 #if ENABLE(DFG_JIT)
@@ -3018,7 +3002,8 @@
     if (Options::verboseOSR())
         dataLog(*this, ": Optimizing after warm-up.\n");
 #if ENABLE(DFG_JIT)
-    m_jitExecuteCounter.setNewThreshold(counterValueForOptimizeAfterWarmUp(), this);
+    m_jitExecuteCounter.setNewThreshold(
+        adjustedCounterValue(Options::thresholdForOptimizeAfterWarmUp()), this);
 #endif
 }
 
@@ -3027,7 +3012,8 @@
     if (Options::verboseOSR())
         dataLog(*this, ": Optimizing after long warm-up.\n");
 #if ENABLE(DFG_JIT)
-    m_jitExecuteCounter.setNewThreshold(counterValueForOptimizeAfterLongWarmUp(), this);
+    m_jitExecuteCounter.setNewThreshold(
+        adjustedCounterValue(Options::thresholdForOptimizeAfterLongWarmUp()), this);
 #endif
 }
 
@@ -3036,7 +3022,8 @@
     if (Options::verboseOSR())
         dataLog(*this, ": Optimizing soon.\n");
 #if ENABLE(DFG_JIT)
-    m_jitExecuteCounter.setNewThreshold(counterValueForOptimizeSoon(), this);
+    m_jitExecuteCounter.setNewThreshold(
+        adjustedCounterValue(Options::thresholdForOptimizeSoon()), this);
 #endif
 }
 

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (154836 => 154837)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-08-29 20:09:21 UTC (rev 154836)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-08-29 20:27:15 UTC (rev 154837)
@@ -827,9 +827,7 @@
 
     int32_t codeTypeThresholdMultiplier() const;
 
-    int32_t counterValueForOptimizeAfterWarmUp();
-    int32_t counterValueForOptimizeAfterLongWarmUp();
-    int32_t counterValueForOptimizeSoon();
+    int32_t adjustedCounterValue(int32_t desiredThreshold);
 
     int32_t* addressOfJITExecuteCounter()
     {

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp (154836 => 154837)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp	2013-08-29 20:09:21 UTC (rev 154836)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp	2013-08-29 20:27:15 UTC (rev 154837)
@@ -71,7 +71,8 @@
     
     // Adjust the execution counter such that the target is to only optimize after a while.
     int32_t activeThreshold =
-        jit.baselineCodeBlock()->counterValueForOptimizeAfterLongWarmUp();
+        jit.baselineCodeBlock()->adjustedCounterValue(
+            Options::thresholdForOptimizeAfterLongWarmUp());
     int32_t targetValue = ExecutionCounter::applyMemoryUsageHeuristicsAndConvertToInt(
         activeThreshold, jit.baselineCodeBlock());
     int32_t clippedValue =
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to