зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1607494 - Disable Ion for the PAC script thread. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D59467 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
62f0375b13
Коммит
44ec4609e5
|
@ -31,6 +31,7 @@ class JS_PUBLIC_API ContextOptions {
|
|||
enableWasmBigInt_(false),
|
||||
#endif
|
||||
throwOnAsmJSValidationFailure_(false),
|
||||
disableIon_(false),
|
||||
asyncStack_(true),
|
||||
throwOnDebuggeeWouldRun_(true),
|
||||
dumpStackOnDebuggeeWouldRun_(false),
|
||||
|
@ -118,6 +119,15 @@ class JS_PUBLIC_API ContextOptions {
|
|||
return *this;
|
||||
}
|
||||
|
||||
// Override to allow disabling Ion for this context irrespective of the
|
||||
// process-wide Ion-enabled setting. This must be set right after creating
|
||||
// the context.
|
||||
bool disableIon() const { return disableIon_; }
|
||||
ContextOptions& setDisableIon() {
|
||||
disableIon_ = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool asyncStack() const { return asyncStack_; }
|
||||
ContextOptions& setAsyncStack(bool flag) {
|
||||
asyncStack_ = flag;
|
||||
|
@ -194,6 +204,7 @@ class JS_PUBLIC_API ContextOptions {
|
|||
bool enableWasmBigInt_ : 1;
|
||||
#endif
|
||||
bool throwOnAsmJSValidationFailure_ : 1;
|
||||
bool disableIon_ : 1;
|
||||
bool asyncStack_ : 1;
|
||||
bool throwOnDebuggeeWouldRun_ : 1;
|
||||
bool dumpStackOnDebuggeeWouldRun_ : 1;
|
||||
|
|
|
@ -3024,7 +3024,7 @@ static bool testingFunc_inJit(JSContext* cx, unsigned argc, Value* vp) {
|
|||
static bool testingFunc_inIon(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (!jit::IsIonEnabled()) {
|
||||
if (!jit::IsIonEnabled(cx)) {
|
||||
return ReturnStringCopy(cx, args, "Ion is disabled.");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// |jit-test| --no-ion-for-main-context
|
||||
assertEq(inIon(), "Ion is disabled.");
|
|
@ -66,7 +66,7 @@ BaselineCompilerHandler::BaselineCompilerHandler(JSContext* cx,
|
|||
pc_(script->code()),
|
||||
icEntryIndex_(0),
|
||||
compileDebugInstrumentation_(script->isDebuggee()),
|
||||
ionCompileable_(jit::IsIonEnabled() && CanIonCompileScript(cx, script)) {
|
||||
ionCompileable_(IsIonEnabled(cx) && CanIonCompileScript(cx, script)) {
|
||||
}
|
||||
|
||||
BaselineInterpreterHandler::BaselineInterpreterHandler(JSContext* cx,
|
||||
|
|
|
@ -1828,7 +1828,7 @@ AttachDecision GetPropIRGenerator::tryAttachModuleNamespace(HandleObject obj,
|
|||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
if (IsIonEnabled()) {
|
||||
if (IsIonEnabled(cx_)) {
|
||||
EnsureTrackPropertyTypes(cx_, env, shape->propid());
|
||||
}
|
||||
|
||||
|
@ -1894,7 +1894,7 @@ AttachDecision GetPropIRGenerator::tryAttachPrimitive(ValOperandId valId,
|
|||
case CanAttachReadSlot: {
|
||||
if (holder) {
|
||||
// Instantiate this property, for use during Ion compilation.
|
||||
if (IsIonEnabled()) {
|
||||
if (IsIonEnabled(cx_)) {
|
||||
EnsureTrackPropertyTypes(cx_, holder, id);
|
||||
}
|
||||
}
|
||||
|
@ -2492,7 +2492,7 @@ AttachDecision GetNameIRGenerator::tryAttachGlobalNameValue(ObjOperandId objId,
|
|||
}
|
||||
|
||||
// Instantiate this global property, for use during Ion compilation.
|
||||
if (IsIonEnabled()) {
|
||||
if (IsIonEnabled(cx_)) {
|
||||
EnsureTrackPropertyTypes(cx_, holder, id);
|
||||
}
|
||||
|
||||
|
@ -2560,7 +2560,7 @@ AttachDecision GetNameIRGenerator::tryAttachGlobalNameGetter(ObjOperandId objId,
|
|||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
if (IsIonEnabled()) {
|
||||
if (IsIonEnabled(cx_)) {
|
||||
EnsureTrackPropertyTypes(cx_, holder, id);
|
||||
}
|
||||
|
||||
|
@ -5200,7 +5200,7 @@ AttachDecision CallIRGenerator::tryAttachCallScripted(
|
|||
|
||||
// Keep track of the function's |prototype| property in type
|
||||
// information, for use during Ion compilation.
|
||||
if (IsIonEnabled()) {
|
||||
if (IsIonEnabled(cx_)) {
|
||||
EnsureTrackPropertyTypes(cx_, calleeFunc, NameToId(cx_->names().prototype));
|
||||
}
|
||||
|
||||
|
|
|
@ -2069,7 +2069,7 @@ static OptimizationLevel GetOptimizationLevel(HandleScript script,
|
|||
static MethodStatus Compile(JSContext* cx, HandleScript script,
|
||||
BaselineFrame* osrFrame, uint32_t osrFrameSize,
|
||||
jsbytecode* osrPc, bool forceRecompile = false) {
|
||||
MOZ_ASSERT(jit::IsIonEnabled());
|
||||
MOZ_ASSERT(jit::IsIonEnabled(cx));
|
||||
MOZ_ASSERT(jit::IsBaselineJitEnabled());
|
||||
|
||||
AutoGeckoProfilerEntry pseudoFrame(
|
||||
|
@ -2169,7 +2169,7 @@ bool jit::OffThreadCompilationAvailable(JSContext* cx) {
|
|||
}
|
||||
|
||||
MethodStatus jit::CanEnterIon(JSContext* cx, RunState& state) {
|
||||
MOZ_ASSERT(jit::IsIonEnabled());
|
||||
MOZ_ASSERT(jit::IsIonEnabled(cx));
|
||||
|
||||
HandleScript script = state.script();
|
||||
|
||||
|
@ -2245,7 +2245,7 @@ MethodStatus jit::CanEnterIon(JSContext* cx, RunState& state) {
|
|||
static MethodStatus BaselineCanEnterAtEntry(JSContext* cx, HandleScript script,
|
||||
BaselineFrame* frame,
|
||||
uint32_t frameSize) {
|
||||
MOZ_ASSERT(jit::IsIonEnabled());
|
||||
MOZ_ASSERT(jit::IsIonEnabled(cx));
|
||||
MOZ_ASSERT(script->canIonCompile());
|
||||
MOZ_ASSERT(!script->isIonCompilingOffThread());
|
||||
MOZ_ASSERT(!script->hasIonScript());
|
||||
|
@ -2275,7 +2275,7 @@ static MethodStatus BaselineCanEnterAtBranch(JSContext* cx, HandleScript script,
|
|||
BaselineFrame* osrFrame,
|
||||
uint32_t osrFrameSize,
|
||||
jsbytecode* pc) {
|
||||
MOZ_ASSERT(jit::IsIonEnabled());
|
||||
MOZ_ASSERT(jit::IsIonEnabled(cx));
|
||||
MOZ_ASSERT((JSOp)*pc == JSOP_LOOPHEAD);
|
||||
|
||||
// Skip if the script has been disabled.
|
||||
|
@ -2348,7 +2348,7 @@ static MethodStatus BaselineCanEnterAtBranch(JSContext* cx, HandleScript script,
|
|||
|
||||
static bool IonCompileScriptForBaseline(JSContext* cx, BaselineFrame* frame,
|
||||
uint32_t frameSize, jsbytecode* pc) {
|
||||
MOZ_ASSERT(IsIonEnabled());
|
||||
MOZ_ASSERT(IsIonEnabled(cx));
|
||||
MOZ_ASSERT(frame->debugFrameSize() == frameSize);
|
||||
|
||||
RootedScript script(cx, frame->script());
|
||||
|
|
|
@ -274,6 +274,11 @@ size_t SizeOfIonData(JSScript* script, mozilla::MallocSizeOf mallocSizeOf);
|
|||
bool JitSupportsSimd();
|
||||
bool JitSupportsAtomics();
|
||||
|
||||
inline bool IsIonEnabled(JSContext* cx) {
|
||||
return IsBaselineJitEnabled() && JitOptions.ion &&
|
||||
!cx->options().disableIon();
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
|
|
@ -4537,7 +4537,7 @@ bool jit::AnalyzeNewScriptDefiniteProperties(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!jit::IsIonEnabled() || !jit::IsBaselineJitEnabled() ||
|
||||
if (!jit::IsIonEnabled(cx) || !jit::IsBaselineJitEnabled() ||
|
||||
!CanBaselineInterpretScript(script)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -4797,7 +4797,7 @@ bool jit::AnalyzeArgumentsUsage(JSContext* cx, JSScript* scriptArg) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!jit::IsIonEnabled()) {
|
||||
if (!jit::IsIonEnabled(cx)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ EnterJitStatus js::jit::MaybeEnterJit(JSContext* cx, RunState& state) {
|
|||
script->incWarmUpCounter();
|
||||
|
||||
// Try to Ion-compile.
|
||||
if (jit::IsIonEnabled()) {
|
||||
if (jit::IsIonEnabled(cx)) {
|
||||
jit::MethodStatus status = jit::CanEnterIon(cx, state);
|
||||
if (status == jit::Method_Error) {
|
||||
return EnterJitStatus::Error;
|
||||
|
|
|
@ -143,8 +143,6 @@ inline bool IsBaselineJitEnabled() {
|
|||
return IsBaselineInterpreterEnabled() && JitOptions.baselineJit;
|
||||
}
|
||||
|
||||
inline bool IsIonEnabled() { return IsBaselineJitEnabled() && JitOptions.ion; }
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
|
|
@ -1211,7 +1211,7 @@ bool RecompileImpl(JSContext* cx, bool force) {
|
|||
RootedScript script(cx, frame.script());
|
||||
MOZ_ASSERT(script->hasIonScript());
|
||||
|
||||
if (!IsIonEnabled()) {
|
||||
if (!IsIonEnabled(cx)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ bool testPreserveJitCode(bool preserveJitCode, unsigned remainingIonScripts) {
|
|||
|
||||
// The Ion JIT may be unavailable due to --disable-ion or lack of support
|
||||
// for this platform.
|
||||
if (!js::jit::IsIonEnabled()) {
|
||||
if (!js::jit::IsIonEnabled(cx)) {
|
||||
knownFail = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10408,6 +10408,10 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
|||
#endif
|
||||
.setAsyncStack(enableAsyncStacks);
|
||||
|
||||
if (op.getBoolOption("no-ion-for-main-context")) {
|
||||
JS::ContextOptionsRef(cx).setDisableIon();
|
||||
}
|
||||
|
||||
if (const char* str = op.getStringOption("cache-ir-stubs")) {
|
||||
if (strcmp(str, "on") == 0) {
|
||||
jit::JitOptions.disableCacheIR = false;
|
||||
|
@ -11133,6 +11137,8 @@ int main(int argc, char** argv, char** envp) {
|
|||
-1) ||
|
||||
!op.addBoolOption('\0', "ion", "Enable IonMonkey (default)") ||
|
||||
!op.addBoolOption('\0', "no-ion", "Disable IonMonkey") ||
|
||||
!op.addBoolOption('\0', "no-ion-for-main-context",
|
||||
"Disable IonMonkey for the main context only") ||
|
||||
!op.addBoolOption('\0', "no-asmjs", "Disable asm.js compilation") ||
|
||||
!op.addStringOption(
|
||||
'\0', "wasm-compiler", "[option]",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "nsJSUtils.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/CompilationAndEvaluation.h" // JS::Compile{,DontInflate}
|
||||
#include "js/ContextOptions.h"
|
||||
#include "js/PropertySpec.h"
|
||||
#include "js/SourceText.h" // JS::Source{Ownership,Text}
|
||||
#include "js/Utility.h"
|
||||
|
@ -579,6 +580,8 @@ class JSContextWrapper {
|
|||
JSContext* cx = JS_NewContext(JS::DefaultHeapMaxBytes + aExtraHeapSize);
|
||||
if (NS_WARN_IF(!cx)) return nullptr;
|
||||
|
||||
JS::ContextOptionsRef(cx).setDisableIon();
|
||||
|
||||
JSContextWrapper* entry = new JSContextWrapper(cx);
|
||||
if (NS_FAILED(entry->Init())) {
|
||||
delete entry;
|
||||
|
|
Загрузка…
Ссылка в новой задаче