Revision: 18611
Author:   [email protected]
Date:     Wed Jan 15 09:53:54 2014 UTC
Log: Revert "Eliminatable CheckMaps replaced with if(true) or if(false)."

This reverts r18592 for breaking the GC stress bots.

[email protected]

Review URL: https://codereview.chromium.org/137783011
http://code.google.com/p/v8/source/detail?r=18611

Modified:
 /branches/bleeding_edge/src/hydrogen-check-elimination.cc
 /branches/bleeding_edge/src/hydrogen-flow-engine.h
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h

=======================================
--- /branches/bleeding_edge/src/hydrogen-check-elimination.cc Tue Jan 14 16:06:40 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-check-elimination.cc Wed Jan 15 09:53:54 2014 UTC
@@ -132,10 +132,8 @@

     // Branch-sensitive analysis for certain comparisons may add more facts
     // to the state for the successor on the true branch.
-    HBasicBlock* pred_block = succ->predecessors()->at(0);
-    HControlInstruction* end = pred_block->end();
- if (succ->predecessors()->length() == 1 && end->SuccessorAt(0) == succ &&
-        pred_block->IsReachable()) {
+    HControlInstruction* end = succ->predecessors()->at(0)->end();
+ if (succ->predecessors()->length() == 1 && end->SuccessorAt(0) == succ) {
       if (end->IsCompareMap()) {
         // Learn on the true branch of if(CompareMap(x)).
         HCompareMap* cmp = HCompareMap::cast(end);
@@ -313,27 +311,14 @@
   void ReduceCompareMap(HCompareMap* instr) {
     MapSet maps = FindMaps(instr->value()->ActualValue());
     if (maps == NULL) return;
-
-    TRACE(("CompareMap for #%d at B%d ",
-        instr->value()->ActualValue()->id(), instr->block()->block_id()));
-
     if (maps->Contains(instr->map())) {
       if (maps->size() == 1) {
+        // TODO(titzer): replace with goto true branch
         INC_STAT(compares_true_);
-
-        TRACE(("replaced with goto B%d (true target)\n",
-               instr->SuccessorAt(0)->block_id()));
-
-        instr->block()->ReplaceControlWithGotoSuccessor(0);
-      } else {
-        TRACE(("can't be replaced with goto: ambiguous set of maps\n"));
       }
     } else {
+      // TODO(titzer): replace with goto false branch
       INC_STAT(compares_false_);
-      TRACE(("replaced with goto B%d (false target)\n",
-             instr->SuccessorAt(1)->block_id()));
-
-      instr->block()->ReplaceControlWithGotoSuccessor(1);
     }
   }

=======================================
--- /branches/bleeding_edge/src/hydrogen-flow-engine.h Tue Jan 14 16:06:40 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-flow-engine.h Wed Jan 15 09:53:54 2014 UTC
@@ -124,19 +124,17 @@
       if (SkipNonDominatedBlock(root, block)) continue;
       State* state = StateAt(block);

-      if (block->IsReachable()) {
-        if (block->IsLoopHeader()) {
-          // Apply loop effects before analyzing loop body.
-          ComputeLoopEffects(block)->Apply(state);
-        } else {
-          // Must have visited all predecessors before this block.
-          CheckPredecessorCount(block);
-        }
+      if (block->IsLoopHeader()) {
+        // Apply loop effects before analyzing loop body.
+        ComputeLoopEffects(block)->Apply(state);
+      } else {
+        // Must have visited all predecessors before this block.
+        CheckPredecessorCount(block);
+      }

- // Go through all instructions of the current block, updating the state.
-        for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
-          state = state->Process(it.Current(), zone_);
-        }
+ // Go through all instructions of the current block, updating the state.
+      for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
+        state = state->Process(it.Current(), zone_);
       }

       // Propagate the block state forward to all successor blocks.
@@ -187,7 +185,6 @@
         i = member->loop_information()->GetLastBackEdge()->block_id();
       } else {
         // Process all the effects of the block.
-        if (member->IsUnreachable()) continue;
         ASSERT(member->current_loop() == loop);
         for (HInstructionIterator it(member); !it.Done(); it.Advance()) {
           effects->Process(it.Current(), zone_);
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Jan 14 16:15:52 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Jan 15 09:53:54 2014 UTC
@@ -707,6 +707,7 @@

 void HInstruction::Unlink() {
   ASSERT(IsLinked());
+ ASSERT(!IsControlInstruction()); // Must never move control instructions.
   ASSERT(!IsBlockEntry());  // Doesn't make sense to delete these.
   ASSERT(previous_ != NULL);
   previous_->next_ = next_;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Jan 14 16:37:09 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Jan 15 09:53:54 2014 UTC
@@ -311,30 +311,6 @@
   }
   return result;
 }
-
-
-void HBasicBlock::ReplaceControlWithGotoSuccessor(int succ) {
-  ASSERT(IsFinished());
- ASSERT(end()->SuccessorCount() == 2); // Only this case is supported yet.
-  ASSERT(succ < end()->SuccessorCount());
-
-  int unreachable_succ = 1 - succ;
-
- // Replace control instruction with if (true) {succ} else {unreachable_succ}.
-  HBranch* new_branch = HBranch::New(
-      zone(),
-      NULL,
-      graph()->GetConstantTrue(),
-      ToBooleanStub::Types(ToBooleanStub::BOOLEAN),
-      end()->SuccessorAt(succ),
-      end()->SuccessorAt(unreachable_succ));
-
-  MarkSuccEdgeUnreachable(unreachable_succ);
-
-  end()->DeleteAndReplaceWith(end()->ActualValue());
-  new_branch->InsertAfter(last());
-  end_ = new_branch;
-}


 void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
@@ -353,15 +329,6 @@
     loop_information()->RegisterBackEdge(predecessors()->at(i));
   }
 }
-
-
-void HBasicBlock::MarkSuccEdgeUnreachable(int succ) {
-  ASSERT(IsFinished());
-  HBasicBlock* succ_block = end()->SuccessorAt(succ);
-
-  ASSERT(succ_block->predecessors()->length() == 1);
-  succ_block->MarkUnreachable();
-}


 void HBasicBlock::RegisterPredecessor(HBasicBlock* pred) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Tue Jan 14 16:06:40 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h      Wed Jan 15 09:53:54 2014 UTC
@@ -114,8 +114,6 @@
   bool Dominates(HBasicBlock* other) const;
   int LoopNestingDepth() const;

-  void ReplaceControlWithGotoSuccessor(int succ);
-
   void SetInitialEnvironment(HEnvironment* env);
   void ClearEnvironment() {
     ASSERT(IsFinished());
@@ -202,7 +200,6 @@
                        int position);

  private:
-  void MarkSuccEdgeUnreachable(int succ);
   void RegisterPredecessor(HBasicBlock* pred);
   void AddDominatedBlock(HBasicBlock* block);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to