Bug 1478509 - Restore ordering for EnterScript and CheckGlobalDeclarationConflicts calls, r=jandem.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 30 Jul 2018 15:34:14 +0000
changeset 429255 4c138aecdd4504bfc4ca5b5296866fed64127bed
parent 429254 7ce27aa3ce6887c226baa88223c0bf95bc2c3c28
child 429256 3db40ff608ebd9188a3e85c6e5f92c1305a752fb
push id67094
push userccoroiu@mozilla.com
push dateMon, 30 Jul 2018 22:02:32 +0000
treeherderautoland@397b4d841690 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1478509
milestone63.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 1478509 - Restore ordering for EnterScript and CheckGlobalDeclarationConflicts calls, r=jandem.
js/src/jit-test/tests/profiler/bug1478509.js
js/src/vm/Stack.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1478509.js
@@ -0,0 +1,5 @@
+// |jit-test| error: SyntaxError
+enableGeckoProfiling();
+s = newGlobal();
+evalcx("let x;", s);
+evalcx("let x;", s);
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -223,19 +223,23 @@ InterpreterFrame::prologue(JSContext* cx
         RootedObject varObjRoot(cx);
         if (script->hasNonSyntacticScope()) {
             lexicalEnv = &extensibleLexicalEnvironment();
             varObjRoot = &varObj();
         } else {
             lexicalEnv = &cx->global()->lexicalEnvironment();
             varObjRoot = cx->global();
         }
-        if (!probes::EnterScript(cx, script, nullptr, this))
+        if (!CheckGlobalDeclarationConflicts(cx, script, lexicalEnv, varObjRoot)) {
+            // Treat this as a script entry, for consistency with Ion.
+            if (script->trackRecordReplayProgress())
+                mozilla::recordreplay::AdvanceExecutionProgressCounter();
             return false;
-        return CheckGlobalDeclarationConflicts(cx, script, lexicalEnv, varObjRoot);
+        }
+        return probes::EnterScript(cx, script, nullptr, this);
     }
 
     if (isModuleFrame())
         return probes::EnterScript(cx, script, nullptr, this);
 
     // At this point, we've yet to push any environments. Check that they
     // match the enclosing scope.
     AssertScopeMatchesEnvironment(script->enclosingScope(), environmentChain());