Reviewers: Igor Sheludko, titzer,

Message:
PTAL

Description:
Don't propagate information through phis in loop headers.
To properly do this, we'd have to iterate over CompareMaps (and their bodies) handling phis, until we have learned enough to decide which paths can be taken.
For now, just disable learning from phis in loop headers.

BUG=

Please review this at https://codereview.chromium.org/147023005/

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

Affected files (+22, -1 lines):
  M src/hydrogen-check-elimination.cc
  A test/mjsunit/regress/regress-check-eliminate-loop-phis.js


Index: src/hydrogen-check-elimination.cc
diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc index 5fdb3e3f3c48fa1260005eeeab7ec7e6ae537ebd..59b1b266844d455b9042d0505057013de47d3b4d 100644
--- a/src/hydrogen-check-elimination.cc
+++ b/src/hydrogen-check-elimination.cc
@@ -164,7 +164,7 @@ class HCheckTable : public ZoneObject {
     copy->size_ = size_;

     // Create entries for succ block's phis.
-    if (succ->phis()->length() > 0) {
+    if (!succ->IsLoopHeader() && succ->phis()->length() > 0) {
       int pred_index = succ->PredecessorIndexOf(from_block);
       for (int phi_index = 0;
            phi_index < succ->phis()->length();
Index: test/mjsunit/regress/regress-check-eliminate-loop-phis.js
diff --git a/test/mjsunit/regress/regress-check-eliminate-loop-phis.js b/test/mjsunit/regress/regress-check-eliminate-loop-phis.js
new file mode 100644
index 0000000000000000000000000000000000000000..f4d8ae719f253e74f7cdd508aecaa90dc76a847d
--- /dev/null
+++ b/test/mjsunit/regress/regress-check-eliminate-loop-phis.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function f() {
+  var o = {x:1};
+  var y = {y:2.5, x:0};
+  var result;
+  for (var i = 0; i < 2; i++) {
+    result = o.x + 3;
+    o = y;
+  }
+  return result;
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+print(f());


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