diff --git a/js/src/vm/JSFunction.cpp b/js/src/vm/JSFunction.cpp index 57fec0f15a8a..29fc2a454580 100644 --- a/js/src/vm/JSFunction.cpp +++ b/js/src/vm/JSFunction.cpp @@ -1555,7 +1555,7 @@ bool JSFunction::createScriptForLazilyInterpretedFunction(JSContext* cx, // requires a non-lazy script. Note that if this ever changes, // XDRRelazificationInfo will have to be fixed. bool isBinAST = lazy->scriptSource()->hasBinASTSource(); - bool canRelazify = !lazy->numInnerFunctions() && !lazy->hasDirectEval(); + bool canRelazify = !lazy->hasInnerFunctions() && !lazy->hasDirectEval(); if (script) { // This function is non-canonical function, and the canonical diff --git a/js/src/vm/JSScript.cpp b/js/src/vm/JSScript.cpp index 7e72b3d240e0..562115d808c8 100644 --- a/js/src/vm/JSScript.cpp +++ b/js/src/vm/JSScript.cpp @@ -268,7 +268,7 @@ static XDRResult XDRRelazificationInfo(XDRState* xdr, HandleFunction fun, HandleScope enclosingScope, MutableHandle lazy) { 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(); @@ -295,7 +295,7 @@ static XDRResult XDRRelazificationInfo(XDRState* xdr, HandleFunction fun, // We can assert we have no inner functions because we don't // relazify scripts with inner functions. See // JSFunction::createScriptForLazilyInterpretedFunction. - MOZ_ASSERT(lazy->numInnerFunctions() == 0); + MOZ_ASSERT(!lazy->hasInnerFunctions()); if (fun->kind() == FunctionFlags::FunctionKind::ClassConstructor) { numFieldInitializers = (uint32_t)lazy->getFieldInitializers().numFieldInitializers; @@ -5283,6 +5283,9 @@ LazyScript* LazyScript::Create( if (parseGoal == frontend::ParseGoal::Module) { immutableFlags |= uint32_t(ImmutableFlags::IsModule); } + if (!innerFunctionBoxes.empty()) { + immutableFlags |= uint32_t(ImmutableFlags::HasInnerFunctions); + } LazyScript* res = LazyScript::CreateRaw( cx, closedOverBindings.length(), innerFunctionBoxes.length(), fun,