зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438232 - Handle lazy scripts in CanReuseScriptForClone without forcing a delazify/clone. r=shu
This commit is contained in:
Родитель
e32352899f
Коммит
74263e01cf
|
@ -2038,10 +2038,10 @@ js::CanReuseScriptForClone(JSCompartment* compartment, HandleFunction fun,
|
|||
return true;
|
||||
|
||||
// We need to clone the script if we're not already marked as having a
|
||||
// non-syntactic scope. If we're lazy, go ahead and clone the script; see
|
||||
// the big comment at the end of CopyScriptInternal for the explanation of
|
||||
// what's going on there.
|
||||
return fun->hasScript() && fun->nonLazyScript()->hasNonSyntacticScope();
|
||||
// non-syntactic scope.
|
||||
return fun->hasScript()
|
||||
? fun->nonLazyScript()->hasNonSyntacticScope()
|
||||
: fun->lazyScript()->enclosingScope()->hasOnChain(ScopeKind::NonSyntactic);
|
||||
}
|
||||
|
||||
static inline JSFunction*
|
||||
|
|
|
@ -3674,23 +3674,6 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
|
|||
Rebase<uint32_t>(dst, src, src->yieldAndAwaitOffsets().vector_);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function delazification assumes that their script does not have a
|
||||
* non-syntactic global scope. We ensure that as follows:
|
||||
*
|
||||
* 1) Initial parsing only creates lazy functions if
|
||||
* !hasNonSyntacticScope.
|
||||
* 2) Cloning a lazy function into a non-global scope will always require
|
||||
* that its script be cloned. See comments in
|
||||
* CloneFunctionObjectUseSameScript.
|
||||
* 3) Cloning a script never sets a lazyScript on the clone, so the function
|
||||
* cannot be relazified.
|
||||
*
|
||||
* If you decide that lazy functions should be supported with a
|
||||
* non-syntactic global scope, make sure delazification can deal.
|
||||
*/
|
||||
MOZ_ASSERT_IF(dst->hasNonSyntacticScope(), !dst->maybeLazyScript());
|
||||
MOZ_ASSERT_IF(dst->hasNonSyntacticScope(), !dst->isRelazifiable());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче