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-15 22:20:43 +00:00
parent 3c1cf4006c
commit 002f610266
3 changed files with 29 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_DoNotUseDirectly());
}
JS_SetOffthreadIonCompilationEnabled(cx, offthreadIonCompilation);
JS_SetOffthreadIonCompilationEnabled(
cx,
StaticPrefs::javascript_options_ion_offthread_compilation_DoNotUseDirectly());
JS_SetGlobalJitCompilerOption(
cx, JSJITCOMPILER_BASELINE_INTERPRETER_WARMUP_TRIGGER,
@ -903,8 +898,9 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
javascript_options_ion_frequent_bailout_threshold_DoNotUseDirectly());
#ifdef DEBUG
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_FULL_DEBUG_CHECKS,
fullJitDebugChecks);
JS_SetGlobalJitCompilerOption(
cx, JSJITCOMPILER_FULL_DEBUG_CHECKS,
StaticPrefs::javascript_options_jit_full_debug_checks_DoNotUseDirectly());
#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_DoNotUseDirectly());
}
static void ReloadPrefsCallback(const char* pref, void* aXpccx) {

View File

@ -5361,6 +5361,23 @@
mirror: always # LoadStartupJSPrefs
do_not_use_directly: true
# Enable off-main-thread Warp compilation.
- name: javascript.options.ion.offthread_compilation
type: bool
value: true
mirror: always # LoadStartupJSPrefs
do_not_use_directly: true
#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: always # LoadStartupJSPrefs
do_not_use_directly: true
#endif
# Heuristic threshold for Warp/Ion to decide that too many bailouts are
# happening and an IonScript should be discarded.
#
@ -5534,10 +5551,12 @@
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: always # LoadStartupJSPrefs
do_not_use_directly: true
#---------------------------------------------------------------------------
# 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()