Bug 1382973 part 5 - Remove BytecodeAnalysis::hasSetArg(). r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 22 Jul 2017 14:24:05 +0200
changeset 419126 99d8af9fffb4ed68872959716c849b478fd8f900
parent 419125 2126f7e82cc9a0a34b478f87310bbd1495373542
child 419127 dd2c01041ec8a21b055a672898161938b6f62a2f
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1382973
milestone56.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 1382973 part 5 - Remove BytecodeAnalysis::hasSetArg(). r=nbp
js/src/jit/BytecodeAnalysis.cpp
js/src/jit/BytecodeAnalysis.h
js/src/jit/IonBuilder.cpp
--- a/js/src/jit/BytecodeAnalysis.cpp
+++ b/js/src/jit/BytecodeAnalysis.cpp
@@ -13,18 +13,17 @@
 
 using namespace js;
 using namespace js::jit;
 
 BytecodeAnalysis::BytecodeAnalysis(TempAllocator& alloc, JSScript* script)
   : script_(script),
     infos_(alloc),
     usesEnvironmentChain_(false),
-    hasTryFinally_(false),
-    hasSetArg_(false)
+    hasTryFinally_(false)
 {
 }
 
 // Bytecode range containing only catch or finally code.
 struct CatchFinallyRange
 {
     uint32_t start; // Inclusive.
     uint32_t end;   // Exclusive.
@@ -179,20 +178,16 @@ BytecodeAnalysis::init(TempAllocator& al
             if (script_->hasNonSyntacticScope())
                 usesEnvironmentChain_ = true;
             break;
 
           case JSOP_FINALLY:
             hasTryFinally_ = true;
             break;
 
-          case JSOP_SETARG:
-            hasSetArg_ = true;
-            break;
-
           default:
             break;
         }
 
         bool jump = IsJumpOpcode(op);
         if (jump) {
             // Case instructions do not push the lvalue back when branching.
             unsigned newStackDepth = stackDepth;
--- a/js/src/jit/BytecodeAnalysis.h
+++ b/js/src/jit/BytecodeAnalysis.h
@@ -35,17 +35,16 @@ struct BytecodeInfo
 
 class BytecodeAnalysis
 {
     JSScript* script_;
     Vector<BytecodeInfo, 0, JitAllocPolicy> infos_;
 
     bool usesEnvironmentChain_;
     bool hasTryFinally_;
-    bool hasSetArg_;
 
   public:
     explicit BytecodeAnalysis(TempAllocator& alloc, JSScript* script);
 
     MOZ_MUST_USE bool init(TempAllocator& alloc, GSNCache& gsn);
 
     BytecodeInfo& info(jsbytecode* pc) {
         MOZ_ASSERT(infos_[script_->pcToOffset(pc)].initialized);
@@ -60,19 +59,15 @@ class BytecodeAnalysis
 
     bool usesEnvironmentChain() const {
         return usesEnvironmentChain_;
     }
 
     bool hasTryFinally() const {
         return hasTryFinally_;
     }
-
-    bool hasSetArg() const {
-        return hasSetArg_;
-    }
 };
 
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_BytecodeAnalysis_h */
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -8383,17 +8383,18 @@ IonBuilder::getElemTryArguments(bool* em
     MInstruction* idInt32 = MToInt32::New(alloc(), index);
     current->add(idInt32);
     index = idInt32;
 
     // Bailouts if we read more than the number of actual arguments.
     index = addBoundsCheck(index, length);
 
     // Load the argument from the actual arguments.
-    MGetFrameArgument* load = MGetFrameArgument::New(alloc(), index, analysis_.hasSetArg());
+    bool modifiesArgs = script()->baselineScript()->modifiesArguments();
+    MGetFrameArgument* load = MGetFrameArgument::New(alloc(), index, modifiesArgs);
     current->add(load);
     current->push(load);
 
     TemporaryTypeSet* types = bytecodeTypes(pc);
     MOZ_TRY(pushTypeBarrier(load, types, BarrierKind::TypeSet));
 
     trackOptimizationSuccess();
     *emitted = true;
@@ -12269,17 +12270,18 @@ IonBuilder::jsop_copylexicalenv(bool cop
 AbortReasonOr<Ok>
 IonBuilder::jsop_setarg(uint32_t arg)
 {
     // To handle this case, we should spill the arguments to the space where
     // actual arguments are stored. The tricky part is that if we add a MIR
     // to wrap the spilling action, we don't want the spilling to be
     // captured by the GETARG and by the resume point, only by
     // MGetFrameArgument.
-    MOZ_ASSERT(analysis_.hasSetArg());
+    MOZ_ASSERT_IF(script()->hasBaselineScript(),
+                  script()->baselineScript()->modifiesArguments());
     MDefinition* val = current->peek(-1);
 
     // If an arguments object is in use, and it aliases formals, then all SETARGs
     // must go through the arguments object.
     if (info().argsObjAliasesFormals()) {
         if (NeedsPostBarrier(val))
             current->add(MPostWriteBarrier::New(alloc(), current->argumentsObject(), val));
         current->add(MSetArgumentsObjectArg::New(alloc(), current->argumentsObject(),