Bug 1029830 - IonMonkey: GVN: Say "release" instead of "discard" when releasing an operand r=nbp
authorDan Gohman <sunfish@mozilla.com>
Wed, 17 Sep 2014 10:27:24 -0700
changeset 205880 6e1ce34f558a14b17ba3321401970ea40152db37
parent 205879 69858bc21e7cde39be9d7bb9a1d43191b1f55d90
child 205881 2079c454f90817279f650f251512638c1c28dfc1
push id27507
push userryanvm@gmail.com
push dateThu, 18 Sep 2014 02:16:54 +0000
treeherdermozilla-central@488d490da742 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1029830
milestone35.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 1029830 - IonMonkey: GVN: Say "release" instead of "discard" when releasing an operand r=nbp
js/src/jit/IonAnalysis.cpp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/MIRGraph.cpp
js/src/jit/UnreachableCodeElimination.cpp
js/src/jit/ValueNumbering.cpp
js/src/jit/ValueNumbering.h
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -39,17 +39,17 @@ SplitCriticalEdgesForBlock(MIRGraph &gra
         MBasicBlock *split = MBasicBlock::NewSplitEdge(graph, block->info(), block);
         if (!split)
             return false;
         split->setLoopDepth(block->loopDepth());
         graph.insertBlockAfter(block, split);
         split->end(MGoto::New(graph.alloc(), target));
 
         if (MResumePoint *rp = split->entryResumePoint()) {
-            rp->discardUses();
+            rp->releaseUses();
             split->clearEntryResumePoint();
         }
 
         block->replaceSuccessor(i, split);
         target->replacePredecessor(block, split);
     }
     return true;
 }
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -1136,25 +1136,25 @@ MPhi::removeOperand(size_t index)
     // If we have phi(..., a, b, c, d, ..., z) and we plan
     // on removing a, then first shift downward so that we have
     // phi(..., b, c, d, ..., z, z):
     size_t length = inputs_.length();
     for (size_t i = index; i < length - 1; i++)
         inputs_[i].replaceProducer(inputs_[i + 1].producer());
 
     // truncate the inputs_ list:
-    inputs_[length - 1].discardProducer();
+    inputs_[length - 1].releaseProducer();
     inputs_.shrinkBy(1);
 }
 
 void
 MPhi::removeAllOperands()
 {
     for (size_t i = 0; i < inputs_.length(); i++)
-        inputs_[i].discardProducer();
+        inputs_[i].releaseProducer();
     inputs_.clear();
 }
 
 MDefinition *
 MPhi::operandIfRedundant()
 {
     JS_ASSERT(inputs_.length() != 0);
 
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -151,17 +151,17 @@ class MUse : public TempObject, public I
     inline void init(MDefinition *producer, MNode *consumer);
     // Like init, but works even when the use contains uninitialized data.
     inline void initUnchecked(MDefinition *producer, MNode *consumer);
     // Like initUnchecked, but set the producer to nullptr.
     inline void initUncheckedWithoutProducer(MNode *consumer);
     // Set this use, which was not previously clear.
     inline void replaceProducer(MDefinition *producer);
     // Clear this use.
-    inline void discardProducer();
+    inline void releaseProducer();
 
     MDefinition *producer() const {
         JS_ASSERT(producer_ != nullptr);
         return producer_;
     }
     bool hasProducer() const {
         return producer_ != nullptr;
     }
@@ -232,18 +232,18 @@ class MNode : public TempObject
     }
 
     // Sets an already set operand, updating use information. If you're looking
     // for setOperand, this is probably what you want.
     virtual void replaceOperand(size_t index, MDefinition *operand) = 0;
 
     // Resets the operand to an uninitialized state, breaking the link
     // with the previous operand's producer.
-    void discardOperand(size_t index) {
-        getUseFor(index)->discardProducer();
+    void releaseOperand(size_t index) {
+        getUseFor(index)->releaseProducer();
     }
 
 #if DEBUG
     bool operandDiscarded(size_t index) const {
         return !getUseFor(index)->hasProducer();
     }
 #endif
 
@@ -11228,20 +11228,20 @@ class MResumePoint MOZ_FINAL :
     void replaceInstruction(MInstruction *ins) {
         MOZ_ASSERT(instruction_);
         instruction_ = ins;
     }
     Mode mode() const {
         return mode_;
     }
 
-    void discardUses() {
+    void releaseUses() {
         for (size_t i = 0; i < operands_.length(); i++) {
             if (operands_[i].hasProducer())
-                operands_[i].discardProducer();
+                operands_[i].releaseProducer();
         }
     }
 
     bool writeRecoverData(CompactBufferWriter &writer) const;
 
     virtual void dump(FILE *fp) const;
     virtual void dump() const;
 };
@@ -11782,17 +11782,17 @@ void MUse::initUncheckedWithoutProducer(
 void MUse::replaceProducer(MDefinition *producer)
 {
     MOZ_ASSERT(consumer_, "Resetting MUse without a consumer");
     producer_->removeUse(this);
     producer_ = producer;
     producer_->addUse(this);
 }
 
-void MUse::discardProducer()
+void MUse::releaseProducer()
 {
     MOZ_ASSERT(consumer_, "Clearing MUse without a consumer");
     producer_->removeUse(this);
     producer_ = nullptr;
 }
 
 // Implement cast functions now that the compiler can see the inheritance.
 
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -769,17 +769,17 @@ MBasicBlock::moveBefore(MInstruction *at
     at->block()->instructions_.insertBefore(at, ins);
     ins->setTrackedSite(at->trackedSite());
 }
 
 void
 MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = RefType_Default */)
 {
     if (refType & RefType_DiscardOperands)
-        rp->discardUses();
+        rp->releaseUses();
 #ifdef DEBUG
     MResumePointIterator iter = resumePointsBegin();
     while (*iter != rp) {
         // We should reach it before reaching the end.
         MOZ_ASSERT(iter != resumePointsEnd());
         iter++;
     }
     resumePoints_.removeAt(iter);
@@ -800,17 +800,17 @@ MBasicBlock::prepareForDiscard(MInstruct
     // We need to assert that instructions have no uses after removing the their
     // resume points operands as they could be captured by their own resume
     // point.
     MOZ_ASSERT_IF(refType & RefType_AssertNoUses, !ins->hasUses());
 
     const uint32_t InstructionOperands = RefType_DiscardOperands | RefType_DiscardInstruction;
     if ((refType & InstructionOperands) == InstructionOperands) {
         for (size_t i = 0, e = ins->numOperands(); i < e; i++)
-            ins->discardOperand(i);
+            ins->releaseOperand(i);
     }
 
     ins->setDiscarded();
 }
 
 void
 MBasicBlock::discard(MInstruction *ins)
 {
--- a/js/src/jit/UnreachableCodeElimination.cpp
+++ b/js/src/jit/UnreachableCodeElimination.cpp
@@ -208,17 +208,17 @@ UnreachableCodeElimination::checkDepende
     // alias analysis needs to get rerun to have the right dependency.
     if (!disableAliasAnalysis_ && instr->dependency() && !instr->dependency()->block()->isMarked())
         rerunAliasAnalysis_ = true;
 
     for (MUseIterator iter(instr->usesBegin()); iter != instr->usesEnd(); ) {
         MUse *use = *iter++;
         if (!use->consumer()->block()->isMarked()) {
             instr->setUseRemovedUnchecked();
-            use->discardProducer();
+            use->releaseProducer();
         }
     }
 }
 
 bool
 UnreachableCodeElimination::removeUnmarkedBlocksAndClearDominators()
 {
     // Removes blocks that are not marked from the graph.  For blocks
--- a/js/src/jit/ValueNumbering.cpp
+++ b/js/src/jit/ValueNumbering.cpp
@@ -218,20 +218,20 @@ IsDominatorRefined(MBasicBlock *block)
 // Delete the given instruction and anything in its use-def subtree which is no
 // longer needed.
 bool
 ValueNumberer::deleteDefsRecursively(MDefinition *def)
 {
     return deleteDef(def) && processDeadDefs();
 }
 
-// Assuming phi is dead, discard its operands. If an operand which is not
+// Assuming phi is dead, release its operands. If an operand which is not
 // dominated by the phi becomes dead, push it to the delete worklist.
 bool
-ValueNumberer::discardPhiOperands(MPhi *phi, const MBasicBlock *phiBlock,
+ValueNumberer::releasePhiOperands(MPhi *phi, const MBasicBlock *phiBlock,
                                   UseRemovedOption useRemovedOption)
 {
     // MPhi saves operands in a vector so we iterate in reverse.
     for (int o = phi->numOperands() - 1; o >= 0; --o) {
         MDefinition *op = phi->getOperand(o);
         phi->removeOperand(o);
         if (IsDead(op) && !phiBlock->dominates(op->block())) {
             if (!deadDefs_.append(op))
@@ -239,25 +239,25 @@ ValueNumberer::discardPhiOperands(MPhi *
         } else {
             if (useRemovedOption == SetUseRemoved)
                 op->setUseRemovedUnchecked();
         }
     }
     return true;
 }
 
-// Assuming ins is dead, discard its operands. If an operand becomes dead, push
+// Assuming ins is dead, release its operands. If an operand becomes dead, push
 // it to the delete worklist.
 bool
-ValueNumberer::discardInsOperands(MInstruction *ins,
+ValueNumberer::releaseInsOperands(MInstruction *ins,
                                   UseRemovedOption useRemovedOption)
 {
     for (size_t o = 0, e = ins->numOperands(); o != e; ++o) {
         MDefinition *op = ins->getOperand(o);
-        ins->discardOperand(o);
+        ins->releaseOperand(o);
         if (IsDead(op)) {
             if (!deadDefs_.append(op))
                 return false;
         } else {
             if (useRemovedOption == SetUseRemoved)
                 op->setUseRemovedUnchecked();
         }
     }
@@ -270,23 +270,23 @@ ValueNumberer::deleteDef(MDefinition *de
 {
     JitSpew(JitSpew_GVN, "    Deleting %s%u", def->opName(), def->id());
     MOZ_ASSERT(IsDead(def), "Deleting non-dead definition");
     MOZ_ASSERT(!values_.has(def), "Deleting an instruction still in the set");
 
     if (def->isPhi()) {
         MPhi *phi = def->toPhi();
         MBasicBlock *phiBlock = phi->block();
-        if (!discardPhiOperands(phi, phiBlock, useRemovedOption))
+        if (!releasePhiOperands(phi, phiBlock, useRemovedOption))
              return false;
         MPhiIterator at(phiBlock->phisBegin(phi));
         phiBlock->discardPhiAt(at);
     } else {
         MInstruction *ins = def->toInstruction();
-        if (!discardInsOperands(ins, useRemovedOption))
+        if (!releaseInsOperands(ins, useRemovedOption))
              return false;
         ins->block()->discardIgnoreOperands(ins);
     }
     return true;
 }
 
 // Recursively delete all the defs on the deadDefs_ worklist.
 bool
@@ -566,17 +566,17 @@ ValueNumberer::visitControlInstruction(M
                 } else if (!rerun_) {
                     if (!remainingBlocks_.append(succ))
                         return false;
                 }
             }
         }
     }
 
-    if (!discardInsOperands(control))
+    if (!releaseInsOperands(control))
         return false;
     block->discardIgnoreOperands(control);
     block->end(newControl);
     return processDeadDefs();
 }
 
 // Visit all the phis and instructions in the given block.
 bool
--- a/js/src/jit/ValueNumbering.h
+++ b/js/src/jit/ValueNumbering.h
@@ -73,19 +73,19 @@ class ValueNumberer
     bool dependenciesBroken_;         // Have we broken AliasAnalysis?
 
     enum UseRemovedOption {
         DontSetUseRemoved,
         SetUseRemoved
     };
 
     bool deleteDefsRecursively(MDefinition *def);
-    bool discardPhiOperands(MPhi *phi, const MBasicBlock *phiBlock,
+    bool releasePhiOperands(MPhi *phi, const MBasicBlock *phiBlock,
                             UseRemovedOption useRemovedOption = SetUseRemoved);
-    bool discardInsOperands(MInstruction *ins,
+    bool releaseInsOperands(MInstruction *ins,
                             UseRemovedOption useRemovedOption = SetUseRemoved);
     bool deleteDef(MDefinition *def,
                    UseRemovedOption useRemovedOption = SetUseRemoved);
     bool processDeadDefs();
 
     bool removePredecessor(MBasicBlock *block, MBasicBlock *pred);
     bool removeBlocksRecursively(MBasicBlock *block, const MBasicBlock *root);