Esempio n. 1
0
void Options::initialize()
{
    // Initialize each of the options with their default values:
#define FOR_EACH_OPTION(type_, name_, defaultValue_) \
    name_() = defaultValue_;
    JSC_OPTIONS(FOR_EACH_OPTION)
#undef FOR_EACH_OPTION
        
#if USE(CF) || OS(UNIX)
    objectsAreImmortal() = !!getenv("JSImmortalZombieEnabled");
    useZombieMode() = !!getenv("JSImmortalZombieEnabled") || !!getenv("JSZombieEnabled");

    gcMaxHeapSize() = getenv("GCMaxHeapSize") ? HeapStatistics::parseMemoryAmount(getenv("GCMaxHeapSize")) : 0;
    recordGCPauseTimes() = !!getenv("JSRecordGCPauseTimes");
    logHeapStatisticsAtExit() = gcMaxHeapSize() || recordGCPauseTimes();
#endif

    // Allow environment vars to override options if applicable.
    // The evn var should be the name of the option prefixed with
    // "JSC_".
#define FOR_EACH_OPTION(type_, name_, defaultValue_) \
    overrideOptionWithHeuristic(name_(), "JSC_" #name_);
    JSC_OPTIONS(FOR_EACH_OPTION)
#undef FOR_EACH_OPTION

#if 0
    ; // Deconfuse editors that do auto indentation
#endif
    
#if !ENABLE(JIT)
    useJIT() = false;
    useDFGJIT() = false;
#endif
#if !ENABLE(YARR_JIT)
    useRegExpJIT() = false;
#endif
    
    // Do range checks where needed and make corrections to the options:
    ASSERT(thresholdForOptimizeAfterLongWarmUp() >= thresholdForOptimizeAfterWarmUp());
    ASSERT(thresholdForOptimizeAfterWarmUp() >= thresholdForOptimizeSoon());
    ASSERT(thresholdForOptimizeAfterWarmUp() >= 0);

    // Compute the maximum value of the reoptimization retry counter. This is simply
    // the largest value at which we don't overflow the execute counter, when using it
    // to left-shift the execution counter by this amount. Currently the value ends
    // up being 18, so this loop is not so terrible; it probably takes up ~100 cycles
    // total on a 32-bit processor.
    reoptimizationRetryCounterMax() = 0;
    while ((static_cast<int64_t>(thresholdForOptimizeAfterLongWarmUp()) << (reoptimizationRetryCounterMax() + 1)) <= static_cast<int64_t>(std::numeric_limits<int32>::max()))
        reoptimizationRetryCounterMax()++;

    ASSERT((static_cast<int64_t>(thresholdForOptimizeAfterLongWarmUp()) << reoptimizationRetryCounterMax()) > 0);
    ASSERT((static_cast<int64_t>(thresholdForOptimizeAfterLongWarmUp()) << reoptimizationRetryCounterMax()) <= static_cast<int64_t>(std::numeric_limits<int32>::max()));
}
Esempio n. 2
0
void Options::initialize()
{
    // Initialize each of the options with their default values:
#define FOR_EACH_OPTION(type_, name_, defaultValue_) \
    name_() = defaultValue_;
    JSC_OPTIONS(FOR_EACH_OPTION)
#undef FOR_EACH_OPTION
        
#if USE(CF) || OS(UNIX)
    objectsAreImmortal() = !!getenv("JSImmortalZombieEnabled");
    useZombieMode() = !!getenv("JSImmortalZombieEnabled") || !!getenv("JSZombieEnabled");

    gcMaxHeapSize() = getenv("GCMaxHeapSize") ? HeapStatistics::parseMemoryAmount(getenv("GCMaxHeapSize")) : 0;
    recordGCPauseTimes() = !!getenv("JSRecordGCPauseTimes");
    logHeapStatisticsAtExit() = gcMaxHeapSize() || recordGCPauseTimes();
#endif

    // Allow environment vars to override options if applicable.
    // The evn var should be the name of the option prefixed with
    // "JSC_".
#define FOR_EACH_OPTION(type_, name_, defaultValue_) \
    if (overrideOptionWithHeuristic(name_(), "JSC_" #name_)) \
        s_options[OPT_##name_].didOverride = true;
    JSC_OPTIONS(FOR_EACH_OPTION)
#undef FOR_EACH_OPTION

#if 0
    ; // Deconfuse editors that do auto indentation
#endif
    
    recomputeDependentOptions();

    // Do range checks where needed and make corrections to the options:
    ASSERT(Options::thresholdForOptimizeAfterLongWarmUp() >= Options::thresholdForOptimizeAfterWarmUp());
    ASSERT(Options::thresholdForOptimizeAfterWarmUp() >= Options::thresholdForOptimizeSoon());
    ASSERT(Options::thresholdForOptimizeAfterWarmUp() >= 0);
}