Changeset 103286 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Dec 19, 2011, 5:11:36 PM (13 years ago)
Author:
[email protected]
Message:

It should be possible to change the value of an Options variable without recompiling the world
https://bugs.webkit.org/show_bug.cgi?id=74807

Reviewed by Gavin Barraclough.

  • runtime/Options.cpp:

(JSC::Options::initializeOptions):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r103255 r103286  
     12011-12-18  Filip Pizlo  <[email protected]>
     2
     3        It should be possible to change the value of an Options variable without recompiling the world
     4        https://bugs.webkit.org/show_bug.cgi?id=74807
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        * runtime/Options.cpp:
     9        (JSC::Options::initializeOptions):
     10        * runtime/Options.h:
     11
    1122011-12-19  Sheriff Bot  <[email protected]>
    213
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r102978 r103286  
    4545namespace JSC { namespace Options {
    4646
    47 #define DEFINE(type, cname, default_val) type cname;
    48 FOR_EACH_OPTION(DEFINE)
    49 #undef DEFINE
     47unsigned maximumOptimizationCandidateInstructionCount;
     48
     49unsigned maximumFunctionForCallInlineCandidateInstructionCount;
     50unsigned maximumFunctionForConstructInlineCandidateInstructionCount;
     51
     52unsigned maximumInliningDepth;
     53
     54int32_t executionCounterValueForOptimizeAfterWarmUp;
     55int32_t executionCounterValueForOptimizeAfterLongWarmUp;
     56int32_t executionCounterValueForDontOptimizeAnytimeSoon;
     57int32_t executionCounterValueForOptimizeSoon;
     58int32_t executionCounterValueForOptimizeNextInvocation;
     59
     60int32_t executionCounterIncrementForLoop;
     61int32_t executionCounterIncrementForReturn;
     62
     63unsigned desiredSpeculativeSuccessFailRatio;
     64
     65double likelyToTakeSlowCaseThreshold;
     66double couldTakeSlowCaseThreshold;
     67unsigned likelyToTakeSlowCaseMinimumCount;
     68unsigned couldTakeSlowCaseMinimumCount;
     69
     70double osrExitProminenceForFrequentExitSite;
     71
     72unsigned largeFailCountThresholdBase;
     73unsigned largeFailCountThresholdBaseForLoop;
     74
     75unsigned reoptimizationRetryCounterMax;
     76unsigned reoptimizationRetryCounterStep;
     77
     78unsigned minimumOptimizationDelay;
     79unsigned maximumOptimizationDelay;
     80double desiredProfileLivenessRate;
     81double desiredProfileFullnessRate;
     82
     83double doubleVoteRatioForDoubleFormat;
     84
     85unsigned minimumNumberOfScansBetweenRebalance;
     86unsigned gcMarkStackSegmentSize;
     87unsigned minimumNumberOfCellsToKeep;
     88unsigned maximumNumberOfSharedSegments;
     89unsigned sharedStackWakeupThreshold;
     90unsigned numberOfGCMarkers;
     91unsigned opaqueRootMergeThreshold;
    5092
    5193#if ENABLE(RUN_TIME_HEURISTICS)
     
    88130void initializeOptions()
    89131{
    90 #define INIT(type, cname, default_val) SET(cname, default_val);
    91     FOR_EACH_OPTION(INIT)
    92 #undef INIT
    93 
    94     // Now we initialize heuristics whose defaults are not known at
    95     // compile-time.
    96 
    97     if (!gcMarkStackSegmentSize)
    98         gcMarkStackSegmentSize = pageSize();
    99 
    100     if (!numberOfGCMarkers) {
    101         int cpusToUse = 1;
     132    SET(maximumOptimizationCandidateInstructionCount, 1000);
     133   
     134    SET(maximumFunctionForCallInlineCandidateInstructionCount, 150);
     135    SET(maximumFunctionForConstructInlineCandidateInstructionCount, 80);
     136   
     137    SET(maximumInliningDepth, 5);
     138
     139    SET(executionCounterValueForOptimizeAfterWarmUp,     -1000);
     140    SET(executionCounterValueForOptimizeAfterLongWarmUp, -5000);
     141    SET(executionCounterValueForDontOptimizeAnytimeSoon, std::numeric_limits<int32_t>::min());
     142    SET(executionCounterValueForOptimizeSoon,            -1000);
     143    SET(executionCounterValueForOptimizeNextInvocation,  0);
     144
     145    SET(executionCounterIncrementForLoop,   1);
     146    SET(executionCounterIncrementForReturn, 15);
     147
     148    SET(desiredSpeculativeSuccessFailRatio, 6);
     149   
     150    SET(likelyToTakeSlowCaseThreshold,    0.15);
     151    SET(couldTakeSlowCaseThreshold,       0.05); // Shouldn't be zero because some ops will spuriously take slow case, for example for linking or caching.
     152    SET(likelyToTakeSlowCaseMinimumCount, 100);
     153    SET(couldTakeSlowCaseMinimumCount,    10);
     154   
     155    SET(osrExitProminenceForFrequentExitSite, 0.3);
     156
     157    SET(largeFailCountThresholdBase,        20);
     158    SET(largeFailCountThresholdBaseForLoop, 1);
     159
     160    SET(reoptimizationRetryCounterStep, 1);
     161
     162    SET(minimumOptimizationDelay,   1);
     163    SET(maximumOptimizationDelay,   5);
     164    SET(desiredProfileLivenessRate, 0.75);
     165    SET(desiredProfileFullnessRate, 0.35);
     166   
     167    SET(doubleVoteRatioForDoubleFormat, 2);
     168   
     169    SET(minimumNumberOfScansBetweenRebalance, 10000);
     170    SET(gcMarkStackSegmentSize,               pageSize());
     171    SET(minimumNumberOfCellsToKeep,           10);
     172    SET(maximumNumberOfSharedSegments,        3);
     173    SET(sharedStackWakeupThreshold,           1);
     174    SET(opaqueRootMergeThreshold,             1000);
     175
     176    int cpusToUse = 1;
    102177#if OS(DARWIN) && ENABLE(PARALLEL_GC)
    103         int name[2];
    104         size_t valueSize = sizeof(cpusToUse);
    105         name[0] = CTL_HW;
    106         name[1] = HW_AVAILCPU;
    107         sysctl(name, 2, &cpusToUse, &valueSize, 0, 0);
    108 #endif
    109         // We don't scale so well beyond 4.
    110         if (cpusToUse > 4)
    111             cpusToUse = 4;
    112         // Be paranoid, it is the OS we're dealing with, after all.
    113         if (cpusToUse < 1)
    114             cpusToUse = 1;
    115 
    116         numberOfGCMarkers = cpusToUse;
    117     }
    118    
     178    int name[2];
     179    size_t valueSize = sizeof(cpusToUse);
     180    name[0] = CTL_HW;
     181    name[1] = HW_AVAILCPU;
     182    sysctl(name, 2, &cpusToUse, &valueSize, 0, 0);
     183#endif
     184    // We don't scale so well beyond 4.
     185    if (cpusToUse > 4)
     186        cpusToUse = 4;
     187    // Be paranoid, it is the OS we're dealing with, after all.
     188    if (cpusToUse < 1)
     189        cpusToUse = 1;
     190   
     191    SET(numberOfGCMarkers, cpusToUse);
     192
    119193    ASSERT(executionCounterValueForDontOptimizeAnytimeSoon <= executionCounterValueForOptimizeAfterLongWarmUp);
    120194    ASSERT(executionCounterValueForOptimizeAfterLongWarmUp <= executionCounterValueForOptimizeAfterWarmUp);
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r102978 r103286  
    3131namespace JSC { namespace Options {
    3232
    33 // maximumInliningDepth is the maximum depth of inline stack, so 1 = no
    34 // inlining, 2 = one level, etc
     33extern unsigned maximumOptimizationCandidateInstructionCount;
    3534
    36 // couldTakeSlowCaseThreshold shouldn't be zero because some ops will spuriously
    37 // take slow case, for example for linking or caching.
     35extern unsigned maximumFunctionForCallInlineCandidateInstructionCount;
     36extern unsigned maximumFunctionForConstructInlineCandidateInstructionCount;
    3837
    39 #define FOR_EACH_HEURISTIC(m) \
    40     m(unsigned, maximumOptimizationCandidateInstructionCount, 1000) \
    41     \
    42     m(unsigned, maximumFunctionForCallInlineCandidateInstructionCount, 150) \
    43     m(unsigned, maximumFunctionForConstructInlineCandidateInstructionCount, 80) \
    44     \
    45     m(unsigned, maximumInliningDepth, 5)                              \
    46     \
    47     m(int32_t, executionCounterValueForOptimizeAfterWarmUp,      -1000) \
    48     m(int32_t, executionCounterValueForOptimizeAfterLongWarmUp,  -5000) \
    49     m(int32_t, executionCounterValueForDontOptimizeAnytimeSoon,  std::numeric_limits<int32_t>::min()) \
    50     m(int32_t, executionCounterValueForOptimizeSoon,             -1000) \
    51     m(int32_t, executionCounterValueForOptimizeNextInvocation,   0) \
    52     \
    53     m(int32_t, executionCounterIncrementForLoop,       1) \
    54     m(int32_t, executionCounterIncrementForReturn,     15) \
    55     \
    56     m(unsigned, desiredSpeculativeSuccessFailRatio,    6) \
    57     \
    58     m(double,   likelyToTakeSlowCaseThreshold,         0.15) \
    59     m(double,   couldTakeSlowCaseThreshold,            0.05) \
    60     m(unsigned, likelyToTakeSlowCaseMinimumCount,      100) \
    61     m(unsigned, couldTakeSlowCaseMinimumCount,         10) \
    62     \
    63     m(double,   osrExitProminenceForFrequentExitSite,  0.3) \
    64     \
    65     m(unsigned, largeFailCountThresholdBase,           20) \
    66     m(unsigned, largeFailCountThresholdBaseForLoop,    1) \
    67     \
    68     m(unsigned, reoptimizationRetryCounterMax,         0) \
    69     m(unsigned, reoptimizationRetryCounterStep,        1) \
    70     \
    71     m(unsigned, minimumOptimizationDelay,              1) \
    72     m(unsigned, maximumOptimizationDelay,              5) \
    73     m(double, desiredProfileLivenessRate,              0.75) \
    74     m(double, desiredProfileFullnessRate,              0.35) \
    75     \
    76     m(double,   doubleVoteRatioForDoubleFormat,        2) \
    77     \
    78     m(unsigned, minimumNumberOfScansBetweenRebalance,  10000) \
    79     m(unsigned, gcMarkStackSegmentSize,                0) \
    80     m(unsigned, minimumNumberOfCellsToKeep,            10) \
    81     m(unsigned, maximumNumberOfSharedSegments,         3) \
    82     m(unsigned, sharedStackWakeupThreshold,            1) \
    83     m(unsigned, numberOfGCMarkers,                     0) \
    84     m(unsigned, opaqueRootMergeThreshold,              1000)
     38extern unsigned maximumInliningDepth; // Depth of inline stack, so 1 = no inlining, 2 = one level, etc.
    8539
    86 #define FOR_EACH_OPTION(m) \
    87     FOR_EACH_HEURISTIC(m)
     40extern int32_t executionCounterValueForOptimizeAfterWarmUp;
     41extern int32_t executionCounterValueForOptimizeAfterLongWarmUp;
     42extern int32_t executionCounterValueForDontOptimizeAnytimeSoon;
     43extern int32_t executionCounterValueForOptimizeSoon;
     44extern int32_t executionCounterValueForOptimizeNextInvocation;
    8845
    89 #define DECLARE(type, cname, default_val) extern type cname;
    90 FOR_EACH_OPTION(DECLARE)
    91 #undef DECLARE
     46extern int32_t executionCounterIncrementForLoop;
     47extern int32_t executionCounterIncrementForReturn;
     48
     49extern unsigned desiredSpeculativeSuccessFailRatio;
     50
     51extern double likelyToTakeSlowCaseThreshold;
     52extern double couldTakeSlowCaseThreshold;
     53extern unsigned likelyToTakeSlowCaseMinimumCount;
     54extern unsigned couldTakeSlowCaseMinimumCount;
     55
     56extern double osrExitProminenceForFrequentExitSite;
     57
     58extern unsigned largeFailCountThresholdBase;
     59extern unsigned largeFailCountThresholdBaseForLoop;
     60
     61extern unsigned reoptimizationRetryCounterMax;
     62extern unsigned reoptimizationRetryCounterStep;
     63
     64extern unsigned minimumOptimizationDelay;
     65extern unsigned maximumOptimizationDelay;
     66extern double desiredProfileLivenessRate;
     67extern double desiredProfileFullnessRate;
     68
     69extern double doubleVoteRatioForDoubleFormat;
     70
     71extern unsigned minimumNumberOfScansBetweenRebalance;
     72extern unsigned gcMarkStackSegmentSize;
     73extern unsigned minimumNumberOfCellsToKeep;
     74extern unsigned maximumNumberOfSharedSegments;
     75extern unsigned sharedStackWakeupThreshold;
     76extern unsigned numberOfGCMarkers;
     77extern unsigned opaqueRootMergeThreshold;
    9278
    9379void initializeOptions();
Note: See TracChangeset for help on using the changeset viewer.