Bug 1697904 - Migrate more JIT prefs to StaticPrefs. r=jandem

Also relax the type on large_arraybuffers to plain bool since it is only read
once on startup.

Differential Revision: https://phabricator.services.mozilla.com/D108106
This commit is contained in:
Ted Campbell 2021-03-13 00:33:09 +00:00
parent 2fddbf10e9
commit 1cd5b3b30c
3 changed files with 26 additions and 17 deletions

View File

@ -833,13 +833,6 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
bool disableWasmHugeMemory = Preferences::GetBool(
JS_OPTIONS_DOT_STR "wasm_disable_huge_memory", false);
bool offthreadIonCompilation =
Preferences::GetBool(JS_OPTIONS_DOT_STR "ion.offthread_compilation");
#ifdef DEBUG
bool fullJitDebugChecks =
Preferences::GetBool(JS_OPTIONS_DOT_STR "jit.full_debug_checks");
#endif
bool spectreIndexMasking =
Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.index_masking");
bool spectreObjectMitigations =
@ -886,7 +879,9 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
StaticPrefs::javascript_options_native_regexp_AtStartup());
}
JS_SetOffthreadIonCompilationEnabled(cx, offthreadIonCompilation);
JS_SetOffthreadIonCompilationEnabled(
cx,
StaticPrefs::javascript_options_ion_offthread_compilation_AtStartup());
JS_SetGlobalJitCompilerOption(
cx, JSJITCOMPILER_BASELINE_INTERPRETER_WARMUP_TRIGGER,
@ -903,8 +898,9 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
javascript_options_ion_frequent_bailout_threshold_AtStartup());
#ifdef DEBUG
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_FULL_DEBUG_CHECKS,
fullJitDebugChecks);
JS_SetGlobalJitCompilerOption(
cx, JSJITCOMPILER_FULL_DEBUG_CHECKS,
StaticPrefs::javascript_options_jit_full_debug_checks_AtStartup());
#endif
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_INDEX_MASKING,
@ -917,13 +913,14 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
spectreValueMasking);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_JIT_TO_CXX_CALLS,
spectreJitToCxxCalls);
if (disableWasmHugeMemory) {
bool disabledHugeMemory = JS::DisableWasmHugeMemory();
MOZ_RELEASE_ASSERT(disabledHugeMemory);
}
JS::SetLargeArrayBuffersEnabled(
StaticPrefs::javascript_options_large_arraybuffers());
StaticPrefs::javascript_options_large_arraybuffers_AtStartup());
}
static void ReloadPrefsCallback(const char* pref, void* aXpccx) {

View File

@ -5355,6 +5355,21 @@
value: 1500
mirror: once
# Enable off-main-thread Warp compilation.
- name: javascript.options.ion.offthread_compilation
type: bool
value: true
mirror: once
#ifdef DEBUG
# Enable extra correctness checks in the JITs that are slow and only available
# in debug builds.
- name: javascript.options.jit.full_debug_checks
type: bool
value: false
mirror: once
#endif
# Heuristic threshold for Warp/Ion to decide that too many bailouts are
# happening and an IonScript should be discarded.
#
@ -5527,10 +5542,11 @@
mirror: always
#endif
# Experimental support for ArrayBuffers larger than 2 GB.
- name: javascript.options.large_arraybuffers
type: RelaxedAtomicBool
type: bool
value: false
mirror: always
mirror: once
#---------------------------------------------------------------------------
# Prefs starting with "layers."

View File

@ -1112,10 +1112,6 @@ pref("javascript.options.asyncstack", true);
pref("javascript.options.asyncstack_capture_debuggee_only", true);
pref("javascript.options.throw_on_asmjs_validation_failure", false);
pref("javascript.options.ion.offthread_compilation", true);
#ifdef DEBUG
pref("javascript.options.jit.full_debug_checks", false);
#endif
// This preference instructs the JS engine to discard the
// source of any privileged JS after compilation. This saves
// memory, but makes things like Function.prototype.toSource()