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 // 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); }
void Options::initialize() { // Initialize each of the options with their default values: #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \ name_() = defaultValue_; \ name_##Default() = defaultValue_; JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION // It *probably* makes sense for other platforms to enable this. #if PLATFORM(IOS) && CPU(ARM64) enableLLVMFastISel() = true; #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_, description_) \ overrideOptionWithHeuristic(name_(), "JSC_" #name_); 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); if (Options::showOptions()) { DumpLevel level = static_cast<DumpLevel>(Options::showOptions()); if (level > DumpLevel::Verbose) level = DumpLevel::Verbose; const char* title = nullptr; switch (level) { case DumpLevel::None: break; case DumpLevel::Overridden: title = "Overridden JSC options:"; break; case DumpLevel::All: title = "All JSC options:"; break; case DumpLevel::Verbose: title = "All JSC options with descriptions:"; break; } dumpAllOptions(level, title); } }
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())); }
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); }
if (m_state < Normal) return true; if ((m_lowLimit <= count) && (count <= m_highLimit)) return m_state == Normal ? true : false; return m_state == Normal ? false : true; } Options::Entry Options::s_options[Options::numberOfOptions]; // Realize the names for each of the options: const Options::EntryInfo Options::s_optionsInfo[Options::numberOfOptions] = { #define FOR_EACH_OPTION(type_, name_, defaultValue_) \ { #name_, Options::type_##Type }, JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION }; static void recomputeDependentOptions() { #if !ENABLE(JIT) Options::useLLInt() = true; Options::useJIT() = false; Options::useDFGJIT() = false; Options::useFTLJIT() = false; #endif #if !ENABLE(YARR_JIT) Options::useRegExpJIT() = false; #endif #if !ENABLE(CONCURRENT_JIT)
void Options::initialize() { static std::once_flag initializeOptionsOnceFlag; std::call_once( initializeOptionsOnceFlag, [] { // Initialize each of the options with their default values: #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \ name_() = defaultValue_; \ name_##Default() = defaultValue_; JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION // It *probably* makes sense for other platforms to enable this. #if PLATFORM(IOS) && CPU(ARM64) enableLLVMFastISel() = true; #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_, description_) \ overrideOptionWithHeuristic(name_(), "JSC_" #name_); JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION #if 0 ; // Deconfuse editors that do auto indentation #endif recomputeDependentOptions(); #if USE(OPTIONS_FILE) { const char* filename = OPTIONS_FILENAME; FILE* optionsFile = fopen(filename, "r"); if (!optionsFile) { dataLogF("Failed to open file %s. Did you add the file-read-data entitlement to WebProcess.sb?\n", filename); return; } StringBuilder builder; char* line; char buffer[BUFSIZ]; while ((line = fgets(buffer, sizeof(buffer), optionsFile))) builder.append(buffer); const char* optionsStr = builder.toString().utf8().data(); dataLogF("Setting options: %s\n", optionsStr); setOptions(optionsStr); int result = fclose(optionsFile); if (result) dataLogF("Failed to close file %s: %s\n", filename, strerror(errno)); } #endif // 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); dumpOptionsIfNeeded(); ensureOptionsAreCoherent(); }); }
void Options::initialize() { static std::once_flag initializeOptionsOnceFlag; std::call_once( initializeOptionsOnceFlag, [] { // Initialize each of the options with their default values: #define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \ name_() = defaultValue_; \ name_##Default() = defaultValue_; JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION overrideDefaults(); // Allow environment vars to override options if applicable. // The evn var should be the name of the option prefixed with // "JSC_". #if PLATFORM(COCOA) bool hasBadOptions = false; for (char** envp = *_NSGetEnviron(); *envp; envp++) { const char* env = *envp; if (!strncmp("JSC_", env, 4)) { if (!Options::setOption(&env[4])) { dataLog("ERROR: invalid option: ", *envp, "\n"); hasBadOptions = true; } } } if (hasBadOptions && Options::validateOptions()) CRASH(); #else // PLATFORM(COCOA) #define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \ overrideOptionWithHeuristic(name_(), name_##ID, "JSC_" #name_, Availability::availability_); JSC_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION #endif // PLATFORM(COCOA) #define FOR_EACH_OPTION(aliasedName_, unaliasedName_, equivalence_) \ overrideAliasedOptionWithHeuristic("JSC_" #aliasedName_); JSC_ALIASED_OPTIONS(FOR_EACH_OPTION) #undef FOR_EACH_OPTION #if 0 ; // Deconfuse editors that do auto indentation #endif #if USE(OPTIONS_FILE) { const char* filename = OPTIONS_FILENAME; FILE* optionsFile = fopen(filename, "r"); if (!optionsFile) { dataLogF("Failed to open file %s. Did you add the file-read-data entitlement to WebProcess.sb?\n", filename); return; } StringBuilder builder; char* line; char buffer[BUFSIZ]; while ((line = fgets(buffer, sizeof(buffer), optionsFile))) builder.append(buffer); const char* optionsStr = builder.toString().utf8().data(); dataLogF("Setting options: %s\n", optionsStr); setOptions(optionsStr); int result = fclose(optionsFile); if (result) dataLogF("Failed to close file %s: %s\n", filename, strerror(errno)); } #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); dumpOptionsIfNeeded(); ensureOptionsAreCoherent(); }); }