Revision: 18090
Author:   [email protected]
Date:     Wed Nov 27 07:13:00 2013 UTC
Log: Avoid copying flow-sensitive state when only a goto separates blocks.

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/hydrogen-flow-engine.h

=======================================
--- /branches/bleeding_edge/src/hydrogen-flow-engine.h Mon Oct 14 09:22:19 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-flow-engine.h Wed Nov 27 07:13:00 2013 UTC
@@ -138,12 +138,19 @@
       }

       // Propagate the block state forward to all successor blocks.
-      for (int i = 0; i < block->end()->SuccessorCount(); i++) {
+      int max = block->end()->SuccessorCount();
+      for (int i = 0; i < max; i++) {
         HBasicBlock* succ = block->end()->SuccessorAt(i);
         IncrementPredecessorCount(succ);
         if (StateAt(succ) == NULL) {
           // This is the first state to reach the successor.
-          SetStateAt(succ, state->Copy(succ, zone_));
+          if (max == 1 && succ->predecessors()->length() == 1) {
+            // Optimization: successor can inherit this state.
+            SetStateAt(succ, state);
+          } else {
+            // Successor needs a copy of the state.
+            SetStateAt(succ, state->Copy(succ, zone_));
+          }
         } else {
// Merge the current state with the state already at the successor.
           SetStateAt(succ, state->Merge(succ, StateAt(succ), zone_));

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