Bug 1495431 Expose baseline and ion JIT warm up threshold options to preferences, about:config r=nbp

JIT warmup options were exposed to preferences to facilitate experimentation/optimization.

The baseline and ion warm up thresholds had already been exposed through JSAPI, just needed to read from Preferences.

The ion JitOption, frequentBailoutThreshold, was also exposed to JSAPI and Preferences.

Differential Revision: https://phabricator.services.mozilla.com/D7321

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Creskey 2018-10-03 19:23:54 +00:00
parent 070df1d4c1
commit 00474fc9c9
6 changed files with 24 additions and 0 deletions

View File

@ -17,6 +17,7 @@ namespace jit {
const OptimizationLevelInfo IonOptimizations;
// Duplicated in all.js - ensure both match.
const uint32_t OptimizationInfo::CompilerWarmupThreshold = 1000;
const uint32_t OptimizationInfo::CompilerSmallFunctionWarmupThreshold = CompilerWarmupThreshold;

View File

@ -158,6 +158,7 @@ DefaultJitOptions::DefaultJitOptions()
// How many invocations or loop iterations are needed before functions
// are compiled with the baseline compiler.
// Duplicated in all.js - ensure both match.
SET_DEFAULT(baselineWarmUpThreshold, 10);
// Number of exception bailouts (resuming into catch/finally block) before
@ -166,6 +167,7 @@ DefaultJitOptions::DefaultJitOptions()
// Number of bailouts without invalidation before we set
// JSScript::hadFrequentBailouts and invalidate.
// Duplicated in all.js - ensure both match.
SET_DEFAULT(frequentBailoutThreshold, 10);
// Whether to run all debug checks in debug builds.

View File

@ -6530,6 +6530,13 @@ JS_SetGlobalJitCompilerOption(JSContext* cx, JSJitCompilerOption opt, uint32_t v
JitSpew(js::jit::JitSpew_IonScripts, "Disable ion");
}
break;
case JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD:
if (value == uint32_t(-1)) {
jit::DefaultJitOptions defaultValues;
value = defaultValues.frequentBailoutThreshold;
}
jit::JitOptions.frequentBailoutThreshold = value;
break;
case JSJITCOMPILER_BASELINE_ENABLE:
if (value == 1) {
JS::ContextOptionsRef(cx).setBaseline(true);
@ -6622,6 +6629,9 @@ JS_GetGlobalJitCompilerOption(JSContext* cx, JSJitCompilerOption opt, uint32_t*
case JSJITCOMPILER_ION_ENABLE:
*valueOut = JS::ContextOptionsRef(cx).ion();
break;
case JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD:
*valueOut = jit::JitOptions.frequentBailoutThreshold;
break;
case JSJITCOMPILER_BASELINE_ENABLE:
*valueOut = JS::ContextOptionsRef(cx).baseline();
break;

View File

@ -4462,6 +4462,7 @@ JS_SetOffthreadIonCompilationEnabled(JSContext* cx, bool enabled);
Register(ION_FORCE_IC, "ion.forceinlineCaches") \
Register(ION_ENABLE, "ion.enable") \
Register(ION_CHECK_RANGE_ANALYSIS, "ion.check-range-analysis") \
Register(ION_FREQUENT_BAILOUT_THRESHOLD, "ion.frequent-bailout-threshold") \
Register(BASELINE_ENABLE, "baseline.enable") \
Register(OFFTHREAD_COMPILATION_ENABLE, "offthread-compilation.enable") \
Register(FULL_DEBUG_CHECKS, "jit.full-debug-checks") \

View File

@ -822,6 +822,7 @@ ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx)
int32_t baselineThreshold = Preferences::GetInt(JS_OPTIONS_DOT_STR "baselinejit.threshold", -1);
int32_t ionThreshold = Preferences::GetInt(JS_OPTIONS_DOT_STR "ion.threshold", -1);
int32_t ionFrequentBailoutThreshold = Preferences::GetInt(JS_OPTIONS_DOT_STR "ion.frequent_bailout_threshold", -1);
sDiscardSystemSource = Preferences::GetBool(JS_OPTIONS_DOT_STR "discardSystemSource");
@ -906,6 +907,9 @@ ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx)
useBaselineEager ? 0 : baselineThreshold);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_ION_WARMUP_TRIGGER,
useIonEager ? 0 : ionThreshold);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD,
ionFrequentBailoutThreshold);
#ifdef DEBUG
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_FULL_DEBUG_CHECKS, fullJitDebugChecks);
#endif

View File

@ -1410,7 +1410,13 @@ pref("javascript.options.strict", false);
pref("javascript.options.strict.debug", false);
#endif
pref("javascript.options.baselinejit", true);
//Duplicated in JitOptions - ensure both match.
pref("javascript.options.baselinejit.threshold", 10);
pref("javascript.options.ion", true);
//Duplicated in JitOptions - ensure both match.
pref("javascript.options.ion.threshold", 1000);
//Duplicated in JitOptions - ensure both match.
pref("javascript.options.ion.frequent_bailout_threshold", 10);
pref("javascript.options.asmjs", true);
pref("javascript.options.wasm", true);
pref("javascript.options.wasm_ionjit", true);