Bug 1533003 - JSScript::fullyInitFromEmitter group POD fields r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Wed, 06 Mar 2019 18:01:34 +0000
changeset 520613 a826392776b54edaf2bbbac81f2183db854035d1
parent 520612 ce7559041ffa76ffc14a77b6f6e7d730c9fa544d
child 520614 154ce749b8e1913ff4393a9e1e12d3a74941ec09
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 POD fields r=jandem Depends on D22317 Differential Revision: https://phabricator.services.mozilla.com/D22318
js/src/vm/JSScript.cpp
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -3545,28 +3545,32 @@ bool JSScript::fullyInitFromEmitter(JSCo
   uint64_t nslots =
       bce->maxFixedSlots + static_cast<uint64_t>(bce->maxStackDepth);
   if (nslots > UINT32_MAX) {
     bce->reportError(nullptr, JSMSG_NEED_DIET, js_script_str);
     return false;
   }
 
   uint32_t natoms = bce->atomIndices->count();
+
+  // 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;
+
   if (!createPrivateScriptData(
           cx, script, bce->scopeList.length(), bce->numberList.length(),
           bce->objectList.length, bce->tryNoteList.length(),
           bce->scopeNoteList.length(), bce->resumeOffsetList.length())) {
     return false;
   }
 
-  MOZ_ASSERT(script->mainOffset() == 0);
-  script->mainOffset_ = bce->mainOffset();
-  script->numBytecodeTypeSets_ = bce->typesetCount;
-  script->lineno_ = bce->firstLine;
-
   // The + 1 is to account for the final SN_MAKE_TERMINATOR that is appended
   // when the notes are copied to their final destination by copySrcNotes.
   uint32_t nsrcnotes = bce->notes().length() + 1;
   uint32_t codeLength = bce->code().length();
   if (!script->createSharedScriptData(cx, codeLength, nsrcnotes, natoms)) {
     return false;
   }
 
@@ -3602,20 +3606,16 @@ bool JSScript::fullyInitFromEmitter(JSCo
   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->nfixed_ = bce->maxFixedSlots;
-  script->nslots_ = nslots;
-  script->bodyScopeIndex_ = bce->bodyScopeIndex;
   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,