Ignore:
Timestamp:
Jun 28, 2012, 7:40:14 PM (13 years ago)
Author:
[email protected]
Message:

DFG recompilation heuristics should be based on count, not rate
https://bugs.webkit.org/show_bug.cgi?id=90146

Reviewed by Oliver Hunt.

This removes a bunch of code that was previously trying to prevent spurious
reoptimizations if a large enough majority of executions of a code block did
not result in OSR exit. It turns out that this code was purely harmful. This
patch removes all of that logic and replaces it with a dead-simple
heuristic: if you exit more than N times (where N is an exponential function
of the number of times the code block has already been recompiled) then we
will recompile.

This appears to be a broad ~1% win on many benchmarks large and small.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::osrExitCounter):
(JSC::CodeBlock::countOSRExit):
(CodeBlock):
(JSC::CodeBlock::addressOfOSRExitCounter):
(JSC::CodeBlock::offsetOfOSRExitCounter):
(JSC::CodeBlock::adjustedExitCountThreshold):
(JSC::CodeBlock::exitCountThresholdForReoptimization):
(JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
(JSC::CodeBlock::shouldReoptimizeNow):
(JSC::CodeBlock::shouldReoptimizeFromLoopNow):

  • bytecode/ExecutionCounter.cpp:

(JSC::ExecutionCounter::setThreshold):

  • bytecode/ExecutionCounter.h:

(ExecutionCounter):
(JSC::ExecutionCounter::clippedThreshold):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compileBody):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):

  • dfg/DFGOSRExitCompiler.cpp:

(JSC::DFG::OSRExitCompiler::handleExitCounts):

  • dfg/DFGOperations.cpp:
  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Options.cpp:

(Options):
(JSC::Options::initializeOptions):

  • runtime/Options.h:

(Options):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r121280 r121511  
    12511251    dataLog("Speculation failure in %p at @%u with executeCounter = %s, "
    12521252            "reoptimizationRetryCounter = %u, optimizationDelayCounter = %u, "
    1253             "success/fail %u/(%u+%u)\n",
     1253            "osrExitCounter = %u\n",
    12541254            codeBlock,
    12551255            debugInfo->nodeIndex,
     
    12571257            alternative ? alternative->reoptimizationRetryCounter() : 0,
    12581258            alternative ? alternative->optimizationDelayCounter() : 0,
    1259             codeBlock->speculativeSuccessCounter(),
    1260             codeBlock->speculativeFailCounter(),
    1261             codeBlock->forcedOSRExitCounter());
     1259            codeBlock->osrExitCounter());
    12621260}
    12631261#endif
Note: See TracChangeset for help on using the changeset viewer.