From: verwaest@chromium.org Date: Wed, 12 Feb 2014 18:30:41 +0000 (+0000) Subject: Don't propagate information through phis in loop headers. X-Git-Tag: upstream/4.7.83~10740 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b7e3658f771baf05e76e9e47d0f05f0e18e18ce;p=platform%2Fupstream%2Fv8.git 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= R=ishell@chromium.org Review URL: https://codereview.chromium.org/147023005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19341 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc index 5fdb3e3..59b1b26 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(); 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 0000000..3791c35 --- /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); +assertEquals(3, f());