Changeset 182337 in webkit


Ignore:
Timestamp:
Apr 3, 2015 3:52:00 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

Add Options::jitPolicyScale() as a single knob to make all compilations happen sooner.
<https://webkit.org/b/143385>

Reviewed by Geoffrey Garen.

For debugging purposes, sometimes, we want to be able to make compilation happen
sooner to see if we can accelerate the manifestation of certain events / bugs.
Currently, in order to achieve this, we'll have to tweak multiple JIT thresholds
which make up the compilation policy. Let's add a single knob that can tune all
the thresholds up / down in one go proportionately so that we can easily tweak
how soon compilation occurs.

  • runtime/Options.cpp:

(JSC::scaleJITPolicy):
(JSC::recomputeDependentOptions):

  • runtime/Options.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r182336 r182337  
     12015-04-03  Mark Lam  <mark.lam@apple.com>
     2
     3        Add Options::jitPolicyScale() as a single knob to make all compilations happen sooner.
     4        <https://webkit.org/b/143385>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        For debugging purposes, sometimes, we want to be able to make compilation happen
     9        sooner to see if we can accelerate the manifestation of certain events / bugs.
     10        Currently, in order to achieve this, we'll have to tweak multiple JIT thresholds
     11        which make up the compilation policy.  Let's add a single knob that can tune all
     12        the thresholds up / down in one go proportionately so that we can easily tweak
     13        how soon compilation occurs.
     14
     15        * runtime/Options.cpp:
     16        (JSC::scaleJITPolicy):
     17        (JSC::recomputeDependentOptions):
     18        * runtime/Options.h:
     19
    1202015-04-03  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r182331 r182337  
    213213};
    214214
     215static void scaleJITPolicy()
     216{
     217    auto& scaleFactor = Options::jitPolicyScale();
     218    if (scaleFactor > 1.0)
     219        scaleFactor = 1.0;
     220    else if (scaleFactor < 0.0)
     221        scaleFactor = 0.0;
     222
     223    struct OptionToScale {
     224        Options::OptionID id;
     225        int32_t minVal;
     226    };
     227
     228    static const OptionToScale optionsToScale[] = {
     229        { Options::thresholdForJITAfterWarmUpID, 0 },
     230        { Options::thresholdForJITSoonID, 0 },
     231        { Options::thresholdForOptimizeAfterWarmUpID, 1 },
     232        { Options::thresholdForOptimizeAfterLongWarmUpID, 1 },
     233        { Options::thresholdForOptimizeSoonID, 1 },
     234        { Options::thresholdForFTLOptimizeSoonID, 2 },
     235        { Options::thresholdForFTLOptimizeAfterWarmUpID, 2 }
     236    };
     237
     238    const int numberOfOptionsToScale = sizeof(optionsToScale) / sizeof(OptionToScale);
     239    for (int i = 0; i < numberOfOptionsToScale; i++) {
     240        Option option(optionsToScale[i].id);
     241        ASSERT(option.type() == Options::Type::int32Type);
     242        option.int32Val() *= scaleFactor;
     243        option.int32Val() = std::max(option.int32Val(), optionsToScale[i].minVal);
     244    }
     245}
     246
    215247static void recomputeDependentOptions()
    216248{
     
    256288        || Options::verboseFTLFailure())
    257289        Options::alwaysComputeHash() = true;
    258    
     290
     291    if (Option(Options::jitPolicyScaleID).isOverridden())
     292        scaleJITPolicy();
     293
    259294    // Compute the maximum value of the reoptimization retry counter. This is simply
    260295    // the largest value at which we don't overflow the execute counter, when using it
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r182331 r182337  
    228228    v(unsigned, maximumBinaryStringSwitchTotalLength, 2000, nullptr) \
    229229    \
     230    v(double, jitPolicyScale, 1.0, "scale JIT thresholds to this specified ratio between 0.0 (compile ASAP) and 1.0 (compile like normal).") \
    230231    v(int32, thresholdForJITAfterWarmUp, 500, nullptr) \
    231232    v(int32, thresholdForJITSoon, 100, nullptr) \
Note: See TracChangeset for help on using the changeset viewer.