Do not use ranges after range analysis.
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 10 Apr 2014 09:40:17 +0000 (09:40 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 10 Apr 2014 09:40:17 +0000 (09:40 +0000)
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
test/mjsunit/regress/regress-361608.js [new file with mode: 0644]

index ea5ef9f..e82e6e8 100644 (file)
@@ -179,12 +179,9 @@ template<int R>
 bool LTemplateResultInstruction<R>::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 (file)
index 0000000..b3cc90c
--- /dev/null
@@ -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();