From ca218fe117a22591f6d6b0958cf98f5d2c573f65 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Tue, 28 Jul 2020 10:03:22 +0000 Subject: [PATCH] Bug 1655386 - Part 5: Do not set top level flags to functions. r=nbp Depends on D85112 Differential Revision: https://phabricator.services.mozilla.com/D85113 --- js/src/frontend/Frontend2.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/src/frontend/Frontend2.cpp b/js/src/frontend/Frontend2.cpp index 668abdf76404..c1fe1a9d8de0 100644 --- a/js/src/frontend/Frontend2.cpp +++ b/js/src/frontend/Frontend2.cpp @@ -322,10 +322,15 @@ bool ConvertScriptStencil(JSContext* cx, const SmooshResult& result, options.selfHostingMode); stencil.get().immutableFlags.setFlag(ImmutableFlags::ForceStrict, options.forceStrictMode()); - stencil.get().immutableFlags.setFlag(ImmutableFlags::NoScriptRval, - options.noScriptRval); - stencil.get().immutableFlags.setFlag(ImmutableFlags::TreatAsRunOnce, - options.isRunOnce); + stencil.get().immutableFlags.setFlag(ImmutableFlags::HasNonSyntacticScope, + options.nonSyntacticScope); + + if (&smooshStencil == &result.top_level_script) { + stencil.get().immutableFlags.setFlag(ImmutableFlags::TreatAsRunOnce, + options.isRunOnce); + stencil.get().immutableFlags.setFlag(ImmutableFlags::NoScriptRval, + options.noScriptRval); + } bool isFunction = stencil.get().immutableFlags.hasFlag(ImmutableFlags::IsFunction);