Bug 1541404 part 29 - Perform arguments analysis when creating the TypeScript. r=tcampbell
☠☠ backed out by 9afa1dcd247b ☠ ☠
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 14 May 2019 10:36:17 +0000
changeset 532577 c4b0bd61050bb7f3117c2a46ed740fc5d61d0700
parent 532576 760cc10c63b0a19b2553560c69d32a91f0472074
child 532578 2a529f87452c613b0da7fffa222eeb182ff5c903
push id11270
push userrgurzau@mozilla.com
push dateWed, 15 May 2019 15:07:19 +0000
treeherdermozilla-beta@571bc76da583 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1541404
milestone68.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 1541404 part 29 - Perform arguments analysis when creating the TypeScript. r=tcampbell The code in NewArgumentsObject was wrong because the interpreter code calling it also relies on the analysis having been performed. Differential Revision: https://phabricator.services.mozilla.com/D30899
js/src/jit/BaselineCompiler.cpp
js/src/jit/VMFunctions.cpp
js/src/vm/TypeInference.cpp
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -158,18 +158,17 @@ MethodStatus BaselineCompiler::compile()
           script->filename(), script->lineno(), script->column());
 
   TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx);
   TraceLoggerEvent scriptEvent(TraceLogger_AnnotateScripts, script);
   AutoTraceLog logScript(logger, scriptEvent);
   AutoTraceLog logCompile(logger, TraceLogger_BaselineCompilation);
 
   AutoKeepTypeScripts keepTypes(cx);
-  if (!script->ensureHasTypes(cx, keepTypes) ||
-      !script->ensureHasAnalyzedArgsUsage(cx)) {
+  if (!script->ensureHasTypes(cx, keepTypes)) {
     return Method_Error;
   }
 
   // When code coverage is only enabled for optimizations, or when a Debugger
   // set the collectCoverageInfo flag, we have to create the ScriptCounts if
   // they do not exist.
   if (!script->hasScriptCounts() && cx->realm()->collectCoverage()) {
     if (!script->initScriptCounts(cx)) {
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -1048,24 +1048,16 @@ bool GlobalNameConflictsCheckFromIon(JSC
 }
 
 bool InitFunctionEnvironmentObjects(JSContext* cx, BaselineFrame* frame) {
   return frame->initFunctionEnvironmentObjects(cx);
 }
 
 bool NewArgumentsObject(JSContext* cx, BaselineFrame* frame,
                         MutableHandleValue res) {
-  // BaselineCompiler calls ensureHasAnalyzedArgsUsage at compile time. The
-  // interpreters have to do this as part of JSOP_ARGUMENTS.
-  if (frame->runningInInterpreter()) {
-    if (!frame->script()->ensureHasAnalyzedArgsUsage(cx)) {
-      return false;
-    }
-  }
-
   ArgumentsObject* obj = ArgumentsObject::createExpected(cx, frame);
   if (!obj) {
     return false;
   }
   res.setObject(*obj);
   return true;
 }
 
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -3492,16 +3492,22 @@ bool JSScript::makeTypes(JSContext* cx) 
   cx->check(this);
 
   // Scripts that will never run in the Baseline Interpreter or the JITs don't
   // need a TypeScript.
   MOZ_ASSERT(!hasForceInterpreterOp());
 
   AutoEnterAnalysis enter(cx);
 
+  // Run the arguments-analysis if needed. Both the Baseline Interpreter and
+  // Compiler rely on this.
+  if (!ensureHasAnalyzedArgsUsage(cx)) {
+    return false;
+  }
+
   UniquePtr<jit::ICScript> icScript(jit::ICScript::create(cx, this));
   if (!icScript) {
     return false;
   }
 
   // We need to call prepareForDestruction on ICScript before we |delete| it.
   auto prepareForDestruction = mozilla::MakeScopeExit(
       [&] { icScript->prepareForDestruction(cx->zone()); });