Changeset 200136 in webkit


Ignore:
Timestamp:
Apr 27, 2016 11:36:17 AM (8 years ago)
Author:
mark.lam@apple.com
Message:

Restrict the availability of some JSC options to local debug builds only.
https://bugs.webkit.org/show_bug.cgi?id=157058

Reviewed by Geoffrey Garen.

  1. Each option will be given an availability flag.
  2. The functionOverrides and useDollarVM (along with its alias, enableDollarVM) will have "Restricted" availability.
  3. All other options will have “Normal” availability.
  4. Any options with "Restricted" availability will only be accessible if function allowRestrictedOptions() returns true.
  5. For now, allowRestrictedOptions() always returns false for release builds, and true for debug builds.

If an option is "Restricted" and restricted options are not allowed, the VM will
behave semantically as if that option does not exist at all:

  1. Option dumps will not show the option.
  2. Attempts to set the option will fail as if the option does not exist.

Behind the scene, the option does exist, and is set to its default value
(whatever that may be) once and only once on options initialization.

  • runtime/Options.cpp:

(JSC::allowRestrictedOptions):
(JSC::parse):
(JSC::overrideOptionWithHeuristic):
(JSC::Options::initialize):
(JSC::Options::setOptionWithoutAlias):
(JSC::Options::dumpOption):

  • runtime/Options.h:

(JSC::Option::type):
(JSC::Option::availability):
(JSC::Option::isOverridden):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r200134 r200136  
     12016-04-27  Mark Lam  <mark.lam@apple.com>
     2
     3        Restrict the availability of some JSC options to local debug builds only.
     4        https://bugs.webkit.org/show_bug.cgi?id=157058
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        1. Each option will be given an availability flag.
     9        2. The functionOverrides and useDollarVM (along with its alias, enableDollarVM)
     10           will have "Restricted" availability.
     11        3. All other options will have “Normal” availability.
     12        4. Any options with "Restricted" availability will only be accessible if function
     13           allowRestrictedOptions() returns true.
     14        5. For now, allowRestrictedOptions() always returns false for release builds, and
     15           true for debug builds.
     16
     17        If an option is "Restricted" and restricted options are not allowed, the VM will
     18        behave semantically as if that option does not exist at all:
     19        1. Option dumps will not show the option.
     20        2. Attempts to set the option will fail as if the option does not exist.
     21
     22        Behind the scene, the option does exist, and is set to its default value
     23        (whatever that may be) once and only once on options initialization.
     24
     25        * runtime/Options.cpp:
     26        (JSC::allowRestrictedOptions):
     27        (JSC::parse):
     28        (JSC::overrideOptionWithHeuristic):
     29        (JSC::Options::initialize):
     30        (JSC::Options::setOptionWithoutAlias):
     31        (JSC::Options::dumpOption):
     32        * runtime/Options.h:
     33        (JSC::Option::type):
     34        (JSC::Option::availability):
     35        (JSC::Option::isOverridden):
     36
    1372016-04-27  Gavin Barraclough  <barraclough@apple.com>
    238
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r200134 r200136  
    5454namespace JSC {
    5555
     56static bool allowRestrictedOptions()
     57{
     58#ifdef NDEBUG
     59    return false;
     60#else
     61    return true;
     62#endif
     63}
     64
    5665static bool parse(const char* string, bool& value)
    5766{
     
    116125
    117126template<typename T>
    118 bool overrideOptionWithHeuristic(T& variable, const char* name)
    119 {
     127bool overrideOptionWithHeuristic(T& variable, const char* name, Options::Availability availability)
     128{
     129    bool isAvailable = (availability != Options::Availability::Restricted) || allowRestrictedOptions();
     130
    120131    const char* stringValue = getenv(name);
    121132    if (!stringValue)
    122133        return false;
    123134   
    124     if (parse(stringValue, variable))
     135    if (isAvailable && parse(stringValue, variable))
    125136        return true;
    126137   
     
    233244// Realize the names for each of the options:
    234245const Options::EntryInfo Options::s_optionsInfo[Options::numberOfOptions] = {
    235 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \
    236     { #name_, description_, Options::Type::type_##Type },
     246#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
     247    { #name_, description_, Options::Type::type_##Type, Availability::availability_ },
    237248    JSC_OPTIONS(FOR_EACH_OPTION)
    238249#undef FOR_EACH_OPTION
     
    363374        [] {
    364375            // Initialize each of the options with their default values:
    365 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_)      \
     376#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
    366377            name_() = defaultValue_;                                    \
    367378            name_##Default() = defaultValue_;
     
    386397                CRASH();
    387398#else // PLATFORM(COCOA)
    388 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_)      \
    389             overrideOptionWithHeuristic(name_(), "JSC_" #name_);
     399#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
     400            overrideOptionWithHeuristic(name_(), "JSC_" #name_, Availability::availability_);
    390401            JSC_OPTIONS(FOR_EACH_OPTION)
    391402#undef FOR_EACH_OPTION
     
    551562    // For each option, check if the specify arg is a match. If so, set the arg
    552563    // if the value makes sense. Otherwise, move on to checking the next option.
    553 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \
     564#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
    554565    if (strlen(#name_) == static_cast<size_t>(equalStr - arg)      \
    555566        && !strncmp(arg, #name_, equalStr - arg)) {                \
     567        if (Availability::availability_ == Availability::Restricted && !allowRestrictedOptions()) \
     568            return false;                                          \
    556569        type_ value;                                               \
    557570        value = (defaultValue_);                                   \
     
    669682
    670683    Option option(id);
     684    if (option.availability() == Availability::Restricted && !allowRestrictedOptions())
     685        return;
     686
    671687    bool wasOverridden = option.isOverridden();
    672688    bool needsDescription = (level == DumpLevel::Verbose && option.description());
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r200092 r200136  
    103103
    104104#define JSC_OPTIONS(v) \
    105     v(bool, validateOptions, false, "crashes if mis-typed JSC options were passed to the VM") \
    106     v(unsigned, dumpOptions, 0, "dumps JSC options (0 = None, 1 = Overridden only, 2 = All, 3 = Verbose)") \
    107     \
    108     v(bool, useLLInt,  true, "allows the LLINT to be used if true") \
    109     v(bool, useJIT,    true, "allows the baseline JIT to be used if true") \
    110     v(bool, useDFGJIT, true, "allows the DFG JIT to be used if true") \
    111     v(bool, useRegExpJIT, true, "allows the RegExp JIT to be used if true") \
    112     \
    113     v(bool, reportMustSucceedExecutableAllocations, false, nullptr) \
    114     \
    115     v(unsigned, maxPerThreadStackUsage, 4 * MB, nullptr) \
    116     v(unsigned, reservedZoneSize, 128 * KB, nullptr) \
    117     v(unsigned, errorModeReservedZoneSize, 64 * KB, nullptr) \
    118     \
    119     v(bool, crashIfCantAllocateJITMemory, false, nullptr) \
    120     v(unsigned, jitMemoryReservationSize, 0, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
    121     v(bool, useSeparatedWXHeap, false, nullptr) \
    122     \
    123     v(bool, forceCodeBlockLiveness, false, nullptr) \
    124     v(bool, forceICFailure, false, nullptr) \
    125     \
    126     v(unsigned, repatchCountForCoolDown, 10, nullptr) \
    127     v(unsigned, initialCoolDownCount, 20, nullptr) \
    128     v(unsigned, repatchBufferingCountdown, 10, nullptr) \
    129     \
    130     v(bool, dumpGeneratedBytecodes, false, nullptr) \
    131     v(bool, dumpBytecodeLivenessResults, false, nullptr) \
    132     v(bool, validateBytecode, false, nullptr) \
    133     v(bool, forceDebuggerBytecodeGeneration, false, nullptr) \
    134     v(bool, forceProfilerBytecodeGeneration, false, nullptr) \
    135     \
    136     v(bool, useFunctionDotArguments, true, nullptr) \
    137     v(bool, useTailCalls, true, nullptr) \
    138     v(bool, alwaysUseShadowChicken, false, nullptr) \
    139     v(unsigned, shadowChickenLogSize, 1000, nullptr) \
    140     v(unsigned, shadowChickenStackSizeLimit, 100000, nullptr) \
     105    v(bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \
     106    v(unsigned, dumpOptions, 0, Normal, "dumps JSC options (0 = None, 1 = Overridden only, 2 = All, 3 = Verbose)") \
     107    \
     108    v(bool, useLLInt,  true, Normal, "allows the LLINT to be used if true") \
     109    v(bool, useJIT,    true, Normal, "allows the baseline JIT to be used if true") \
     110    v(bool, useDFGJIT, true, Normal, "allows the DFG JIT to be used if true") \
     111    v(bool, useRegExpJIT, true, Normal, "allows the RegExp JIT to be used if true") \
     112    \
     113    v(bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
     114    \
     115    v(unsigned, maxPerThreadStackUsage, 4 * MB, Normal, nullptr) \
     116    v(unsigned, reservedZoneSize, 128 * KB, Normal, nullptr) \
     117    v(unsigned, errorModeReservedZoneSize, 64 * KB, Normal, nullptr) \
     118    \
     119    v(bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
     120    v(unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
     121    v(bool, useSeparatedWXHeap, false, Normal, nullptr) \
     122    \
     123    v(bool, forceCodeBlockLiveness, false, Normal, nullptr) \
     124    v(bool, forceICFailure, false, Normal, nullptr) \
     125    \
     126    v(unsigned, repatchCountForCoolDown, 10, Normal, nullptr) \
     127    v(unsigned, initialCoolDownCount, 20, Normal, nullptr) \
     128    v(unsigned, repatchBufferingCountdown, 10, Normal, nullptr) \
     129    \
     130    v(bool, dumpGeneratedBytecodes, false, Normal, nullptr) \
     131    v(bool, dumpBytecodeLivenessResults, false, Normal, nullptr) \
     132    v(bool, validateBytecode, false, Normal, nullptr) \
     133    v(bool, forceDebuggerBytecodeGeneration, false, Normal, nullptr) \
     134    v(bool, forceProfilerBytecodeGeneration, false, Normal, nullptr) \
     135    \
     136    v(bool, useFunctionDotArguments, true, Normal, nullptr) \
     137    v(bool, useTailCalls, true, Normal, nullptr) \
     138    v(bool, alwaysUseShadowChicken, false, Normal, nullptr) \
     139    v(unsigned, shadowChickenLogSize, 1000, Normal, nullptr) \
     140    v(unsigned, shadowChickenStackSizeLimit, 100000, Normal, nullptr) \
    141141    \
    142142    /* dumpDisassembly implies dumpDFGDisassembly. */ \
    143     v(bool, dumpDisassembly, false, "dumps disassembly of all JIT compiled code upon compilation") \
    144     v(bool, asyncDisassembly, false, nullptr) \
    145     v(bool, dumpDFGDisassembly, false, "dumps disassembly of DFG function upon compilation") \
    146     v(bool, dumpFTLDisassembly, false, "dumps disassembly of FTL function upon compilation") \
    147     v(bool, dumpAllDFGNodes, false, nullptr) \
    148     v(optionRange, bytecodeRangeToDFGCompile, 0, "bytecode size range to allow DFG compilation on, e.g. 1:100") \
    149     v(optionRange, bytecodeRangeToFTLCompile, 0, "bytecode size range to allow FTL compilation on, e.g. 1:100") \
    150     v(optionString, dfgWhitelist, nullptr, "file with list of function signatures to allow DFG compilation on") \
    151     v(bool, dumpSourceAtDFGTime, false, "dumps source code of JS function being DFG compiled") \
    152     v(bool, dumpBytecodeAtDFGTime, false, "dumps bytecode of JS function being DFG compiled") \
    153     v(bool, dumpGraphAfterParsing, false, nullptr) \
    154     v(bool, dumpGraphAtEachPhase, false, nullptr) \
    155     v(bool, dumpDFGGraphAtEachPhase, false, "dumps the DFG graph at each phase DFG of complitaion (note this excludes DFG graphs during FTL compilation)") \
    156     v(bool, dumpDFGFTLGraphAtEachPhase, false, "dumps the DFG graph at each phase DFG of complitaion when compiling FTL code") \
    157     v(bool, dumpB3GraphAtEachPhase, false, "dumps the B3 graph at each phase of compilation") \
    158     v(bool, dumpAirGraphAtEachPhase, false, "dumps the Air graph at each phase of compilation") \
    159     v(bool, verboseDFGByteCodeParsing, false, nullptr) \
    160     v(bool, verboseCompilation, false, nullptr) \
    161     v(bool, verboseFTLCompilation, false, nullptr) \
    162     v(bool, logCompilationChanges, false, nullptr) \
    163     v(bool, printEachOSRExit, false, nullptr) \
    164     v(bool, validateGraph, false, nullptr) \
    165     v(bool, validateGraphAtEachPhase, false, nullptr) \
    166     v(bool, verboseValidationFailure, false, nullptr) \
    167     v(bool, verboseOSR, false, nullptr) \
    168     v(bool, verboseFTLOSRExit, false, nullptr) \
    169     v(bool, verboseCallLink, false, nullptr) \
    170     v(bool, verboseCompilationQueue, false, nullptr) \
    171     v(bool, reportCompileTimes, false, "dumps JS function signature and the time it took to compile") \
    172     v(bool, reportFTLCompileTimes, false, "dumps JS function signature and the time it took to FTL compile") \
    173     v(bool, reportTotalCompileTimes, false, nullptr) \
    174     v(bool, verboseCFA, false, nullptr) \
    175     v(bool, verboseFTLToJSThunk, false, nullptr) \
    176     v(bool, verboseFTLFailure, false, nullptr) \
    177     v(bool, alwaysComputeHash, false, nullptr) \
    178     v(bool, testTheFTL, false, nullptr) \
    179     v(bool, verboseSanitizeStack, false, nullptr) \
    180     v(bool, useGenerationalGC, true, nullptr) \
    181     v(bool, eagerlyUpdateTopCallFrame, false, nullptr) \
    182     \
    183     v(bool, useOSREntryToDFG, true, nullptr) \
    184     v(bool, useOSREntryToFTL, true, nullptr) \
    185     \
    186     v(bool, useFTLJIT, true, "allows the FTL JIT to be used if true") \
    187     v(bool, useFTLTBAA, true, nullptr) \
    188     v(bool, validateFTLOSRExitLiveness, false, nullptr) \
    189     v(bool, b3AlwaysFailsBeforeCompile, false, nullptr) \
    190     v(bool, b3AlwaysFailsBeforeLink, false, nullptr) \
    191     v(bool, ftlCrashes, false, nullptr) /* fool-proof way of checking that you ended up in the FTL. ;-) */\
    192     v(bool, clobberAllRegsInFTLICSlowPath, !ASSERT_DISABLED, nullptr) \
    193     v(bool, useAccessInlining, true, nullptr) \
    194     v(unsigned, maxAccessVariantListSize, 13, nullptr) \
    195     v(unsigned, megamorphicLoadCost, 999, nullptr) /* This used to be 10, but we're temporarily testing what happens when the feature is disabled. */\
    196     v(bool, usePolyvariantDevirtualization, true, nullptr) \
    197     v(bool, usePolymorphicAccessInlining, true, nullptr) \
    198     v(bool, usePolymorphicCallInlining, true, nullptr) \
    199     v(bool, usePolymorphicCallInliningForNonStubStatus, false, nullptr) \
    200     v(unsigned, maxPolymorphicCallVariantListSize, 15, nullptr) \
    201     v(unsigned, maxPolymorphicCallVariantListSizeForTopTier, 5, nullptr) \
    202     v(unsigned, maxPolymorphicCallVariantsForInlining, 5, nullptr) \
    203     v(unsigned, frequentCallThreshold, 2, nullptr) \
    204     v(double, minimumCallToKnownRate, 0.51, nullptr) \
    205     v(bool, createPreHeaders, true, nullptr) \
    206     v(bool, useMovHintRemoval, true, nullptr) \
    207     v(bool, usePutStackSinking, true, nullptr) \
    208     v(bool, useObjectAllocationSinking, true, nullptr) \
    209     \
    210     v(bool, useConcurrentJIT, true, "allows the DFG / FTL compilation in threads other than the executing JS thread") \
    211     v(unsigned, numberOfDFGCompilerThreads, computeNumberOfWorkerThreads(2, 2) - 1, nullptr) \
    212     v(unsigned, numberOfFTLCompilerThreads, computeNumberOfWorkerThreads(8, 2) - 1, nullptr) \
    213     v(int32, priorityDeltaOfDFGCompilerThreads, computePriorityDeltaOfWorkerThreads(-1, 0), nullptr) \
    214     v(int32, priorityDeltaOfFTLCompilerThreads, computePriorityDeltaOfWorkerThreads(-2, 0), nullptr) \
    215     \
    216     v(bool, useProfiler, false, nullptr) \
    217     v(bool, disassembleBaselineForProfiler, true, nullptr) \
    218     \
    219     v(bool, useArchitectureSpecificOptimizations, true, nullptr) \
    220     \
    221     v(bool, breakOnThrow, false, nullptr) \
    222     \
    223     v(unsigned, maximumOptimizationCandidateInstructionCount, 100000, nullptr) \
    224     \
    225     v(unsigned, maximumFunctionForCallInlineCandidateInstructionCount, 180, nullptr) \
    226     v(unsigned, maximumFunctionForClosureCallInlineCandidateInstructionCount, 100, nullptr) \
    227     v(unsigned, maximumFunctionForConstructInlineCandidateInstructionCount, 100, nullptr) \
    228     \
    229     v(unsigned, maximumFTLCandidateInstructionCount, 20000, nullptr) \
     143    v(bool, dumpDisassembly, false, Normal, "dumps disassembly of all JIT compiled code upon compilation") \
     144    v(bool, asyncDisassembly, false, Normal, nullptr) \
     145    v(bool, dumpDFGDisassembly, false, Normal, "dumps disassembly of DFG function upon compilation") \
     146    v(bool, dumpFTLDisassembly, false, Normal, "dumps disassembly of FTL function upon compilation") \
     147    v(bool, dumpAllDFGNodes, false, Normal, nullptr) \
     148    v(optionRange, bytecodeRangeToDFGCompile, 0, Normal, "bytecode size range to allow DFG compilation on, e.g. 1:100") \
     149    v(optionRange, bytecodeRangeToFTLCompile, 0, Normal, "bytecode size range to allow FTL compilation on, e.g. 1:100") \
     150    v(optionString, dfgWhitelist, nullptr, Normal, "file with list of function signatures to allow DFG compilation on") \
     151    v(bool, dumpSourceAtDFGTime, false, Normal, "dumps source code of JS function being DFG compiled") \
     152    v(bool, dumpBytecodeAtDFGTime, false, Normal, "dumps bytecode of JS function being DFG compiled") \
     153    v(bool, dumpGraphAfterParsing, false, Normal, nullptr) \
     154    v(bool, dumpGraphAtEachPhase, false, Normal, nullptr) \
     155    v(bool, dumpDFGGraphAtEachPhase, false, Normal, "dumps the DFG graph at each phase DFG of complitaion (note this excludes DFG graphs during FTL compilation)") \
     156    v(bool, dumpDFGFTLGraphAtEachPhase, false, Normal, "dumps the DFG graph at each phase DFG of complitaion when compiling FTL code") \
     157    v(bool, dumpB3GraphAtEachPhase, false, Normal, "dumps the B3 graph at each phase of compilation") \
     158    v(bool, dumpAirGraphAtEachPhase, false, Normal, "dumps the Air graph at each phase of compilation") \
     159    v(bool, verboseDFGByteCodeParsing, false, Normal, nullptr) \
     160    v(bool, verboseCompilation, false, Normal, nullptr) \
     161    v(bool, verboseFTLCompilation, false, Normal, nullptr) \
     162    v(bool, logCompilationChanges, false, Normal, nullptr) \
     163    v(bool, printEachOSRExit, false, Normal, nullptr) \
     164    v(bool, validateGraph, false, Normal, nullptr) \
     165    v(bool, validateGraphAtEachPhase, false, Normal, nullptr) \
     166    v(bool, verboseValidationFailure, false, Normal, nullptr) \
     167    v(bool, verboseOSR, false, Normal, nullptr) \
     168    v(bool, verboseFTLOSRExit, false, Normal, nullptr) \
     169    v(bool, verboseCallLink, false, Normal, nullptr) \
     170    v(bool, verboseCompilationQueue, false, Normal, nullptr) \
     171    v(bool, reportCompileTimes, false, Normal, "dumps JS function signature and the time it took to compile") \
     172    v(bool, reportFTLCompileTimes, false, Normal, "dumps JS function signature and the time it took to FTL compile") \
     173    v(bool, reportTotalCompileTimes, false, Normal, nullptr) \
     174    v(bool, verboseCFA, false, Normal, nullptr) \
     175    v(bool, verboseFTLToJSThunk, false, Normal, nullptr) \
     176    v(bool, verboseFTLFailure, false, Normal, nullptr) \
     177    v(bool, alwaysComputeHash, false, Normal, nullptr) \
     178    v(bool, testTheFTL, false, Normal, nullptr) \
     179    v(bool, verboseSanitizeStack, false, Normal, nullptr) \
     180    v(bool, useGenerationalGC, true, Normal, nullptr) \
     181    v(bool, eagerlyUpdateTopCallFrame, false, Normal, nullptr) \
     182    \
     183    v(bool, useOSREntryToDFG, true, Normal, nullptr) \
     184    v(bool, useOSREntryToFTL, true, Normal, nullptr) \
     185    \
     186    v(bool, useFTLJIT, true, Normal, "allows the FTL JIT to be used if true") \
     187    v(bool, useFTLTBAA, true, Normal, nullptr) \
     188    v(bool, validateFTLOSRExitLiveness, false, Normal, nullptr) \
     189    v(bool, b3AlwaysFailsBeforeCompile, false, Normal, nullptr) \
     190    v(bool, b3AlwaysFailsBeforeLink, false, Normal, nullptr) \
     191    v(bool, ftlCrashes, false, Normal, nullptr) /* fool-proof way of checking that you ended up in the FTL. ;-) */\
     192    v(bool, clobberAllRegsInFTLICSlowPath, !ASSERT_DISABLED, Normal, nullptr) \
     193    v(bool, useAccessInlining, true, Normal, nullptr) \
     194    v(unsigned, maxAccessVariantListSize, 13, Normal, nullptr) \
     195    v(unsigned, megamorphicLoadCost, 999, Normal, nullptr) /* This used to be 10, but we're temporarily testing what happens when the feature is disabled. */\
     196    v(bool, usePolyvariantDevirtualization, true, Normal, nullptr) \
     197    v(bool, usePolymorphicAccessInlining, true, Normal, nullptr) \
     198    v(bool, usePolymorphicCallInlining, true, Normal, nullptr) \
     199    v(bool, usePolymorphicCallInliningForNonStubStatus, false, Normal, nullptr) \
     200    v(unsigned, maxPolymorphicCallVariantListSize, 15, Normal, nullptr) \
     201    v(unsigned, maxPolymorphicCallVariantListSizeForTopTier, 5, Normal, nullptr) \
     202    v(unsigned, maxPolymorphicCallVariantsForInlining, 5, Normal, nullptr) \
     203    v(unsigned, frequentCallThreshold, 2, Normal, nullptr) \
     204    v(double, minimumCallToKnownRate, 0.51, Normal, nullptr) \
     205    v(bool, createPreHeaders, true, Normal, nullptr) \
     206    v(bool, useMovHintRemoval, true, Normal, nullptr) \
     207    v(bool, usePutStackSinking, true, Normal, nullptr) \
     208    v(bool, useObjectAllocationSinking, true, Normal, nullptr) \
     209    \
     210    v(bool, useConcurrentJIT, true, Normal, "allows the DFG / FTL compilation in threads other than the executing JS thread") \
     211    v(unsigned, numberOfDFGCompilerThreads, computeNumberOfWorkerThreads(2, 2) - 1, Normal, nullptr) \
     212    v(unsigned, numberOfFTLCompilerThreads, computeNumberOfWorkerThreads(8, 2) - 1, Normal, nullptr) \
     213    v(int32, priorityDeltaOfDFGCompilerThreads, computePriorityDeltaOfWorkerThreads(-1, 0), Normal, nullptr) \
     214    v(int32, priorityDeltaOfFTLCompilerThreads, computePriorityDeltaOfWorkerThreads(-2, 0), Normal, nullptr) \
     215    \
     216    v(bool, useProfiler, false, Normal, nullptr) \
     217    v(bool, disassembleBaselineForProfiler, true, Normal, nullptr) \
     218    \
     219    v(bool, useArchitectureSpecificOptimizations, true, Normal, nullptr) \
     220    \
     221    v(bool, breakOnThrow, false, Normal, nullptr) \
     222    \
     223    v(unsigned, maximumOptimizationCandidateInstructionCount, 100000, Normal, nullptr) \
     224    \
     225    v(unsigned, maximumFunctionForCallInlineCandidateInstructionCount, 180, Normal, nullptr) \
     226    v(unsigned, maximumFunctionForClosureCallInlineCandidateInstructionCount, 100, Normal, nullptr) \
     227    v(unsigned, maximumFunctionForConstructInlineCandidateInstructionCount, 100, Normal, nullptr) \
     228    \
     229    v(unsigned, maximumFTLCandidateInstructionCount, 20000, Normal, nullptr) \
    230230    \
    231231    /* Depth of inline stack, so 1 = no inlining, 2 = one level, etc. */ \
    232     v(unsigned, maximumInliningDepth, 5, "maximum allowed inlining depth.  Depth of 1 means no inlining") \
    233     v(unsigned, maximumInliningRecursion, 2, nullptr) \
     232    v(unsigned, maximumInliningDepth, 5, Normal, "maximum allowed inlining depth.  Depth of 1 means no inlining") \
     233    v(unsigned, maximumInliningRecursion, 2, Normal, nullptr) \
    234234    \
    235235    /* Maximum size of a caller for enabling inlining. This is purely to protect us */\
    236236    /* from super long compiles that take a lot of memory. */\
    237     v(unsigned, maximumInliningCallerSize, 10000, nullptr) \
    238     \
    239     v(unsigned, maximumVarargsForInlining, 100, nullptr) \
    240     \
    241     v(bool, usePolyvariantCallInlining, true, nullptr) \
    242     v(bool, usePolyvariantByIdInlining, true, nullptr) \
    243     \
    244     v(bool, useMaximalFlushInsertionPhase, false, "Setting to true allows the DFG's MaximalFlushInsertionPhase to run.") \
    245     \
    246     v(unsigned, maximumBinaryStringSwitchCaseLength, 50, nullptr) \
    247     v(unsigned, maximumBinaryStringSwitchTotalLength, 2000, nullptr) \
    248     \
    249     v(double, jitPolicyScale, 1.0, "scale JIT thresholds to this specified ratio between 0.0 (compile ASAP) and 1.0 (compile like normal).") \
    250     v(bool, forceEagerCompilation, false, nullptr) \
    251     v(int32, thresholdForJITAfterWarmUp, 500, nullptr) \
    252     v(int32, thresholdForJITSoon, 100, nullptr) \
    253     \
    254     v(int32, thresholdForOptimizeAfterWarmUp, 1000, nullptr) \
    255     v(int32, thresholdForOptimizeAfterLongWarmUp, 1000, nullptr) \
    256     v(int32, thresholdForOptimizeSoon, 1000, nullptr) \
    257     v(int32, executionCounterIncrementForLoop, 1, nullptr) \
    258     v(int32, executionCounterIncrementForEntry, 15, nullptr) \
    259     \
    260     v(int32, thresholdForFTLOptimizeAfterWarmUp, 100000, nullptr) \
    261     v(int32, thresholdForFTLOptimizeSoon, 1000, nullptr) \
    262     v(int32, ftlTierUpCounterIncrementForLoop, 1, nullptr) \
    263     v(int32, ftlTierUpCounterIncrementForReturn, 15, nullptr) \
    264     v(unsigned, ftlOSREntryFailureCountForReoptimization, 15, nullptr) \
    265     v(unsigned, ftlOSREntryRetryThreshold, 100, nullptr) \
    266     \
    267     v(int32, evalThresholdMultiplier, 10, nullptr) \
    268     v(unsigned, maximumEvalCacheableSourceLength, 256, nullptr) \
    269     \
    270     v(bool, randomizeExecutionCountsBetweenCheckpoints, false, nullptr) \
    271     v(int32, maximumExecutionCountsBetweenCheckpointsForBaseline, 1000, nullptr) \
    272     v(int32, maximumExecutionCountsBetweenCheckpointsForUpperTiers, 50000, nullptr) \
    273     \
    274     v(unsigned, likelyToTakeSlowCaseMinimumCount, 20, nullptr) \
    275     v(unsigned, couldTakeSlowCaseMinimumCount, 10, nullptr) \
    276     \
    277     v(unsigned, osrExitCountForReoptimization, 100, nullptr) \
    278     v(unsigned, osrExitCountForReoptimizationFromLoop, 5, nullptr) \
    279     \
    280     v(unsigned, reoptimizationRetryCounterMax, 0, nullptr)  \
    281     \
    282     v(unsigned, minimumOptimizationDelay, 1, nullptr) \
    283     v(unsigned, maximumOptimizationDelay, 5, nullptr) \
    284     v(double, desiredProfileLivenessRate, 0.75, nullptr) \
    285     v(double, desiredProfileFullnessRate, 0.35, nullptr) \
    286     \
    287     v(double, doubleVoteRatioForDoubleFormat, 2, nullptr) \
    288     v(double, structureCheckVoteRatioForHoisting, 1, nullptr) \
    289     v(double, checkArrayVoteRatioForHoisting, 1, nullptr) \
    290     \
    291     v(unsigned, minimumNumberOfScansBetweenRebalance, 100, nullptr) \
    292     v(unsigned, numberOfGCMarkers, computeNumberOfGCMarkers(7), nullptr) \
    293     v(unsigned, opaqueRootMergeThreshold, 1000, nullptr) \
    294     v(double, minHeapUtilization, 0.8, nullptr) \
    295     v(double, minCopiedBlockUtilization, 0.9, nullptr) \
    296     v(double, minMarkedBlockUtilization, 0.9, nullptr) \
    297     v(unsigned, slowPathAllocsBetweenGCs, 0, "force a GC on every Nth slow path alloc, where N is specified by this option") \
    298     \
    299     v(double, percentCPUPerMBForFullTimer, 0.0003125, nullptr) \
    300     v(double, percentCPUPerMBForEdenTimer, 0.0025, nullptr) \
    301     v(double, collectionTimerMaxPercentCPU, 0.05, nullptr) \
    302     \
    303     v(bool, forceWeakRandomSeed, false, nullptr) \
    304     v(unsigned, forcedWeakRandomSeed, 0, nullptr) \
    305     \
    306     v(bool, useZombieMode, false, "debugging option to scribble over dead objects with 0xdeadbeef") \
    307     v(bool, useImmortalObjects, false, "debugging option to keep all objects alive forever") \
    308     v(bool, dumpObjectStatistics, false, nullptr) \
    309     \
    310     v(gcLogLevel, logGC, GCLogging::None, "debugging option to log GC activity (0 = None, 1 = Basic, 2 = Verbose)") \
    311     v(bool, useGC, true, nullptr) \
    312     v(bool, gcAtEnd, false, "If true, the jsc CLI will do a GC before exiting") \
    313     v(bool, forceGCSlowPaths, false, "If true, we will force all JIT fast allocations down their slow paths.")\
    314     v(unsigned, gcMaxHeapSize, 0, nullptr) \
    315     v(unsigned, forceRAMSize, 0, nullptr) \
    316     v(bool, recordGCPauseTimes, false, nullptr) \
    317     v(bool, logHeapStatisticsAtExit, false, nullptr) \
    318     \
    319     v(bool, useTypeProfiler, false, nullptr) \
    320     v(bool, useControlFlowProfiler, false, nullptr) \
    321     \
    322     v(bool, useSamplingProfiler, false, nullptr) \
    323     v(unsigned, sampleInterval, 1000, "Time between stack traces in microseconds.") \
    324     v(bool, collectSamplingProfilerDataForJSCShell, false, "This corresponds to the JSC shell's --sample option.") \
    325     \
    326     v(bool, alwaysGeneratePCToCodeOriginMap, false, "This will make sure we always generate a PCToCodeOriginMap for JITed code.") \
    327     \
    328     v(bool, verifyHeap, false, nullptr) \
    329     v(unsigned, numberOfGCCyclesToRecordForVerification, 3, nullptr) \
    330     \
    331     v(bool, useExceptionFuzz, false, nullptr) \
    332     v(unsigned, fireExceptionFuzzAt, 0, nullptr) \
    333     v(bool, validateDFGExceptionHandling, false, "Causes the DFG to emit code validating exception handling for each node that can exit") /* This is true by default on Debug builds */\
    334     \
    335     v(bool, useExecutableAllocationFuzz, false, nullptr) \
    336     v(unsigned, fireExecutableAllocationFuzzAt, 0, nullptr) \
    337     v(unsigned, fireExecutableAllocationFuzzAtOrAfter, 0, nullptr) \
    338     v(bool, verboseExecutableAllocationFuzz, false, nullptr) \
    339     \
    340     v(bool, useOSRExitFuzz, false, nullptr) \
    341     v(unsigned, fireOSRExitFuzzAtStatic, 0, nullptr) \
    342     v(unsigned, fireOSRExitFuzzAt, 0, nullptr) \
    343     v(unsigned, fireOSRExitFuzzAtOrAfter, 0, nullptr) \
    344     \
    345     v(bool, logB3PhaseTimes, false, nullptr) \
    346     v(double, rareBlockPenalty, 0.001, nullptr) \
    347     v(bool, airSpillsEverything, false, nullptr) \
    348     v(bool, logAirRegisterPressure, false, nullptr) \
    349     v(unsigned, maxB3TailDupBlockSize, 3, nullptr) \
    350     v(unsigned, maxB3TailDupBlockSuccessors, 3, nullptr) \
    351     \
    352     v(bool, useDollarVM, false, "installs the $vm debugging tool in global objects") \
    353     v(optionString, functionOverrides, nullptr, "file with debugging overrides for function bodies") \
    354     \
    355     v(unsigned, watchdog, 0, "watchdog timeout (0 = Disabled, N = a timeout period of N milliseconds)") \
    356     \
    357     v(bool, useICStats, false, nullptr) \
    358     \
    359     v(bool, dumpModuleRecord, false, nullptr) \
    360     v(bool, dumpModuleLoadingState, false, nullptr) \
    361     v(bool, exposeInternalModuleLoader, false, "expose the internal module loader object to the global space for debugging") \
    362     \
    363     v(bool, useSuperSampler, false, nullptr)
     237    v(unsigned, maximumInliningCallerSize, 10000, Normal, nullptr) \
     238    \
     239    v(unsigned, maximumVarargsForInlining, 100, Normal, nullptr) \
     240    \
     241    v(bool, usePolyvariantCallInlining, true, Normal, nullptr) \
     242    v(bool, usePolyvariantByIdInlining, true, Normal, nullptr) \
     243    \
     244    v(bool, useMaximalFlushInsertionPhase, false, Normal, "Setting to true allows the DFG's MaximalFlushInsertionPhase to run.") \
     245    \
     246    v(unsigned, maximumBinaryStringSwitchCaseLength, 50, Normal, nullptr) \
     247    v(unsigned, maximumBinaryStringSwitchTotalLength, 2000, Normal, nullptr) \
     248    \
     249    v(double, jitPolicyScale, 1.0, Normal, "scale JIT thresholds to this specified ratio between 0.0 (compile ASAP) and 1.0 (compile like normal).") \
     250    v(bool, forceEagerCompilation, false, Normal, nullptr) \
     251    v(int32, thresholdForJITAfterWarmUp, 500, Normal, nullptr) \
     252    v(int32, thresholdForJITSoon, 100, Normal, nullptr) \
     253    \
     254    v(int32, thresholdForOptimizeAfterWarmUp, 1000, Normal, nullptr) \
     255    v(int32, thresholdForOptimizeAfterLongWarmUp, 1000, Normal, nullptr) \
     256    v(int32, thresholdForOptimizeSoon, 1000, Normal, nullptr) \
     257    v(int32, executionCounterIncrementForLoop, 1, Normal, nullptr) \
     258    v(int32, executionCounterIncrementForEntry, 15, Normal, nullptr) \
     259    \
     260    v(int32, thresholdForFTLOptimizeAfterWarmUp, 100000, Normal, nullptr) \
     261    v(int32, thresholdForFTLOptimizeSoon, 1000, Normal, nullptr) \
     262    v(int32, ftlTierUpCounterIncrementForLoop, 1, Normal, nullptr) \
     263    v(int32, ftlTierUpCounterIncrementForReturn, 15, Normal, nullptr) \
     264    v(unsigned, ftlOSREntryFailureCountForReoptimization, 15, Normal, nullptr) \
     265    v(unsigned, ftlOSREntryRetryThreshold, 100, Normal, nullptr) \
     266    \
     267    v(int32, evalThresholdMultiplier, 10, Normal, nullptr) \
     268    v(unsigned, maximumEvalCacheableSourceLength, 256, Normal, nullptr) \
     269    \
     270    v(bool, randomizeExecutionCountsBetweenCheckpoints, false, Normal, nullptr) \
     271    v(int32, maximumExecutionCountsBetweenCheckpointsForBaseline, 1000, Normal, nullptr) \
     272    v(int32, maximumExecutionCountsBetweenCheckpointsForUpperTiers, 50000, Normal, nullptr) \
     273    \
     274    v(unsigned, likelyToTakeSlowCaseMinimumCount, 20, Normal, nullptr) \
     275    v(unsigned, couldTakeSlowCaseMinimumCount, 10, Normal, nullptr) \
     276    \
     277    v(unsigned, osrExitCountForReoptimization, 100, Normal, nullptr) \
     278    v(unsigned, osrExitCountForReoptimizationFromLoop, 5, Normal, nullptr) \
     279    \
     280    v(unsigned, reoptimizationRetryCounterMax, 0, Normal, nullptr)  \
     281    \
     282    v(unsigned, minimumOptimizationDelay, 1, Normal, nullptr) \
     283    v(unsigned, maximumOptimizationDelay, 5, Normal, nullptr) \
     284    v(double, desiredProfileLivenessRate, 0.75, Normal, nullptr) \
     285    v(double, desiredProfileFullnessRate, 0.35, Normal, nullptr) \
     286    \
     287    v(double, doubleVoteRatioForDoubleFormat, 2, Normal, nullptr) \
     288    v(double, structureCheckVoteRatioForHoisting, 1, Normal, nullptr) \
     289    v(double, checkArrayVoteRatioForHoisting, 1, Normal, nullptr) \
     290    \
     291    v(unsigned, minimumNumberOfScansBetweenRebalance, 100, Normal, nullptr) \
     292    v(unsigned, numberOfGCMarkers, computeNumberOfGCMarkers(7), Normal, nullptr) \
     293    v(unsigned, opaqueRootMergeThreshold, 1000, Normal, nullptr) \
     294    v(double, minHeapUtilization, 0.8, Normal, nullptr) \
     295    v(double, minCopiedBlockUtilization, 0.9, Normal, nullptr) \
     296    v(double, minMarkedBlockUtilization, 0.9, Normal, nullptr) \
     297    v(unsigned, slowPathAllocsBetweenGCs, 0, Normal, "force a GC on every Nth slow path alloc, where N is specified by this option") \
     298    \
     299    v(double, percentCPUPerMBForFullTimer, 0.0003125, Normal, nullptr) \
     300    v(double, percentCPUPerMBForEdenTimer, 0.0025, Normal, nullptr) \
     301    v(double, collectionTimerMaxPercentCPU, 0.05, Normal, nullptr) \
     302    \
     303    v(bool, forceWeakRandomSeed, false, Normal, nullptr) \
     304    v(unsigned, forcedWeakRandomSeed, 0, Normal, nullptr) \
     305    \
     306    v(bool, useZombieMode, false, Normal, "debugging option to scribble over dead objects with 0xdeadbeef") \
     307    v(bool, useImmortalObjects, false, Normal, "debugging option to keep all objects alive forever") \
     308    v(bool, dumpObjectStatistics, false, Normal, nullptr) \
     309    \
     310    v(gcLogLevel, logGC, GCLogging::None, Normal, "debugging option to log GC activity (0 = None, 1 = Basic, 2 = Verbose)") \
     311    v(bool, useGC, true, Normal, nullptr) \
     312    v(bool, gcAtEnd, false, Normal, "If true, the jsc CLI will do a GC before exiting") \
     313    v(bool, forceGCSlowPaths, false, Normal, "If true, we will force all JIT fast allocations down their slow paths.")\
     314    v(unsigned, gcMaxHeapSize, 0, Normal, nullptr) \
     315    v(unsigned, forceRAMSize, 0, Normal, nullptr) \
     316    v(bool, recordGCPauseTimes, false, Normal, nullptr) \
     317    v(bool, logHeapStatisticsAtExit, false, Normal, nullptr) \
     318    \
     319    v(bool, useTypeProfiler, false, Normal, nullptr) \
     320    v(bool, useControlFlowProfiler, false, Normal, nullptr) \
     321    \
     322    v(bool, useSamplingProfiler, false, Normal, nullptr) \
     323    v(unsigned, sampleInterval, 1000, Normal, "Time between stack traces in microseconds.") \
     324    v(bool, collectSamplingProfilerDataForJSCShell, false, Normal, "This corresponds to the JSC shell's --sample option.") \
     325    \
     326    v(bool, alwaysGeneratePCToCodeOriginMap, false, Normal, "This will make sure we always generate a PCToCodeOriginMap for JITed code.") \
     327    \
     328    v(bool, verifyHeap, false, Normal, nullptr) \
     329    v(unsigned, numberOfGCCyclesToRecordForVerification, 3, Normal, nullptr) \
     330    \
     331    v(bool, useExceptionFuzz, false, Normal, nullptr) \
     332    v(unsigned, fireExceptionFuzzAt, 0, Normal, nullptr) \
     333    v(bool, validateDFGExceptionHandling, false, Normal, "Causes the DFG to emit code validating exception handling for each node that can exit") /* This is true by default on Debug builds */\
     334    \
     335    v(bool, useExecutableAllocationFuzz, false, Normal, nullptr) \
     336    v(unsigned, fireExecutableAllocationFuzzAt, 0, Normal, nullptr) \
     337    v(unsigned, fireExecutableAllocationFuzzAtOrAfter, 0, Normal, nullptr) \
     338    v(bool, verboseExecutableAllocationFuzz, false, Normal, nullptr) \
     339    \
     340    v(bool, useOSRExitFuzz, false, Normal, nullptr) \
     341    v(unsigned, fireOSRExitFuzzAtStatic, 0, Normal, nullptr) \
     342    v(unsigned, fireOSRExitFuzzAt, 0, Normal, nullptr) \
     343    v(unsigned, fireOSRExitFuzzAtOrAfter, 0, Normal, nullptr) \
     344    \
     345    v(bool, logB3PhaseTimes, false, Normal, nullptr) \
     346    v(double, rareBlockPenalty, 0.001, Normal, nullptr) \
     347    v(bool, airSpillsEverything, false, Normal, nullptr) \
     348    v(bool, logAirRegisterPressure, false, Normal, nullptr) \
     349    v(unsigned, maxB3TailDupBlockSize, 3, Normal, nullptr) \
     350    v(unsigned, maxB3TailDupBlockSuccessors, 3, Normal, nullptr) \
     351    \
     352    v(bool, useDollarVM, false, Restricted, "installs the $vm debugging tool in global objects") \
     353    v(optionString, functionOverrides, nullptr, Restricted, "file with debugging overrides for function bodies") \
     354    \
     355    v(unsigned, watchdog, 0, Normal, "watchdog timeout (0 = Disabled, N = a timeout period of N milliseconds)") \
     356    \
     357    v(bool, useICStats, false, Normal, nullptr) \
     358    \
     359    v(bool, dumpModuleRecord, false, Normal, nullptr) \
     360    v(bool, dumpModuleLoadingState, false, Normal, nullptr) \
     361    v(bool, exposeInternalModuleLoader, false, Normal, "expose the internal module loader object to the global space for debugging") \
     362    \
     363    v(bool, useSuperSampler, false, Normal, nullptr)
    364364
    365365enum OptionEquivalence {
     
    408408        Verbose
    409409    };
    410    
     410
     411    enum class Availability {
     412        Normal = 0,
     413        Restricted
     414    };
     415
    411416    // This typedef is to allow us to eliminate the '_' in the field name in
    412417    // union inside Entry. This is needed to keep the style checker happy.
     
    415420    // Declare the option IDs:
    416421    enum OptionID {
    417 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \
     422#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
    418423        name_##ID,
    419424        JSC_OPTIONS(FOR_EACH_OPTION)
     
    448453
    449454    // Declare accessors for each option:
    450 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \
     455#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
    451456    ALWAYS_INLINE static type_& name_() { return s_options[name_##ID].type_##Val; } \
    452457    ALWAYS_INLINE static type_& name_##Default() { return s_defaultOptions[name_##ID].type_##Val; }
     
    472477        const char* description;
    473478        Type type;
     479        Availability availability;
    474480    };
    475481
     
    514520    const char* description() const;
    515521    Options::Type type() const;
     522    Options::Availability availability() const;
    516523    bool isOverridden() const;
    517524    const Option defaultOption() const;
     
    552559}
    553560
     561inline Options::Availability Option::availability() const
     562{
     563    return Options::s_optionsInfo[m_id].availability;
     564}
     565
    554566inline bool Option::isOverridden() const
    555567{
Note: See TracChangeset for help on using the changeset viewer.