зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1199165 - Rename isHeavyweight to needsCallObject. r=shu
This commit is contained in:
Родитель
8acc0315a3
Коммит
7a34829178
|
@ -1808,7 +1808,7 @@ BytecodeEmitter::bindNameToSlotHelper(ParseNode* pn)
|
|||
MOZ_ASSERT(pn->pn_atom == fun->atom());
|
||||
|
||||
/*
|
||||
* Leave pn->isOp(JSOP_GETNAME) if this->fun is heavyweight to
|
||||
* Leave pn->isOp(JSOP_GETNAME) if this->fun needs a CallObject to
|
||||
* address two cases: a new binding introduced by eval, and
|
||||
* assignment to the name in strict mode.
|
||||
*
|
||||
|
@ -1828,10 +1828,10 @@ BytecodeEmitter::bindNameToSlotHelper(ParseNode* pn)
|
|||
* has no effect. But in strict mode, this attempt to mutate an
|
||||
* immutable binding must throw a TypeError. We implement this by
|
||||
* not optimizing such assignments and by marking such functions as
|
||||
* heavyweight, ensuring that the function name is represented in
|
||||
* needsCallObject, ensuring that the function name is represented in
|
||||
* the scope chain so that assignment will throw a TypeError.
|
||||
*/
|
||||
if (!sc->asFunctionBox()->isHeavyweight()) {
|
||||
if (!sc->asFunctionBox()->needsCallObject()) {
|
||||
op = JSOP_CALLEE;
|
||||
pn->pn_dflags |= PND_CONST;
|
||||
}
|
||||
|
@ -3599,7 +3599,7 @@ BytecodeEmitter::maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* resu
|
|||
}
|
||||
|
||||
if (JOF_OPTYPE(pn->getOp()) == JOF_ATOM &&
|
||||
(!sc->isFunctionBox() || sc->asFunctionBox()->isHeavyweight()))
|
||||
(!sc->isFunctionBox() || sc->asFunctionBox()->needsCallObject()))
|
||||
{
|
||||
switchToPrologue();
|
||||
if (!updateSourceCoordNotes(pn->pn_pos.begin))
|
||||
|
|
|
@ -8358,7 +8358,7 @@ Parser<ParseHandler>::memberExpr(YieldHandling yieldHandling, TokenKind tt, bool
|
|||
JSOp op = JSOP_CALL;
|
||||
if (PropertyName* name = handler.maybeNameAnyParentheses(lhs)) {
|
||||
if (tt == TOK_LP && name == context->names().eval) {
|
||||
/* Select JSOP_EVAL and flag pc as heavyweight. */
|
||||
/* Select JSOP_EVAL and flag pc as needsCallObject. */
|
||||
op = pc->sc->strict() ? JSOP_STRICTEVAL : JSOP_EVAL;
|
||||
pc->sc->setBindingsAccessedDynamically();
|
||||
pc->sc->setHasDirectEval();
|
||||
|
|
|
@ -362,9 +362,9 @@ class FunctionBox : public ObjectBox, public SharedContext
|
|||
startColumn = tokenStream.getColumn();
|
||||
}
|
||||
|
||||
bool isHeavyweight()
|
||||
bool needsCallObject()
|
||||
{
|
||||
// Note: this should be kept in sync with JSFunction::isHeavyweight().
|
||||
// Note: this should be kept in sync with JSFunction::needsCallObject().
|
||||
return bindings.hasAnyAliasedBindings() ||
|
||||
hasExtensibleScope() ||
|
||||
needsDeclEnvObject() ||
|
||||
|
|
|
@ -253,7 +253,7 @@ bool
|
|||
jit::EnsureHasScopeObjects(JSContext* cx, AbstractFramePtr fp)
|
||||
{
|
||||
if (fp.isFunctionFrame() &&
|
||||
fp.fun()->isHeavyweight() &&
|
||||
fp.fun()->needsCallObject() &&
|
||||
!fp.hasCallObj())
|
||||
{
|
||||
return fp.initFunctionScopeObjects(cx);
|
||||
|
|
|
@ -685,7 +685,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
|||
Value v = iter.read();
|
||||
if (v.isObject()) {
|
||||
scopeChain = &v.toObject();
|
||||
if (fun && fun->isHeavyweight())
|
||||
if (fun && fun->needsCallObject())
|
||||
flags |= BaselineFrame::HAS_CALL_OBJ;
|
||||
} else {
|
||||
MOZ_ASSERT(v.isUndefined() || v.isMagic(JS_OPTIMIZED_OUT));
|
||||
|
|
|
@ -123,7 +123,7 @@ BaselineCompiler::compile()
|
|||
JSObject* templateScope = nullptr;
|
||||
if (script->functionNonDelazifying()) {
|
||||
RootedFunction fun(cx, script->functionNonDelazifying());
|
||||
if (fun->isHeavyweight()) {
|
||||
if (fun->needsCallObject()) {
|
||||
RootedScript scriptRoot(cx, script);
|
||||
templateScope = CallObject::createTemplateObject(cx, scriptRoot, gc::TenuredHeap);
|
||||
if (!templateScope)
|
||||
|
@ -630,13 +630,13 @@ BaselineCompiler::emitDebugPrologue()
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef bool (*StrictEvalPrologueFn)(JSContext*, BaselineFrame*);
|
||||
static const VMFunction StrictEvalPrologueInfo =
|
||||
FunctionInfo<StrictEvalPrologueFn>(jit::StrictEvalPrologue);
|
||||
typedef bool (*InitStrictEvalScopeObjectsFn)(JSContext*, BaselineFrame*);
|
||||
static const VMFunction InitStrictEvalScopeObjectsInfo =
|
||||
FunctionInfo<InitStrictEvalScopeObjectsFn>(jit::InitStrictEvalScopeObjects);
|
||||
|
||||
typedef bool (*HeavyweightFunPrologueFn)(JSContext*, BaselineFrame*);
|
||||
static const VMFunction HeavyweightFunPrologueInfo =
|
||||
FunctionInfo<HeavyweightFunPrologueFn>(jit::HeavyweightFunPrologue);
|
||||
typedef bool (*InitFunctionScopeObjectsFn)(JSContext*, BaselineFrame*);
|
||||
static const VMFunction InitFunctionScopeObjectsInfo =
|
||||
FunctionInfo<InitFunctionScopeObjectsFn>(jit::InitFunctionScopeObjects);
|
||||
|
||||
bool
|
||||
BaselineCompiler::initScopeChain()
|
||||
|
@ -648,7 +648,7 @@ BaselineCompiler::initScopeChain()
|
|||
RootedFunction fun(cx, function());
|
||||
if (fun) {
|
||||
// Use callee->environment as scope chain. Note that we do
|
||||
// this also for heavy-weight functions, so that the scope
|
||||
// this also for needsCallObject functions, so that the scope
|
||||
// chain slot is properly initialized if the call triggers GC.
|
||||
Register callee = R0.scratchReg();
|
||||
Register scope = R1.scratchReg();
|
||||
|
@ -656,14 +656,14 @@ BaselineCompiler::initScopeChain()
|
|||
masm.loadPtr(Address(callee, JSFunction::offsetOfEnvironment()), scope);
|
||||
masm.storePtr(scope, frame.addressOfScopeChain());
|
||||
|
||||
if (fun->isHeavyweight()) {
|
||||
if (fun->needsCallObject()) {
|
||||
// Call into the VM to create a new call object.
|
||||
prepareVMCall();
|
||||
|
||||
masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg());
|
||||
pushArg(R0.scratchReg());
|
||||
|
||||
if (!callVMNonOp(HeavyweightFunPrologueInfo, phase))
|
||||
if (!callVMNonOp(InitFunctionScopeObjectsInfo, phase))
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -677,7 +677,7 @@ BaselineCompiler::initScopeChain()
|
|||
masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg());
|
||||
pushArg(R0.scratchReg());
|
||||
|
||||
if (!callVMNonOp(StrictEvalPrologueInfo, phase))
|
||||
if (!callVMNonOp(InitStrictEvalScopeObjectsInfo, phase))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ inline CallObject&
|
|||
BaselineFrame::callObj() const
|
||||
{
|
||||
MOZ_ASSERT(hasCallObj());
|
||||
MOZ_ASSERT(fun()->isHeavyweight());
|
||||
MOZ_ASSERT(fun()->needsCallObject());
|
||||
|
||||
JSObject* obj = scopeChain();
|
||||
while (!obj->is<CallObject>())
|
||||
|
|
|
@ -109,7 +109,7 @@ BaselineFrame::copyRawFrameSlots(AutoValueVector* vec) const
|
|||
}
|
||||
|
||||
bool
|
||||
BaselineFrame::strictEvalPrologue(JSContext* cx)
|
||||
BaselineFrame::initStrictEvalScopeObjects(JSContext* cx)
|
||||
{
|
||||
MOZ_ASSERT(isStrictEvalFrame());
|
||||
|
||||
|
@ -122,17 +122,11 @@ BaselineFrame::strictEvalPrologue(JSContext* cx)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BaselineFrame::heavyweightFunPrologue(JSContext* cx)
|
||||
{
|
||||
return initFunctionScopeObjects(cx);
|
||||
}
|
||||
|
||||
bool
|
||||
BaselineFrame::initFunctionScopeObjects(JSContext* cx)
|
||||
{
|
||||
MOZ_ASSERT(isNonEvalFunctionFrame());
|
||||
MOZ_ASSERT(fun()->isHeavyweight());
|
||||
MOZ_ASSERT(fun()->needsCallObject());
|
||||
|
||||
CallObject* callobj = CallObject::createForFunction(cx, this);
|
||||
if (!callobj)
|
||||
|
|
|
@ -279,8 +279,7 @@ class BaselineFrame
|
|||
inline void popBlock(JSContext* cx);
|
||||
inline bool freshenBlock(JSContext* cx);
|
||||
|
||||
bool strictEvalPrologue(JSContext* cx);
|
||||
bool heavyweightFunPrologue(JSContext* cx);
|
||||
bool initStrictEvalScopeObjects(JSContext* cx);
|
||||
bool initFunctionScopeObjects(JSContext* cx);
|
||||
|
||||
void initArgsObjUnchecked(ArgumentsObject& argsobj) {
|
||||
|
|
|
@ -121,8 +121,9 @@ struct BaselineScript
|
|||
// Code pointer containing the actual method.
|
||||
RelocatablePtrJitCode method_;
|
||||
|
||||
// For heavyweight scripts, template objects to use for the call object and
|
||||
// decl env object (linked via the call object's enclosing scope).
|
||||
// For functions with a call object, template objects to use for the call
|
||||
// object and decl env object (linked via the call object's enclosing
|
||||
// scope).
|
||||
RelocatablePtrObject templateScope_;
|
||||
|
||||
// Allocated space for fallback stubs.
|
||||
|
|
|
@ -46,9 +46,10 @@ BytecodeAnalysis::init(TempAllocator& alloc, GSNCache& gsn)
|
|||
if (!infos_.growByUninitialized(script_->length()))
|
||||
return false;
|
||||
|
||||
// We need a scope chain if the function is heavyweight.
|
||||
// Initialize the scope chain slot if either the function needs a CallObject
|
||||
// or the script uses the scope chain. The latter case is handled below.
|
||||
usesScopeChain_ = (script_->functionDelazifying() &&
|
||||
script_->functionDelazifying()->isHeavyweight());
|
||||
script_->functionDelazifying()->needsCallObject());
|
||||
MOZ_ASSERT_IF(script_->hasAnyAliasedBindings(), usesScopeChain_);
|
||||
|
||||
jsbytecode* end = script_->codeEnd();
|
||||
|
|
|
@ -493,7 +493,7 @@ class CompileInfo
|
|||
if (slot == thisSlot())
|
||||
return true;
|
||||
|
||||
if (funMaybeLazy()->isHeavyweight() && slot == scopeChainSlot())
|
||||
if (funMaybeLazy()->needsCallObject() && slot == scopeChainSlot())
|
||||
return true;
|
||||
|
||||
// If the function may need an arguments object, then make sure to
|
||||
|
|
|
@ -1218,7 +1218,7 @@ IonBuilder::initScopeChain(MDefinition* callee)
|
|||
// This reproduce what is done in CallObject::createForFunction. Skip
|
||||
// this for analyses, as the script might not have a baseline script
|
||||
// with template objects yet.
|
||||
if (fun->isHeavyweight() && !info().isAnalysis()) {
|
||||
if (fun->needsCallObject() && !info().isAnalysis()) {
|
||||
if (fun->isNamedLambda()) {
|
||||
scope = createDeclEnvObject(callee, scope);
|
||||
if (!scope)
|
||||
|
|
|
@ -2531,19 +2531,19 @@ InlineFrameIterator::computeScopeChain(Value scopeChainValue, MaybeReadFallback&
|
|||
if (hasCallObj) {
|
||||
if (fallback.canRecoverResults()) {
|
||||
RootedObject obj(fallback.maybeCx, &scopeChainValue.toObject());
|
||||
*hasCallObj = isFunctionFrame() && callee(fallback)->isHeavyweight();
|
||||
*hasCallObj = isFunctionFrame() && callee(fallback)->needsCallObject();
|
||||
return obj;
|
||||
} else {
|
||||
JS::AutoSuppressGCAnalysis nogc; // If we cannot recover then we cannot GC.
|
||||
*hasCallObj = isFunctionFrame() && callee(fallback)->isHeavyweight();
|
||||
*hasCallObj = isFunctionFrame() && callee(fallback)->needsCallObject();
|
||||
}
|
||||
}
|
||||
|
||||
return &scopeChainValue.toObject();
|
||||
}
|
||||
|
||||
// Note we can hit this case even for heavyweight functions, in case we
|
||||
// are walking the frame during the function prologue, before the scope
|
||||
// Note we can hit this case even for functions with a CallObject, in case
|
||||
// we are walking the frame during the function prologue, before the scope
|
||||
// chain has been initialized.
|
||||
if (isFunctionFrame())
|
||||
return callee(fallback)->environment();
|
||||
|
|
|
@ -605,8 +605,9 @@ MBasicBlock::linkOsrValues(MStart* start)
|
|||
MOZ_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() ||
|
||||
def->isParameter());
|
||||
|
||||
// A constant Undefined can show up here for an argument slot when the function uses
|
||||
// a heavyweight argsobj, but the argument in question is stored on the scope chain.
|
||||
// A constant Undefined can show up here for an argument slot when
|
||||
// the function has an arguments object, but the argument in
|
||||
// question is stored on the scope chain.
|
||||
MOZ_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue());
|
||||
|
||||
if (def->isOsrValue())
|
||||
|
|
|
@ -143,7 +143,7 @@ bool
|
|||
RematerializedFrame::initFunctionScopeObjects(JSContext* cx)
|
||||
{
|
||||
MOZ_ASSERT(isNonEvalFunctionFrame());
|
||||
MOZ_ASSERT(fun()->isHeavyweight());
|
||||
MOZ_ASSERT(fun()->needsCallObject());
|
||||
CallObject* callobj = CallObject::createForFunction(cx, this);
|
||||
if (!callobj)
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,7 @@ class RematerializedFrame
|
|||
bool initFunctionScopeObjects(JSContext* cx);
|
||||
|
||||
bool hasCallObj() const {
|
||||
MOZ_ASSERT(fun()->isHeavyweight());
|
||||
MOZ_ASSERT(fun()->needsCallObject());
|
||||
return hasCallObj_;
|
||||
}
|
||||
CallObject& callObj() const;
|
||||
|
|
|
@ -835,15 +835,15 @@ GeneratorThrowOrClose(JSContext* cx, BaselineFrame* frame, Handle<GeneratorObjec
|
|||
}
|
||||
|
||||
bool
|
||||
StrictEvalPrologue(JSContext* cx, BaselineFrame* frame)
|
||||
InitStrictEvalScopeObjects(JSContext* cx, BaselineFrame* frame)
|
||||
{
|
||||
return frame->strictEvalPrologue(cx);
|
||||
return frame->initStrictEvalScopeObjects(cx);
|
||||
}
|
||||
|
||||
bool
|
||||
HeavyweightFunPrologue(JSContext* cx, BaselineFrame* frame)
|
||||
InitFunctionScopeObjects(JSContext* cx, BaselineFrame* frame)
|
||||
{
|
||||
return frame->heavyweightFunPrologue(cx);
|
||||
return frame->initFunctionScopeObjects(cx);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -657,8 +657,8 @@ bool DebugAfterYield(JSContext* cx, BaselineFrame* frame);
|
|||
bool GeneratorThrowOrClose(JSContext* cx, BaselineFrame* frame, Handle<GeneratorObject*> genObj,
|
||||
HandleValue arg, uint32_t resumeKind);
|
||||
|
||||
bool StrictEvalPrologue(JSContext* cx, BaselineFrame* frame);
|
||||
bool HeavyweightFunPrologue(JSContext* cx, BaselineFrame* frame);
|
||||
bool InitStrictEvalScopeObjects(JSContext* cx, BaselineFrame* frame);
|
||||
bool InitFunctionScopeObjects(JSContext* cx, BaselineFrame* frame);
|
||||
|
||||
bool NewArgumentsObject(JSContext* cx, BaselineFrame* frame, MutableHandleValue res);
|
||||
|
||||
|
|
|
@ -1336,7 +1336,7 @@ JSFunction::createScriptForLazilyInterpretedFunction(JSContext* cx, HandleFuncti
|
|||
// re-lazified. Functions with either of those are on the static scope
|
||||
// chain of their inner functions, or in the case of eval, possibly
|
||||
// eval'd inner functions. This prohibits re-lazification as
|
||||
// StaticScopeIter queries isHeavyweight of those functions, which
|
||||
// StaticScopeIter queries needsCallObject of those functions, which
|
||||
// requires a non-lazy script. Note that if this ever changes,
|
||||
// XDRRelazificationInfo will have to be fixed.
|
||||
bool canRelazify = !lazy->numInnerFunctions() && !lazy->hasDirectEval();
|
||||
|
|
|
@ -143,15 +143,15 @@ class JSFunction : public js::NativeObject
|
|||
|
||||
public:
|
||||
|
||||
/* Call objects must be created for each invocation of a heavyweight function. */
|
||||
bool isHeavyweight() const {
|
||||
/* Call objects must be created for each invocation of this function. */
|
||||
bool needsCallObject() const {
|
||||
MOZ_ASSERT(!isInterpretedLazy());
|
||||
MOZ_ASSERT(!isBeingParsed());
|
||||
|
||||
if (isNative())
|
||||
return false;
|
||||
|
||||
// Note: this should be kept in sync with FunctionBox::isHeavyweight().
|
||||
// Note: this should be kept in sync with FunctionBox::needsCallObject().
|
||||
return nonLazyScript()->hasAnyAliasedBindings() ||
|
||||
nonLazyScript()->funHasExtensibleScope() ||
|
||||
nonLazyScript()->funNeedsDeclEnvObject() ||
|
||||
|
|
|
@ -3486,10 +3486,10 @@ LambdaIsGetElem(JSContext* cx, JSObject& lambda, MutableHandleNativeObject pobj)
|
|||
|
||||
/*
|
||||
* JSOP_GETALIASEDVAR tells us exactly where to find the base object 'b'.
|
||||
* Rule out the (unlikely) possibility of a heavyweight function since it
|
||||
* would make our scope walk off by 1.
|
||||
* Rule out the (unlikely) possibility of a function with a call object
|
||||
* since it would make our scope walk off by 1.
|
||||
*/
|
||||
if (JSOp(*pc) != JSOP_GETALIASEDVAR || fun->isHeavyweight())
|
||||
if (JSOp(*pc) != JSOP_GETALIASEDVAR || fun->needsCallObject())
|
||||
return true;
|
||||
ScopeCoordinate sc(pc);
|
||||
ScopeObject* scope = &fun->environment()->as<ScopeObject>();
|
||||
|
|
|
@ -1974,8 +1974,8 @@ DisassembleScript(JSContext* cx, HandleScript script, HandleFunction fun, bool l
|
|||
Sprint(sp, "flags:");
|
||||
if (fun->isLambda())
|
||||
Sprint(sp, " LAMBDA");
|
||||
if (fun->isHeavyweight())
|
||||
Sprint(sp, " HEAVYWEIGHT");
|
||||
if (fun->needsCallObject())
|
||||
Sprint(sp, " NEEDS_CALLOBJECT");
|
||||
if (fun->isConstructor())
|
||||
Sprint(sp, " CONSTRUCTOR");
|
||||
if (fun->isExprBody())
|
||||
|
|
|
@ -39,7 +39,7 @@ ArgumentsObject::MaybeForwardToCallObject(AbstractFramePtr frame, ArgumentsObjec
|
|||
ArgumentsData* data)
|
||||
{
|
||||
JSScript* script = frame.script();
|
||||
if (frame.fun()->isHeavyweight() && script->argsObjAliasesFormals()) {
|
||||
if (frame.fun()->needsCallObject() && script->argsObjAliasesFormals()) {
|
||||
obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(frame.callObj()));
|
||||
for (AliasedFormalIter fi(script); fi; fi++)
|
||||
data->args[fi.frameIndex()] = MagicScopeSlotValue(fi.scopeSlot());
|
||||
|
@ -52,7 +52,7 @@ ArgumentsObject::MaybeForwardToCallObject(jit::JitFrameLayout* frame, HandleObje
|
|||
{
|
||||
JSFunction* callee = jit::CalleeTokenToFunction(frame->calleeToken());
|
||||
JSScript* script = callee->nonLazyScript();
|
||||
if (callee->isHeavyweight() && script->argsObjAliasesFormals()) {
|
||||
if (callee->needsCallObject() && script->argsObjAliasesFormals()) {
|
||||
MOZ_ASSERT(callObj && callObj->is<CallObject>());
|
||||
obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(*callObj.get()));
|
||||
for (AliasedFormalIter fi(script); fi; fi++)
|
||||
|
|
|
@ -103,8 +103,8 @@ StaticScopeIter<allowGC>::hasSyntacticDynamicScopeObject() const
|
|||
if (obj->template is<JSFunction>()) {
|
||||
JSFunction& fun = obj->template as<JSFunction>();
|
||||
if (fun.isBeingParsed())
|
||||
return fun.functionBox()->isHeavyweight();
|
||||
return fun.isHeavyweight();
|
||||
return fun.functionBox()->needsCallObject();
|
||||
return fun.needsCallObject();
|
||||
}
|
||||
if (obj->template is<ModuleObject>())
|
||||
return true;
|
||||
|
|
|
@ -283,7 +283,7 @@ CallObject::createForStrictEval(JSContext* cx, AbstractFramePtr frame)
|
|||
CallObject*
|
||||
CallObject::createHollowForDebug(JSContext* cx, HandleFunction callee)
|
||||
{
|
||||
MOZ_ASSERT(!callee->isHeavyweight());
|
||||
MOZ_ASSERT(!callee->needsCallObject());
|
||||
|
||||
// This scope's parent link is never used: the DebugScopeObject that
|
||||
// refers to this scope carries its own parent link, which is what
|
||||
|
@ -1108,10 +1108,10 @@ ScopeIter::incrementStaticScopeIter()
|
|||
void
|
||||
ScopeIter::settle()
|
||||
{
|
||||
// Check for trying to iterate a heavyweight function frame before
|
||||
// the prologue has created the CallObject, in which case we have to skip.
|
||||
// Check for trying to iterate a function frame before the prologue has
|
||||
// created the CallObject, in which case we have to skip.
|
||||
if (frame_ && frame_.isNonEvalFunctionFrame() &&
|
||||
frame_.fun()->isHeavyweight() && !frame_.hasCallObj())
|
||||
frame_.fun()->needsCallObject() && !frame_.hasCallObj())
|
||||
{
|
||||
MOZ_ASSERT(ssi_.type() == StaticScopeIter<CanGC>::Function);
|
||||
incrementStaticScopeIter();
|
||||
|
@ -1884,7 +1884,7 @@ DebugScopeObject::isOptimizedOut() const
|
|||
|
||||
if (s.is<CallObject>()) {
|
||||
return !s.as<CallObject>().isForEval() &&
|
||||
!s.as<CallObject>().callee().isHeavyweight() &&
|
||||
!s.as<CallObject>().callee().needsCallObject() &&
|
||||
!maybeSnapshot();
|
||||
}
|
||||
|
||||
|
@ -2130,7 +2130,7 @@ DebugScopes::onPopCall(AbstractFramePtr frame, JSContext* cx)
|
|||
|
||||
Rooted<DebugScopeObject*> debugScope(cx, nullptr);
|
||||
|
||||
if (frame.fun()->isHeavyweight()) {
|
||||
if (frame.fun()->needsCallObject()) {
|
||||
/*
|
||||
* The frame may be observed before the prologue has created the
|
||||
* CallObject. See ScopeIter::settle.
|
||||
|
@ -2846,7 +2846,7 @@ js::AnalyzeEntrainedVariables(JSContext* cx, HandleScript script)
|
|||
if (!innerScript)
|
||||
return false;
|
||||
|
||||
if (script->functionDelazifying() && script->functionDelazifying()->isHeavyweight()) {
|
||||
if (script->functionDelazifying() && script->functionDelazifying()->needsCallObject()) {
|
||||
if (!AnalyzeEntrainedVariablesInScript(cx, script, innerScript))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ ScopeCoordinateFunctionScript(JSScript* script, jsbytecode* pc);
|
|||
* | | | |
|
||||
* | | | StaticEvalObject Placeholder so eval scopes may be iterated through
|
||||
* | | |
|
||||
* | | DeclEnvObject Holds name of recursive/heavyweight named lambda
|
||||
* | | DeclEnvObject Holds name of recursive/needsCallObject named lambda
|
||||
* | |
|
||||
* | CallObject Scope of entire function or strict eval
|
||||
* | |
|
||||
|
|
|
@ -219,14 +219,14 @@ InterpreterFrame::replaceInnermostScope(ScopeObject& scope)
|
|||
bool
|
||||
InterpreterFrame::hasCallObj() const
|
||||
{
|
||||
MOZ_ASSERT(isStrictEvalFrame() || fun()->isHeavyweight());
|
||||
MOZ_ASSERT(isStrictEvalFrame() || fun()->needsCallObject());
|
||||
return flags_ & HAS_CALL_OBJ;
|
||||
}
|
||||
|
||||
inline CallObject&
|
||||
InterpreterFrame::callObj() const
|
||||
{
|
||||
MOZ_ASSERT(fun()->isHeavyweight());
|
||||
MOZ_ASSERT(fun()->needsCallObject());
|
||||
|
||||
JSObject* pobj = scopeChain();
|
||||
while (MOZ_UNLIKELY(!pobj->is<CallObject>()))
|
||||
|
|
|
@ -225,7 +225,7 @@ InterpreterFrame::prologue(JSContext* cx)
|
|||
}
|
||||
|
||||
MOZ_ASSERT(isNonEvalFunctionFrame());
|
||||
if (fun()->isHeavyweight() && !initFunctionScopeObjects(cx))
|
||||
if (fun()->needsCallObject() && !initFunctionScopeObjects(cx))
|
||||
return false;
|
||||
|
||||
if (isConstructing() && functionThis().isPrimitive()) {
|
||||
|
@ -267,7 +267,7 @@ InterpreterFrame::epilogue(JSContext* cx)
|
|||
|
||||
MOZ_ASSERT(isNonEvalFunctionFrame());
|
||||
|
||||
if (fun()->isHeavyweight()) {
|
||||
if (fun()->needsCallObject()) {
|
||||
MOZ_ASSERT_IF(hasCallObj() && !fun()->isGenerator(),
|
||||
scopeChain()->as<CallObject>().callee().nonLazyScript() == script);
|
||||
} else {
|
||||
|
@ -1187,7 +1187,7 @@ FrameIter::scopeChain(JSContext* cx) const
|
|||
CallObject&
|
||||
FrameIter::callObj(JSContext* cx) const
|
||||
{
|
||||
MOZ_ASSERT(calleeTemplate()->isHeavyweight());
|
||||
MOZ_ASSERT(calleeTemplate()->needsCallObject());
|
||||
|
||||
JSObject* pobj = scopeChain(cx);
|
||||
while (!pobj->is<CallObject>())
|
||||
|
|
|
@ -322,7 +322,7 @@ class InterpreterFrame
|
|||
/* (0x80 is unused) */
|
||||
|
||||
/* Function prologue state */
|
||||
HAS_CALL_OBJ = 0x100, /* CallObject created for heavyweight fun */
|
||||
HAS_CALL_OBJ = 0x100, /* CallObject created for needsCallObject function */
|
||||
HAS_ARGS_OBJ = 0x200, /* ArgumentsObject created for needsArgsObj script */
|
||||
|
||||
/* Lazy frame initialization */
|
||||
|
|
Загрузка…
Ссылка в новой задаче