Reviewers: Kevin Millikin, fschneider,

Description:
Fix shortcutting bug in HInferRepresentation

* src/hydrogen.cc (HInferRepresentation::Analyze): Fix iterative loop
  over phis; the shortcutting behavior of || appears to be accidental
  here, causing O(n^2) convergence.  Not that it matters much, but hey!

While I'm at it, a minor comment fix:

* src/hydrogen-instructions.h (EnsureAndPropagateNotMinusZero): Fix a
  comment about the kinds of instructions that propagate to multiple
  inputs.

BUG=
TEST=passes tools/test.py


Please review this at http://codereview.chromium.org/7350019/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/hydrogen-instructions.h
  M src/hydrogen.cc


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 401c2e4a0376b33ad9c00df5d78b46026dbe901c..46d5393c5aef052fba48aef048529fd1123ffffc 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -588,9 +588,9 @@ class HValue: public ZoneObject {
// it would otherwise output what should be a minus zero as an int32 zero. // If the operation also exists in a form that takes int32 and outputs int32 // then the operation should return its input value so that we can propagate - // back. There are two operations that need to propagate back to more than
-  // one input.  They are phi and binary add.  They always return NULL and
-  // expect the caller to take care of things.
+ // back. There are three operations that need to propagate back to more than + // one input. They are phi and binary div and mul. They always return NULL
+  // and expect the caller to take care of things.
   virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) {
     visited->Add(id());
     return NULL;
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 887ba7360282c7f2d39904ff150b240c4a5001af..b3f428cb3a793ffbb2c940fd7040cda7d65b1c54 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1666,8 +1666,8 @@ void HInferRepresentation::Analyze() {
         HValue* use = it.value();
         if (use->IsPhi()) {
           int id = HPhi::cast(use)->phi_id();
-          change = change ||
-              connected_phis[i]->UnionIsChanged(*connected_phis[id]);
+          if (connected_phis[i]->UnionIsChanged(*connected_phis[id]))
+            change = true;
         }
       }
     }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to