Revision: 18885
Author:   [email protected]
Date:     Tue Jan 28 16:57:39 2014 UTC
Log:      Flow engine fixes: unreachable block processing, state merging.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-check-elimination.cc Wed Jan 15 09:53:54 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-check-elimination.cc Tue Jan 28 16:57:39 2014 UTC
@@ -117,7 +117,7 @@
   }

   // Global analysis: Copy state to successor block.
-  HCheckTable* Copy(HBasicBlock* succ, Zone* zone) {
+ HCheckTable* Copy(HBasicBlock* succ, HBasicBlock* from_block, Zone* zone) {
     HCheckTable* copy = new(phase_->zone()) HCheckTable(phase_);
     for (int i = 0; i < size_; i++) {
       HCheckTableEntry* old_entry = &entries_[i];
@@ -173,7 +173,8 @@
   }

   // Global analysis: Merge this state with the other incoming state.
-  HCheckTable* Merge(HBasicBlock* succ, HCheckTable* that, Zone* zone) {
+  HCheckTable* Merge(HBasicBlock* succ, HCheckTable* that,
+                     HBasicBlock* that_block, Zone* zone) {
     if (that->size_ == 0) {
       // If the other state is empty, simply reset.
       size_ = 0;
=======================================
--- /branches/bleeding_edge/src/hydrogen-flow-engine.h Wed Jan 15 09:53:54 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-flow-engine.h Tue Jan 28 16:57:39 2014 UTC
@@ -124,17 +124,19 @@
       if (SkipNonDominatedBlock(root, block)) continue;
       State* state = StateAt(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);
-      }
+      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);
+        }

- // 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.
@@ -149,11 +151,11 @@
             SetStateAt(succ, state);
           } else {
             // Successor needs a copy of the state.
-            SetStateAt(succ, state->Copy(succ, zone_));
+            SetStateAt(succ, state->Copy(succ, block, zone_));
           }
         } else {
// Merge the current state with the state already at the successor.
-          SetStateAt(succ, state->Merge(succ, StateAt(succ), zone_));
+ SetStateAt(succ, StateAt(succ)->Merge(succ, state, block, zone_));
         }
       }
     }
@@ -185,6 +187,7 @@
         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-load-elimination.cc Tue Jan 28 16:45:04 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-load-elimination.cc Tue Jan 28 16:57:39 2014 UTC
@@ -132,8 +132,10 @@
     return this;
   }

- // Support for global analysis with HFlowEngine: Copy state to sucessor block.
-  HLoadEliminationTable* Copy(HBasicBlock* succ, Zone* zone) {
+  // Support for global analysis with HFlowEngine: Copy state to successor
+  // block.
+  HLoadEliminationTable* Copy(HBasicBlock* succ, HBasicBlock* from_block,
+                              Zone* zone) {
     HLoadEliminationTable* copy =
         new(zone) HLoadEliminationTable(zone, aliasing_);
     copy->EnsureFields(fields_.length());
@@ -149,8 +151,8 @@

   // Support for global analysis with HFlowEngine: Merge this state with
   // the other incoming state.
-  HLoadEliminationTable* Merge(HBasicBlock* succ,
-      HLoadEliminationTable* that, Zone* zone) {
+ HLoadEliminationTable* Merge(HBasicBlock* succ, HLoadEliminationTable* that,
+                               HBasicBlock* that_block, Zone* zone) {
     if (that->fields_.length() < fields_.length()) {
       // Drop fields not in the other table.
       fields_.Rewind(that->fields_.length());

--
--
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