Bug 1587950 - Use HasInnerFunctions flag for LazyScript. r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D48904

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Campbell 2019-10-10 23:18:56 +00:00
Родитель af2451e030
Коммит 6ca3ab075b
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1555,7 +1555,7 @@ bool JSFunction::createScriptForLazilyInterpretedFunction(JSContext* cx,
// requires a non-lazy script. Note that if this ever changes, // requires a non-lazy script. Note that if this ever changes,
// XDRRelazificationInfo will have to be fixed. // XDRRelazificationInfo will have to be fixed.
bool isBinAST = lazy->scriptSource()->hasBinASTSource(); bool isBinAST = lazy->scriptSource()->hasBinASTSource();
bool canRelazify = !lazy->numInnerFunctions() && !lazy->hasDirectEval(); bool canRelazify = !lazy->hasInnerFunctions() && !lazy->hasDirectEval();
if (script) { if (script) {
// This function is non-canonical function, and the canonical // This function is non-canonical function, and the canonical

Просмотреть файл

@ -268,7 +268,7 @@ static XDRResult XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun,
HandleScope enclosingScope, HandleScope enclosingScope,
MutableHandle<LazyScript*> lazy) { MutableHandle<LazyScript*> lazy) {
MOZ_ASSERT_IF(mode == XDR_ENCODE, script->maybeLazyScript()); MOZ_ASSERT_IF(mode == XDR_ENCODE, script->maybeLazyScript());
MOZ_ASSERT_IF(mode == XDR_ENCODE, !lazy->numInnerFunctions()); MOZ_ASSERT_IF(mode == XDR_ENCODE, !lazy->hasInnerFunctions());
JSContext* cx = xdr->cx(); JSContext* cx = xdr->cx();
@ -295,7 +295,7 @@ static XDRResult XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun,
// We can assert we have no inner functions because we don't // We can assert we have no inner functions because we don't
// relazify scripts with inner functions. See // relazify scripts with inner functions. See
// JSFunction::createScriptForLazilyInterpretedFunction. // JSFunction::createScriptForLazilyInterpretedFunction.
MOZ_ASSERT(lazy->numInnerFunctions() == 0); MOZ_ASSERT(!lazy->hasInnerFunctions());
if (fun->kind() == FunctionFlags::FunctionKind::ClassConstructor) { if (fun->kind() == FunctionFlags::FunctionKind::ClassConstructor) {
numFieldInitializers = numFieldInitializers =
(uint32_t)lazy->getFieldInitializers().numFieldInitializers; (uint32_t)lazy->getFieldInitializers().numFieldInitializers;
@ -5283,6 +5283,9 @@ LazyScript* LazyScript::Create(
if (parseGoal == frontend::ParseGoal::Module) { if (parseGoal == frontend::ParseGoal::Module) {
immutableFlags |= uint32_t(ImmutableFlags::IsModule); immutableFlags |= uint32_t(ImmutableFlags::IsModule);
} }
if (!innerFunctionBoxes.empty()) {
immutableFlags |= uint32_t(ImmutableFlags::HasInnerFunctions);
}
LazyScript* res = LazyScript::CreateRaw( LazyScript* res = LazyScript::CreateRaw(
cx, closedOverBindings.length(), innerFunctionBoxes.length(), fun, cx, closedOverBindings.length(), innerFunctionBoxes.length(), fun,