Bug 1498320 - Move script creation into prepareModuleParse. r=tcampbell
authorJeff Walden <jwalden@mit.edu>
Thu, 11 Oct 2018 13:54:42 -0700
changeset 445949 b0c005ef9cee4271fd458298d4f4a0f1d8c81cb3
parent 445948 37b4694f5fcf00a528927af61f53aef699f994ee
child 445950 2792e47984ee1fa13fe2442864cab100a4b425b3
push id109805
push userjwalden@mit.edu
push dateTue, 13 Nov 2018 01:51:46 +0000
treeherdermozilla-inbound@17243a560006 [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 - Move script creation into prepareModuleParse. r=tcampbell
js/src/frontend/BytecodeCompiler.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -54,17 +54,17 @@ class MOZ_STACK_CLASS BytecodeCompiler
         return createSourceAndParser(ParseGoal::Script) && createScript();
     }
 
     JSScript* compileGlobalScript(ScopeKind scopeKind);
     JSScript* compileEvalScript(HandleObject environment, HandleScope enclosingScope);
 
     // Call this before calling compileModule.
     MOZ_MUST_USE bool prepareModuleParse() {
-        return createSourceAndParser(ParseGoal::Module);
+        return createSourceAndParser(ParseGoal::Module) && createScript();
     }
 
     ModuleObject* compileModule();
 
     // Call this before calling compileStandaloneFunction.
     MOZ_MUST_USE bool prepareStandaloneFunctionParse(const Maybe<uint32_t>& parameterListEnd) {
         return createSourceAndParser(ParseGoal::Script, parameterListEnd);
     }
@@ -439,21 +439,17 @@ BytecodeCompiler::compileEvalScript(Hand
     }
 
     return compileScript(environment, &evalsc);
 }
 
 ModuleObject*
 BytecodeCompiler::compileModule()
 {
-    assertSourceAndParserCreated();
-
-    if (!createScript()) {
-        return nullptr;
-    }
+    assertSourceParserAndScriptCreated();
 
     Rooted<ModuleObject*> module(cx, ModuleObject::create(cx));
     if (!module) {
         return nullptr;
     }
 
     module->init(script);