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

Value profiling should use tier-up threshold randomization to get more coverage
https://bugs.webkit.org/show_bug.cgi?id=89802

Source/JavaScriptCore:

Reviewed by Gavin Barraclough.

This patch causes both LLInt and Baseline JIT code to take the OSR slow path several
times before actually doing OSR. If we take the OSR slow path before the execution
count threshold is reached, then we just call CodeBlock::updateAllPredictions() to
compute the current latest least-upper-bound SpecType of all values seen in each
ValueProfile.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::stronglyVisitStrongReferences):
(JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
(JSC):
(JSC::CodeBlock::updateAllPredictions):
(JSC::CodeBlock::shouldOptimizeNow):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::llintExecuteCounter):
(JSC::CodeBlock::jitExecuteCounter):
(CodeBlock):
(JSC::CodeBlock::updateAllPredictions):

  • bytecode/ExecutionCounter.cpp:

(JSC::ExecutionCounter::setThreshold):
(JSC::ExecutionCounter::status):
(JSC):

  • bytecode/ExecutionCounter.h:

(JSC::ExecutionCounter::count):
(ExecutionCounter):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::JSGlobalObject):
(JSC):

  • runtime/JSGlobalObject.h:

(JSGlobalObject):
(JSC::JSGlobalObject::weakRandomInteger):

  • runtime/Options.cpp:

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

  • runtime/Options.h:

(Options):

  • runtime/WeakRandom.h:

(WeakRandom):
(JSC::WeakRandom::seedUnsafe):

LayoutTests:

Reviewed by Gavin Barraclough.

  • fast/js/dfg-store-unexpected-value-into-argument-and-osr-exit-expected.txt: Added.
  • fast/js/dfg-store-unexpected-value-into-argument-and-osr-exit.html: Added.
  • fast/js/script-tests/dfg-store-unexpected-value-into-argument-and-osr-exit.js: Added.

(foo):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp

    r110453 r121215  
    2929#include "CodeBlock.h"
    3030#include "ExecutableAllocator.h"
     31#include <wtf/StringExtras.h>
    3132
    3233namespace JSC {
     
    126127       
    127128    // Compute the true total count.
    128     double trueTotalCount = static_cast<double>(m_totalCount) + m_counter;
     129    double trueTotalCount = count();
    129130       
    130131    // Correct the threshold for current memory usage.
     
    144145    }
    145146
    146     if (threshold > std::numeric_limits<int32_t>::max())
    147         threshold = std::numeric_limits<int32_t>::max();
    148        
     147    int32_t maxThreshold =
     148        codeBlock->globalObject()->weakRandomInteger() % Options::maximumExecutionCountsBetweenCheckpoints;
     149    if (threshold > maxThreshold)
     150        threshold = maxThreshold;
     151   
    149152    m_counter = static_cast<int32_t>(-threshold);
    150153       
     
    161164}
    162165
     166const char* ExecutionCounter::status() const
     167{
     168    static char result[80];
     169    snprintf(result, sizeof(result), "%lf/%lf, %d", count(), static_cast<double>(m_activeThreshold), m_counter);
     170    return result;
     171}
     172
    163173} // namespace JSC
    164174
Note: See TracChangeset for help on using the changeset viewer.