Bug 1498320 - When compiling a module script, create the ModuleObject after creating the script for it. r=tcampbell
authorJeff Walden <jwalden@mit.edu>
Thu, 11 Oct 2018 13:54:42 -0700
changeset 445969 15d7f3fb96d5337164049be2fbd49bac97a04f8a
parent 445968 958a348c9ee087971c06c74db8cf18de5d3578fe
child 445970 e6b6326c593d9a8c1095b2c872056df7f8ff088f
push id35030
push usercsabou@mozilla.com
push dateTue, 13 Nov 2018 04:24:01 +0000
treeherdermozilla-central@f6df375b8698 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1498320
milestone65.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 1498320 - When compiling a module script, create the ModuleObject after creating the script for it. r=tcampbell
js/src/frontend/BytecodeCompiler.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -409,22 +409,22 @@ BytecodeCompiler::compileEvalScript(Hand
 
 ModuleObject*
 BytecodeCompiler::compileModule()
 {
     if (!createSourceAndParser(ParseGoal::Module)) {
         return nullptr;
     }
 
-    Rooted<ModuleObject*> module(cx, ModuleObject::create(cx));
-    if (!module) {
+    if (!createScript()) {
         return nullptr;
     }
 
-    if (!createScript()) {
+    Rooted<ModuleObject*> module(cx, ModuleObject::create(cx));
+    if (!module) {
         return nullptr;
     }
 
     module->init(script);
 
     ModuleBuilder builder(cx, module, parser->anyChars);
 
     ModuleSharedContext modulesc(cx, module, enclosingScope, builder);