diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index de8ef2ee16d4..010c779f9bbd 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -840,15 +840,6 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) { Preferences::GetBool(JS_OPTIONS_DOT_STR "jit.full_debug_checks"); #endif - int32_t baselineInterpThreshold = - Preferences::GetInt(JS_OPTIONS_DOT_STR "blinterp.threshold", -1); - int32_t baselineThreshold = - Preferences::GetInt(JS_OPTIONS_DOT_STR "baselinejit.threshold", -1); - int32_t normalIonThreshold = - Preferences::GetInt(JS_OPTIONS_DOT_STR "ion.threshold", -1); - int32_t ionFrequentBailoutThreshold = Preferences::GetInt( - JS_OPTIONS_DOT_STR "ion.frequent_bailout_threshold", -1); - bool spectreIndexMasking = Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.index_masking"); bool spectreObjectMitigations = @@ -899,14 +890,17 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) { JS_SetGlobalJitCompilerOption( cx, JSJITCOMPILER_BASELINE_INTERPRETER_WARMUP_TRIGGER, - baselineInterpThreshold); - JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_BASELINE_WARMUP_TRIGGER, - baselineThreshold); - JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_ION_NORMAL_WARMUP_TRIGGER, - normalIonThreshold); - JS_SetGlobalJitCompilerOption(cx, - JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD, - ionFrequentBailoutThreshold); + StaticPrefs::javascript_options_blinterp_threshold_AtStartup()); + JS_SetGlobalJitCompilerOption( + cx, JSJITCOMPILER_BASELINE_WARMUP_TRIGGER, + StaticPrefs::javascript_options_baselinejit_threshold_AtStartup()); + JS_SetGlobalJitCompilerOption( + cx, JSJITCOMPILER_ION_NORMAL_WARMUP_TRIGGER, + StaticPrefs::javascript_options_ion_threshold_AtStartup()); + JS_SetGlobalJitCompilerOption( + cx, JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD, + StaticPrefs:: + javascript_options_ion_frequent_bailout_threshold_AtStartup()); #ifdef DEBUG JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_FULL_DEBUG_CHECKS, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index d2d57ab6b669..1a3cf01c5b8f 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -5336,6 +5336,34 @@ value: true mirror: once +# "Warm-up" thresholds at which we attempt to compile a script/function with +# the next JIT tier. +# +# NOTE: These must match JitOptions defaults. +- name: javascript.options.blinterp.threshold + type: int32_t + value: 10 + mirror: once + +- name: javascript.options.baselinejit.threshold + type: int32_t + value: 100 + mirror: once + +- name: javascript.options.ion.threshold + type: int32_t + value: 1500 + mirror: once + +# Heuristic threshold for Warp/Ion to decide that too many bailouts are +# happening and an IonScript should be discarded. +# +# NOTE: This must match JitOptions defaults. +- name: javascript.options.ion.frequent_bailout_threshold + type: int32_t + value: 10 + mirror: once + - name: javascript.options.compact_on_user_inactive type: bool value: true diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 15d15c360b95..9cfb6986a43a 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1090,14 +1090,6 @@ pref("dom.event.contextmenu.enabled", true); pref("dom.event.coalesce_mouse_move", true); pref("javascript.enabled", true); -// Duplicated in JitOptions - ensure both match. -pref("javascript.options.blinterp.threshold", 10); -// Duplicated in JitOptions - ensure both match. -pref("javascript.options.baselinejit.threshold", 100); -// Duplicated in JitOptions - ensure both match. -pref("javascript.options.ion.threshold", 1500); -// 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_trustedprincipals", true);