Bug 1533003 - JSScript::fullyInitFromEmitter group flag init r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Wed, 06 Mar 2019 18:03:12 +0000
changeset 520614 154ce749b8e1913ff4393a9e1e12d3a74941ec09
parent 520613 a826392776b54edaf2bbbac81f2183db854035d1
child 520615 62ba39ca25a211f46f5180e6f33f3af8008a963d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1533003
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533003 - JSScript::fullyInitFromEmitter group flag init r=jandem Depends on D22318 Differential Revision: https://phabricator.services.mozilla.com/D22319
js/src/vm/JSScript.cpp
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -3554,16 +3554,32 @@ bool JSScript::fullyInitFromEmitter(JSCo
   // Initialize POD fields
   script->lineno_ = bce->firstLine;
   script->mainOffset_ = bce->mainOffset();
   script->nfixed_ = bce->maxFixedSlots;
   script->nslots_ = nslots;
   script->bodyScopeIndex_ = bce->bodyScopeIndex;
   script->numBytecodeTypeSets_ = bce->typesetCount;
 
+  // Initialize script flags from BytecodeEmitter
+  script->setFlag(ImmutableFlags::Strict, bce->sc->strict());
+  script->setFlag(ImmutableFlags::ExplicitUseStrict,
+                  bce->sc->hasExplicitUseStrict());
+  script->setFlag(ImmutableFlags::BindingsAccessedDynamically,
+                  bce->sc->bindingsAccessedDynamically());
+  script->setFlag(ImmutableFlags::HasSingletons, bce->hasSingletons);
+  script->setFlag(ImmutableFlags::IsForEval, bce->sc->isEvalContext());
+  script->setFlag(ImmutableFlags::IsModule, bce->sc->isModuleContext());
+  script->setFlag(ImmutableFlags::HasNonSyntacticScope,
+                  bce->outermostScope()->hasOnChain(ScopeKind::NonSyntactic));
+  script->setFlag(ImmutableFlags::FunHasAnyAliasedFormal,
+                  HasAnyAliasedFormal(bce));
+  script->setFlag(ImmutableFlags::NeedsFunctionEnvironmentObjects,
+                  NeedsFunctionEnvironmentObjects(bce));
+
   if (!createPrivateScriptData(
           cx, script, bce->scopeList.length(), bce->numberList.length(),
           bce->objectList.length, bce->tryNoteList.length(),
           bce->scopeNoteList.length(), bce->resumeOffsetList.length())) {
     return false;
   }
 
   // The + 1 is to account for the final SN_MAKE_TERMINATOR that is appended
@@ -3598,31 +3614,16 @@ bool JSScript::fullyInitFromEmitter(JSCo
   }
   if (bce->scopeNoteList.length() != 0) {
     bce->scopeNoteList.finish(data->scopeNotes());
   }
   if (bce->resumeOffsetList.length() != 0) {
     bce->resumeOffsetList.finish(data->resumeOffsets());
   }
 
-  script->setFlag(ImmutableFlags::Strict, bce->sc->strict());
-  script->setFlag(ImmutableFlags::ExplicitUseStrict,
-                  bce->sc->hasExplicitUseStrict());
-  script->setFlag(ImmutableFlags::BindingsAccessedDynamically,
-                  bce->sc->bindingsAccessedDynamically());
-  script->setFlag(ImmutableFlags::HasSingletons, bce->hasSingletons);
-  script->setFlag(ImmutableFlags::IsForEval, bce->sc->isEvalContext());
-  script->setFlag(ImmutableFlags::IsModule, bce->sc->isModuleContext());
-  script->setFlag(ImmutableFlags::HasNonSyntacticScope,
-                  bce->outermostScope()->hasOnChain(ScopeKind::NonSyntactic));
-  script->setFlag(ImmutableFlags::FunHasAnyAliasedFormal,
-                  HasAnyAliasedFormal(bce));
-  script->setFlag(ImmutableFlags::NeedsFunctionEnvironmentObjects,
-                  NeedsFunctionEnvironmentObjects(bce));
-
   // There shouldn't be any fallible operation after initFromFunctionBox,
   // JSFunction::hasUncompletedScript relies on the fact that the existence
   // of the pointer to JSScript means the pointed JSScript is complete.
   if (bce->sc->isFunctionBox()) {
     initFromFunctionBox(script, bce->sc->asFunctionBox());
   }
 
 #ifdef JS_STRUCTURED_SPEW