зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1604288 - Use JSFunction::baseScript() instead of lazyScript/nonLazyScript. r=mgaudet
Once JSScript and LazyScript are unified, the lazyScript() accessor will be removed. Also avoid using nonLazyScript() when it is not necessary. A few calls to isInterpretedLazy() are removed for same reasons. Differential Revision: https://phabricator.services.mozilla.com/D57367 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1d7592ffa9
Коммит
25ee2a6dae
|
@ -2559,8 +2559,8 @@ ResumeMode DebugAPI::onSingleStep(JSContext* cx, MutableHandleValue vp) {
|
|||
// it had better be suspended.
|
||||
MOZ_ASSERT(genObj.isSuspended());
|
||||
|
||||
if (!genObj.callee().isInterpretedLazy() &&
|
||||
genObj.callee().nonLazyScript() == trappingScript &&
|
||||
if (genObj.callee().hasScript() &&
|
||||
genObj.callee().baseScript() == trappingScript &&
|
||||
!frameObj.getReservedSlot(DebuggerFrame::ONSTEP_HANDLER_SLOT)
|
||||
.isUndefined()) {
|
||||
suspendedStepperCount++;
|
||||
|
|
|
@ -2176,7 +2176,7 @@ JSFunction* AllocNewFunction(JSContext* cx,
|
|||
}
|
||||
if (data.isSelfHosting) {
|
||||
fun->setIsSelfHostedBuiltin();
|
||||
MOZ_ASSERT(!fun->isInterpretedLazy());
|
||||
MOZ_ASSERT(fun->hasScript());
|
||||
}
|
||||
return fun;
|
||||
}
|
||||
|
@ -2610,7 +2610,7 @@ bool Parser<FullParseHandler, Unit>::skipLazyInnerFunction(
|
|||
}
|
||||
|
||||
funbox->initFromLazyFunction(fun);
|
||||
MOZ_ASSERT(fun->lazyScript()->hasEnclosingLazyScript());
|
||||
MOZ_ASSERT(fun->baseScript()->hasEnclosingLazyScript());
|
||||
|
||||
PropagateTransitiveParseFlags(funbox, pc_->sc());
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ class CompileInfo {
|
|||
// jit-code. Precisely because it can flow in from anywhere, it's not
|
||||
// guaranteed to be non-lazy. Hence, don't access its script!
|
||||
if (fun_) {
|
||||
fun_ = fun_->nonLazyScript()->function();
|
||||
fun_ = fun_->baseScript()->function();
|
||||
MOZ_ASSERT(fun_->isTenured());
|
||||
}
|
||||
|
||||
|
|
|
@ -1340,7 +1340,7 @@ void EnvironmentIter::settle() {
|
|||
env_->as<CallObject>()
|
||||
.callee()
|
||||
.maybeCanonicalFunction()
|
||||
->nonLazyScript());
|
||||
->baseScript());
|
||||
} else if (scope->is<VarScope>()) {
|
||||
MOZ_ASSERT(scope == &env_->as<VarEnvironmentObject>().scope());
|
||||
} else if (scope->is<WithScope>()) {
|
||||
|
@ -1832,7 +1832,7 @@ class DebugEnvironmentProxyHandler : public BaseProxyHandler {
|
|||
return isFunctionEnvironmentWithThis(env) &&
|
||||
!env.as<CallObject>()
|
||||
.callee()
|
||||
.nonLazyScript()
|
||||
.baseScript()
|
||||
->functionHasThisBinding();
|
||||
}
|
||||
|
||||
|
|
|
@ -634,9 +634,9 @@ XDRResult js::XDRInterpretedFunction(XDRState<mode>* xdr,
|
|||
fun->setFlags(uint16_t(flagsword));
|
||||
fun->initAtom(atom);
|
||||
if (firstword & IsLazy) {
|
||||
MOZ_ASSERT(fun->lazyScript() == lazy);
|
||||
MOZ_ASSERT(fun->baseScript() == lazy);
|
||||
} else {
|
||||
MOZ_ASSERT(fun->nonLazyScript() == script);
|
||||
MOZ_ASSERT(fun->baseScript() == script);
|
||||
MOZ_ASSERT(fun->nargs() == script->numArgs());
|
||||
}
|
||||
|
||||
|
@ -1550,7 +1550,7 @@ static bool DelazifyCanonicalScriptedFunction(JSContext* cx,
|
|||
if (!frontend::CompileLazyBinASTFunction(
|
||||
cx, lazy, ss->binASTSource() + sourceStart, sourceLength)) {
|
||||
MOZ_ASSERT(fun->isInterpretedLazy());
|
||||
MOZ_ASSERT(fun->lazyScript() == lazy);
|
||||
MOZ_ASSERT(fun->baseScript() == lazy);
|
||||
MOZ_ASSERT(!lazy->hasScript());
|
||||
return false;
|
||||
}
|
||||
|
@ -1575,7 +1575,7 @@ static bool DelazifyCanonicalScriptedFunction(JSContext* cx,
|
|||
// The frontend shouldn't fail after linking the function and the
|
||||
// non-lazy script together.
|
||||
MOZ_ASSERT(fun->isInterpretedLazy());
|
||||
MOZ_ASSERT(fun->lazyScript() == lazy);
|
||||
MOZ_ASSERT(fun->baseScript() == lazy);
|
||||
MOZ_ASSERT(!lazy->hasScript());
|
||||
return false;
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ static bool DelazifyCanonicalScriptedFunction(JSContext* cx,
|
|||
// The frontend shouldn't fail after linking the function and the
|
||||
// non-lazy script together.
|
||||
MOZ_ASSERT(fun->isInterpretedLazy());
|
||||
MOZ_ASSERT(fun->lazyScript() == lazy);
|
||||
MOZ_ASSERT(fun->baseScript() == lazy);
|
||||
MOZ_ASSERT(!lazy->hasScript());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ class JSFunction : public js::NativeObject {
|
|||
// FunctionBox::needsCallObjectRegardlessOfBindings().
|
||||
MOZ_ASSERT_IF(baseScript()->funHasExtensibleScope() ||
|
||||
baseScript()->needsHomeObject() ||
|
||||
nonLazyScript()->isDerivedClassConstructor() ||
|
||||
baseScript()->isDerivedClassConstructor() ||
|
||||
isGenerator() || isAsync(),
|
||||
nonLazyScript()->bodyScope()->hasEnvironment());
|
||||
|
||||
|
@ -503,7 +503,7 @@ class JSFunction : public js::NativeObject {
|
|||
return false;
|
||||
}
|
||||
|
||||
return nonLazyScript()->hasJitScript();
|
||||
return baseScript()->hasJitScript();
|
||||
}
|
||||
bool hasJitEntry() const {
|
||||
return hasScript() || isInterpretedLazy() || isNativeWithJitEntry();
|
||||
|
|
|
@ -4997,7 +4997,7 @@ static JSObject* CloneScriptObject(JSContext* cx, PrivateScriptData* srcData,
|
|||
}
|
||||
}
|
||||
|
||||
Scope* enclosing = innerFun->nonLazyScript()->enclosingScope();
|
||||
Scope* enclosing = innerFun->enclosingScope();
|
||||
uint32_t scopeIndex = FindScopeIndex(srcData->gcthings(), *enclosing);
|
||||
RootedScope enclosingClone(cx, &gcThings[scopeIndex].get().as<Scope>());
|
||||
return CloneInnerInterpretedFunction(cx, enclosingClone, innerFun,
|
||||
|
|
|
@ -3099,8 +3099,7 @@ bool JSRuntime::cloneSelfHostedFunctionScript(JSContext* cx,
|
|||
// make sure there aren't any.
|
||||
MOZ_ASSERT(!sourceFun->isGenerator() && !sourceFun->isAsync());
|
||||
MOZ_ASSERT(targetFun->isExtended());
|
||||
MOZ_ASSERT(targetFun->isInterpretedLazy());
|
||||
MOZ_ASSERT(targetFun->isSelfHostedBuiltin());
|
||||
MOZ_ASSERT(targetFun->hasSelfHostedLazyScript());
|
||||
|
||||
RootedScript sourceScript(cx, JSFunction::getOrCreateScript(cx, sourceFun));
|
||||
if (!sourceScript) {
|
||||
|
@ -3125,7 +3124,7 @@ bool JSRuntime::cloneSelfHostedFunctionScript(JSContext* cx,
|
|||
sourceObject)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!targetFun->isInterpretedLazy());
|
||||
MOZ_ASSERT(targetFun->hasScript());
|
||||
|
||||
MOZ_ASSERT(sourceFun->nargs() == targetFun->nargs());
|
||||
MOZ_ASSERT(sourceScript->hasRest() == targetFun->baseScript()->hasRest());
|
||||
|
|
|
@ -47,7 +47,7 @@ inline void InterpreterFrame::initCallFrame(InterpreterFrame* prev,
|
|||
JSScript* script, Value* argv,
|
||||
uint32_t nactual,
|
||||
MaybeConstruct constructing) {
|
||||
MOZ_ASSERT(callee.nonLazyScript() == script);
|
||||
MOZ_ASSERT(callee.baseScript() == script);
|
||||
|
||||
/* Initialize stack frame members. */
|
||||
flags_ = 0;
|
||||
|
@ -219,7 +219,7 @@ MOZ_ALWAYS_INLINE InterpreterFrame* InterpreterStack::getCallFrame(
|
|||
MaybeConstruct constructing, Value** pargv) {
|
||||
JSFunction* fun = &args.callee().as<JSFunction>();
|
||||
|
||||
MOZ_ASSERT(fun->nonLazyScript() == script);
|
||||
MOZ_ASSERT(fun->baseScript() == script);
|
||||
unsigned nformal = fun->nargs();
|
||||
unsigned nvals = script->nslots();
|
||||
|
||||
|
@ -261,7 +261,7 @@ MOZ_ALWAYS_INLINE bool InterpreterStack::pushInlineFrame(
|
|||
HandleScript script, MaybeConstruct constructing) {
|
||||
RootedFunction callee(cx, &args.callee().as<JSFunction>());
|
||||
MOZ_ASSERT(regs.sp == args.end());
|
||||
MOZ_ASSERT(callee->nonLazyScript() == script);
|
||||
MOZ_ASSERT(callee->baseScript() == script);
|
||||
|
||||
InterpreterFrame* prev = regs.fp();
|
||||
jsbytecode* prevpc = regs.pc;
|
||||
|
|
|
@ -291,10 +291,10 @@ XDRResult XDRState<mode>::codeFunction(MutableHandleFunction funp,
|
|||
funp.set(nullptr);
|
||||
} else if (getTreeKey(funp) != AutoXDRTree::noKey) {
|
||||
MOZ_ASSERT(sourceObject);
|
||||
scope = funp->nonLazyScript()->enclosingScope();
|
||||
scope = funp->enclosingScope();
|
||||
} else {
|
||||
MOZ_ASSERT(!sourceObject);
|
||||
MOZ_ASSERT(funp->nonLazyScript()->enclosingScope()->is<GlobalScope>());
|
||||
MOZ_ASSERT(funp->enclosingScope()->is<GlobalScope>());
|
||||
}
|
||||
|
||||
MOZ_TRY(VersionCheck(this));
|
||||
|
|
Загрузка…
Ссылка в новой задаче