Bug 1533196 - Remove JSScript::FunHasAnyAliasedFormal flag r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Thu, 07 Mar 2019 09:34:05 +0000
changeset 520755 26d4249db1c799d4312d061d656d7e65a6b78ba2
parent 520754 4f2c7085942ec590a60395b5806de13fd2c7ef0f
child 520756 912d0497234a65bafe04dfa5df6789beebb91d8e
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
bugs1533196
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 1533196 - Remove JSScript::FunHasAnyAliasedFormal flag r=jandem This flag is only used by IonAnalysis and rarely so it should be computed there instead of in all script/function code paths. Differential Revision: https://phabricator.services.mozilla.com/D22432
js/src/jit/IonAnalysis.cpp
js/src/vm/JSScript.cpp
js/src/vm/JSScript.h
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -4899,18 +4899,22 @@ bool jit::AnalyzeArgumentsUsage(JSContex
       return true;
     }
   }
 
   // If a script explicitly accesses the contents of 'arguments', and has
   // formals which may be stored as part of a call object, don't use lazy
   // arguments. The compiler can then assume that accesses through
   // arguments[i] will be on unaliased variables.
-  if (script->funHasAnyAliasedFormal() && argumentsContentsObserved) {
-    return true;
+  if (argumentsContentsObserved) {
+    for (PositionalFormalParameterIter fi(script); fi; fi++) {
+      if (fi.closedOver()) {
+        return true;
+      }
+    }
   }
 
   script->setNeedsArgsObj(false);
   return true;
 }
 
 // Mark all the blocks that are in the loop with the given header.
 // Returns the number of blocks marked. Set *canOsr to true if the loop is
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -3486,27 +3486,16 @@ static void InitAtomMap(frontend::AtomIn
        r.popFront()) {
     JSAtom* atom = r.front().key();
     uint32_t index = r.front().value();
     MOZ_ASSERT(index < indices.count());
     atoms[index].init(atom);
   }
 }
 
-static bool HasAnyAliasedFormal(frontend::BytecodeEmitter* bce) {
-  PositionalFormalParameterIter fi(bce->bodyScope());
-  for (; fi; fi++) {
-    // Check if the formal parameter is closed over.
-    if (fi.closedOver()) {
-      return true;
-    }
-  }
-  return false;
-}
-
 static bool NeedsFunctionEnvironmentObjects(frontend::BytecodeEmitter* bce) {
   // See JSFunction::needsCallObject()
   js::Scope* bodyScope = bce->bodyScope();
   if (bodyScope->kind() == js::ScopeKind::Function) {
     if (bodyScope->hasEnvironment()) {
       return true;
     }
   }
@@ -3587,18 +3576,16 @@ bool JSScript::fullyInitFromEmitter(JSCo
                   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->setFlag(ImmutableFlags::HasNonSyntacticScope,
                   bce->outermostScope()->hasOnChain(ScopeKind::NonSyntactic));
-  script->setFlag(ImmutableFlags::FunHasAnyAliasedFormal,
-                  HasAnyAliasedFormal(bce));
   script->setFlag(ImmutableFlags::NeedsFunctionEnvironmentObjects,
                   NeedsFunctionEnvironmentObjects(bce));
 
   // Initialize script flags from FunctionBox
   if (bce->sc->isFunctionBox()) {
     script->initFromFunctionBox(bce->sc->asFunctionBox());
   }
 
--- a/js/src/vm/JSScript.h
+++ b/js/src/vm/JSScript.h
@@ -1696,18 +1696,17 @@ class JSScript : public js::gc::TenuredC
 
     // See Parser::selfHostingMode.
     SelfHosted = 1 << 4,
 
     // See FunctionBox.
     BindingsAccessedDynamically = 1 << 5,
     FunHasExtensibleScope = 1 << 6,
 
-    // True if any formalIsAliased(i).
-    FunHasAnyAliasedFormal = 1 << 7,
+    // (1 << 7) is unused.
 
     // Script has singleton objects.
     HasSingletons = 1 << 8,
 
     FunctionHasThisBinding = 1 << 9,
     FunctionHasExtraBodyVarScope = 1 << 10,
 
     // Whether the arguments object for this script, if it needs one, should be
@@ -2109,19 +2108,16 @@ class JSScript : public js::gc::TenuredC
 
   bool selfHosted() const { return hasFlag(ImmutableFlags::SelfHosted); }
   bool bindingsAccessedDynamically() const {
     return hasFlag(ImmutableFlags::BindingsAccessedDynamically);
   }
   bool funHasExtensibleScope() const {
     return hasFlag(ImmutableFlags::FunHasExtensibleScope);
   }
-  bool funHasAnyAliasedFormal() const {
-    return hasFlag(ImmutableFlags::FunHasAnyAliasedFormal);
-  }
 
   bool hasSingletons() const { return hasFlag(ImmutableFlags::HasSingletons); }
   bool treatAsRunOnce() const {
     return hasFlag(ImmutableFlags::TreatAsRunOnce);
   }
   bool hasRunOnce() const { return hasFlag(MutableFlags::HasRunOnce); }
   bool hasBeenCloned() const { return hasFlag(MutableFlags::HasBeenCloned); }