mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1599226 - Change Ion-for-Trusted-Principals into Jits-for-Trusted-Principals r=jandem
Because Tor disables both the Ion Jit and the Baseline Jit, we want to enable both of them for trusted principals; not just Ion. Differential Revision: https://phabricator.services.mozilla.com/D61272 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
5f0a267184
commit
87c65e049e
@ -2992,7 +2992,7 @@ static_assert(JitWarmupResetLimit <=
|
||||
static bool testingFunc_inJit(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (!jit::IsBaselineJitEnabled()) {
|
||||
if (!jit::IsBaselineJitEnabled(cx)) {
|
||||
return ReturnStringCopy(cx, args, "Baseline is disabled.");
|
||||
}
|
||||
|
||||
@ -6117,7 +6117,7 @@ static bool BaselineCompile(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!jit::IsBaselineJitEnabled()) {
|
||||
if (!jit::IsBaselineJitEnabled(cx)) {
|
||||
returnedStr = "baseline disabled";
|
||||
break;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ bool jit::Bailout(BailoutStack* sp, BaselineBailoutInfo** bailoutInfo) {
|
||||
JitSpew(JitSpew_IonBailouts, "Took bailout! Snapshot offset: %d",
|
||||
frame.snapshotOffset());
|
||||
|
||||
MOZ_ASSERT(IsBaselineJitEnabled());
|
||||
MOZ_ASSERT(IsBaselineJitEnabled(cx));
|
||||
|
||||
*bailoutInfo = nullptr;
|
||||
bool success = BailoutIonToBaseline(cx, bailoutData.activation(), frame,
|
||||
@ -136,7 +136,7 @@ bool jit::InvalidationBailout(InvalidationBailoutStack* sp,
|
||||
// Note: the frame size must be computed before we return from this function.
|
||||
*frameSizeOut = frame.frameSize();
|
||||
|
||||
MOZ_ASSERT(IsBaselineJitEnabled());
|
||||
MOZ_ASSERT(IsBaselineJitEnabled(cx));
|
||||
|
||||
*bailoutInfo = nullptr;
|
||||
bool success = BailoutIonToBaseline(cx, bailoutData.activation(), frame, true,
|
||||
|
@ -198,7 +198,7 @@ MethodStatus jit::BaselineCompile(JSContext* cx, JSScript* script,
|
||||
cx->check(script);
|
||||
MOZ_ASSERT(!script->hasBaselineScript());
|
||||
MOZ_ASSERT(script->canBaselineCompile());
|
||||
MOZ_ASSERT(IsBaselineJitEnabled());
|
||||
MOZ_ASSERT(IsBaselineJitEnabled(cx));
|
||||
AutoGeckoProfilerEntry pseudoFrame(
|
||||
cx, "Baseline script compilation",
|
||||
JS::ProfilingCategoryPair::JS_BaselineCompilation);
|
||||
@ -235,7 +235,7 @@ static MethodStatus CanEnterBaselineJIT(JSContext* cx, HandleScript script,
|
||||
return Method_Skipped;
|
||||
}
|
||||
|
||||
if (!IsBaselineJitEnabled()) {
|
||||
if (!IsBaselineJitEnabled(cx)) {
|
||||
script->disableBaselineCompile();
|
||||
return Method_CantCompile;
|
||||
}
|
||||
|
@ -584,6 +584,21 @@ class BaselineInterpreter {
|
||||
MOZ_MUST_USE bool GenerateBaselineInterpreter(JSContext* cx,
|
||||
BaselineInterpreter& interpreter);
|
||||
|
||||
inline bool IsBaselineJitEnabled(JSContext* cx) {
|
||||
if (MOZ_UNLIKELY(!IsBaselineInterpreterEnabled())) {
|
||||
return false;
|
||||
}
|
||||
if (MOZ_LIKELY(JitOptions.baselineJit)) {
|
||||
return true;
|
||||
}
|
||||
if (JitOptions.jitForTrustedPrincipals) {
|
||||
JS::Realm* realm = js::GetContextRealm(cx);
|
||||
return realm && JS::GetRealmPrincipals(realm) &&
|
||||
JS::GetRealmPrincipals(realm)->isSystemOrAddonPrincipal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
@ -1885,7 +1885,7 @@ static MethodStatus Compile(JSContext* cx, HandleScript script,
|
||||
BaselineFrame* osrFrame, uint32_t osrFrameSize,
|
||||
jsbytecode* osrPc, bool forceRecompile = false) {
|
||||
MOZ_ASSERT(jit::IsIonEnabled(cx));
|
||||
MOZ_ASSERT(jit::IsBaselineJitEnabled());
|
||||
MOZ_ASSERT(jit::IsBaselineJitEnabled(cx));
|
||||
|
||||
AutoGeckoProfilerEntry pseudoFrame(
|
||||
cx, "Ion script compilation",
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Result.h"
|
||||
|
||||
#include "jit/BaselineJIT.h"
|
||||
#include "jit/CompileWrappers.h"
|
||||
#include "jit/JitContext.h"
|
||||
#include "jit/JitOptions.h"
|
||||
@ -132,13 +133,13 @@ void ForbidCompilation(JSContext* cx, JSScript* script);
|
||||
size_t SizeOfIonData(JSScript* script, mozilla::MallocSizeOf mallocSizeOf);
|
||||
|
||||
inline bool IsIonEnabled(JSContext* cx) {
|
||||
if (MOZ_UNLIKELY(!IsBaselineJitEnabled() || cx->options().disableIon())) {
|
||||
if (MOZ_UNLIKELY(!IsBaselineJitEnabled(cx) || cx->options().disableIon())) {
|
||||
return false;
|
||||
}
|
||||
if (MOZ_LIKELY(JitOptions.ion)) {
|
||||
return true;
|
||||
}
|
||||
if (JitOptions.ionForTrustedPrincipals) {
|
||||
if (JitOptions.jitForTrustedPrincipals) {
|
||||
JS::Realm* realm = js::GetContextRealm(cx);
|
||||
return realm && JS::GetRealmPrincipals(realm) &&
|
||||
JS::GetRealmPrincipals(realm)->isSystemOrAddonPrincipal();
|
||||
|
@ -4537,7 +4537,7 @@ bool jit::AnalyzeNewScriptDefiniteProperties(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!jit::IsIonEnabled(cx) || !jit::IsBaselineJitEnabled() ||
|
||||
if (!jit::IsIonEnabled(cx) || !jit::IsBaselineJitEnabled(cx) ||
|
||||
!CanBaselineInterpretScript(script)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ EnterJitStatus js::jit::MaybeEnterJit(JSContext* cx, RunState& state) {
|
||||
}
|
||||
|
||||
// Try to Baseline-compile.
|
||||
if (jit::IsBaselineJitEnabled()) {
|
||||
if (jit::IsBaselineJitEnabled(cx)) {
|
||||
jit::MethodStatus status =
|
||||
jit::CanEnterBaselineMethod<BaselineTier::Compiler>(cx, state);
|
||||
if (status == jit::Method_Error) {
|
||||
|
@ -138,9 +138,9 @@ DefaultJitOptions::DefaultJitOptions() {
|
||||
// Whether the IonMonkey JIT is enabled.
|
||||
SET_DEFAULT(ion, true);
|
||||
|
||||
// Whether the IonMonkey JIT is enabled for Trusted Principals.
|
||||
// (Ignored if ion is set to true.)
|
||||
SET_DEFAULT(ionForTrustedPrincipals, false);
|
||||
// Whether the IonMonkey and Baseline JITs are enabled for Trusted Principals.
|
||||
// (Ignored if ion or baselineJit is set to true.)
|
||||
SET_DEFAULT(jitForTrustedPrincipals, false);
|
||||
|
||||
// Whether the RegExp JIT is enabled.
|
||||
SET_DEFAULT(nativeRegExp, true);
|
||||
|
@ -62,7 +62,7 @@ struct DefaultJitOptions {
|
||||
bool baselineInterpreter;
|
||||
bool baselineJit;
|
||||
bool ion;
|
||||
bool ionForTrustedPrincipals;
|
||||
bool jitForTrustedPrincipals;
|
||||
bool nativeRegExp;
|
||||
bool forceInlineCaches;
|
||||
bool fullDebugChecks;
|
||||
@ -140,10 +140,6 @@ inline bool IsBaselineInterpreterEnabled() {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool IsBaselineJitEnabled() {
|
||||
return IsBaselineInterpreterEnabled() && JitOptions.baselineJit;
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
@ -5339,6 +5339,17 @@ JS_PUBLIC_API void JS_SetGlobalJitCompilerOption(JSContext* cx,
|
||||
JitSpew(js::jit::JitSpew_IonScripts, "Disable ion");
|
||||
}
|
||||
break;
|
||||
case JSJITCOMPILER_JIT_TRUSTEDPRINCIPALS_ENABLE:
|
||||
if (value == 1) {
|
||||
jit::JitOptions.jitForTrustedPrincipals = true;
|
||||
JitSpew(js::jit::JitSpew_IonScripts,
|
||||
"Enable ion and baselinejit for trusted principals");
|
||||
} else if (value == 0) {
|
||||
jit::JitOptions.jitForTrustedPrincipals = false;
|
||||
JitSpew(js::jit::JitSpew_IonScripts,
|
||||
"Disable ion and baselinejit for trusted principals");
|
||||
}
|
||||
break;
|
||||
case JSJITCOMPILER_ION_FREQUENT_BAILOUT_THRESHOLD:
|
||||
if (value == uint32_t(-1)) {
|
||||
jit::DefaultJitOptions defaultValues;
|
||||
|
@ -2767,7 +2767,7 @@ extern JS_PUBLIC_API void JS_SetOffthreadIonCompilationEnabled(JSContext* cx,
|
||||
Register(ION_GVN_ENABLE, "ion.gvn.enable") \
|
||||
Register(ION_FORCE_IC, "ion.forceinlineCaches") \
|
||||
Register(ION_ENABLE, "ion.enable") \
|
||||
Register(ION_TRUSTEDPRINCIPALS_ENABLE, "ion_trustedprincipals.enable") \
|
||||
Register(JIT_TRUSTEDPRINCIPALS_ENABLE, "jit_trustedprincipals.enable") \
|
||||
Register(ION_CHECK_RANGE_ANALYSIS, "ion.check-range-analysis") \
|
||||
Register(ION_FREQUENT_BAILOUT_THRESHOLD, "ion.frequent-bailout-threshold") \
|
||||
Register(BASELINE_INTERPRETER_ENABLE, "blinterp.enable") \
|
||||
|
@ -789,8 +789,8 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
|
||||
bool useBaselineInterp = Preferences::GetBool(JS_OPTIONS_DOT_STR "blinterp");
|
||||
bool useBaselineJit = Preferences::GetBool(JS_OPTIONS_DOT_STR "baselinejit");
|
||||
bool useIon = Preferences::GetBool(JS_OPTIONS_DOT_STR "ion");
|
||||
bool useIonForTrustedPrincipals =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "ion_trustedprincipals");
|
||||
bool useJitForTrustedPrincipals =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "jit_trustedprincipals");
|
||||
bool useNativeRegExp =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "native_regexp");
|
||||
|
||||
@ -840,7 +840,7 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
|
||||
useBaselineInterp = false;
|
||||
useBaselineJit = false;
|
||||
useIon = false;
|
||||
useIonForTrustedPrincipals = false;
|
||||
useJitForTrustedPrincipals = false;
|
||||
useNativeRegExp = false;
|
||||
}
|
||||
}
|
||||
@ -850,8 +850,8 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
|
||||
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_BASELINE_ENABLE,
|
||||
useBaselineJit);
|
||||
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_ION_ENABLE, useIon);
|
||||
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_ION_TRUSTEDPRINCIPALS_ENABLE,
|
||||
useIonForTrustedPrincipals);
|
||||
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_JIT_TRUSTEDPRINCIPALS_ENABLE,
|
||||
useJitForTrustedPrincipals);
|
||||
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_NATIVE_REGEXP_ENABLE,
|
||||
useNativeRegExp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user