author | Ted Campbell <tcampbell@mozilla.com> |
Tue, 29 Oct 2019 18:25:16 +0000 | |
changeset 499679 | 93cc053b18b91019ae88d76fbc12d90267911335 |
parent 499678 | a30412eb09b532e23e87458537af02322e81d0b3 |
child 499680 | a9d7651009089ec16b5fe2d978604994183c2d04 |
push id | 99134 |
push user | tcampbell@mozilla.com |
push date | Tue, 29 Oct 2019 18:36:57 +0000 |
treeherder | autoland@e53af14c6089 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jandem |
bugs | 1591747 |
milestone | 72.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -1331,19 +1331,21 @@ void EnvironmentIter::settle() { #ifdef DEBUG if (si_) { if (hasSyntacticEnvironment()) { Scope* scope = si_.scope(); if (scope->is<LexicalScope>()) { MOZ_ASSERT(scope == &env_->as<LexicalEnvironmentObject>().scope()); } else if (scope->is<FunctionScope>()) { - MOZ_ASSERT( - scope->as<FunctionScope>().script() == - env_->as<CallObject>().callee().existingScriptNonDelazifying()); + MOZ_ASSERT(scope->as<FunctionScope>().script() == + env_->as<CallObject>() + .callee() + .maybeCanonicalFunction() + ->nonLazyScript()); } else if (scope->is<VarScope>()) { MOZ_ASSERT(scope == &env_->as<VarEnvironmentObject>().scope()); } else if (scope->is<WithScope>()) { MOZ_ASSERT(scope == &env_->as<WithEnvironmentObject>().scope()); } else if (scope->is<EvalScope>()) { MOZ_ASSERT(scope == &env_->as<VarEnvironmentObject>().scope()); } else if (scope->is<GlobalScope>()) { MOZ_ASSERT(env_->is<GlobalObject>() ||
--- a/js/src/vm/JSFunction.h +++ b/js/src/vm/JSFunction.h @@ -666,58 +666,38 @@ class JSFunction : public js::NativeObje // source, or nullptr if the function is a clone of a self hosted function. // // There are several methods to get the script of an interpreted function: // // - For all interpreted functions, getOrCreateScript() will get the // JSScript, delazifying the function if necessary. This is the safest to // use, but has extra checks, requires a cx and may trigger a GC. // - // - For inlined functions which may have a LazyScript but whose JSScript - // is known to exist, existingScript() will get the script and delazify - // the function if necessary. If the function should not be delazified, - // use existingScriptNonDelazifying(). - // // - For functions known to have a JSScript, nonLazyScript() will get it. static JSScript* getOrCreateScript(JSContext* cx, js::HandleFunction fun) { MOZ_ASSERT(fun->isInterpreted()); MOZ_ASSERT(cx); if (fun->isInterpretedLazy()) { if (!delazifyLazilyInterpretedFunction(cx, fun)) { return nullptr; } return fun->nonLazyScript(); } return fun->nonLazyScript(); } - JSScript* existingScriptNonDelazifying() const { - MOZ_ASSERT(isInterpreted()); - if (isInterpretedLazy()) { - // Get the script from the canonical function. Ion used the - // canonical function to inline the script and because it has - // Baseline code it has not been relazified. Note that we can't - // use lazyScript->script_ here as it may be null in some cases, - // see bug 976536. - js::LazyScript* lazy = lazyScript(); - JSFunction* fun = lazy->function(); - MOZ_ASSERT(fun); - return fun->nonLazyScript(); - } - return nonLazyScript(); - } - JSScript* existingScript() { MOZ_ASSERT(isInterpreted()); if (isInterpretedLazy()) { if (shadowZone()->needsIncrementalBarrier()) { js::LazyScript::writeBarrierPre(lazyScript()); } - JSScript* script = existingScriptNonDelazifying(); + JSFunction* canonicalFunction = lazyScript()->function(); + JSScript* script = canonicalFunction->nonLazyScript(); flags_.clearInterpretedLazy(); flags_.setInterpreted(); initScript(script); } return nonLazyScript(); } // If this is a scripted function, returns its canonical function (the
--- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -100,19 +100,21 @@ static inline void AssertScopeMatchesEnv (env->is<LexicalEnvironmentObject>() && !env->as<LexicalEnvironmentObject>().isSyntactic())) { MOZ_ASSERT(!IsSyntacticEnvironment(env)); env = &env->as<EnvironmentObject>().enclosingEnvironment(); } } else if (si.hasSyntacticEnvironment()) { switch (si.kind()) { case ScopeKind::Function: - MOZ_ASSERT( - env->as<CallObject>().callee().existingScriptNonDelazifying() == - si.scope()->as<FunctionScope>().script()); + MOZ_ASSERT(env->as<CallObject>() + .callee() + .maybeCanonicalFunction() + ->nonLazyScript() == + si.scope()->as<FunctionScope>().script()); env = &env->as<CallObject>().enclosingEnvironment(); break; case ScopeKind::FunctionBodyVar: case ScopeKind::ParameterExpressionVar: MOZ_ASSERT(&env->as<VarEnvironmentObject>().scope() == si.scope()); env = &env->as<VarEnvironmentObject>().enclosingEnvironment(); break;