From 5bddec047d1e13e8356ca2b88062690318dc6955 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Thu, 10 Apr 2014 09:40:17 +0000 Subject: [PATCH] Do not use ranges after range analysis. Due to the SSA vs. SSI difference, we are only allowed to use the flags computed during range analysis, not the ranges themselves. For the case at hand, there is no such flag, so the condition is simply remvoed. BUG=361608 LOG=y R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/232553004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/lithium-x64.cc | 9 +++------ test/mjsunit/regress/regress-361608.js | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 test/mjsunit/regress/regress-361608.js diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index ea5ef9f..e82e6e8 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -179,12 +179,9 @@ template bool LTemplateResultInstruction::MustSignExtendResult( LPlatformChunk* chunk) const { HValue* hvalue = this->hydrogen_value(); - - if (hvalue == NULL) return false; - if (!hvalue->representation().IsInteger32()) return false; - if (hvalue->HasRange() && !hvalue->range()->CanBeNegative()) return false; - - return chunk->GetDehoistedKeyIds()->Contains(hvalue->id()); + return hvalue != NULL && + hvalue->representation().IsInteger32() && + chunk->GetDehoistedKeyIds()->Contains(hvalue->id()); } diff --git a/test/mjsunit/regress/regress-361608.js b/test/mjsunit/regress/regress-361608.js new file mode 100644 index 0000000..b3cc90c --- /dev/null +++ b/test/mjsunit/regress/regress-361608.js @@ -0,0 +1,20 @@ +// 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() {}; +int_array = [1]; + +function foo() { + var x; + for (var i = -1; i < 0; i++) { + x = int_array[i + 1]; + f(function() { x = i; }); + } +} + +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); -- 2.7.4