Reviewers: Jakob,
Description:
The result of Change to Smi/Int32 will never be minus zero, if the change is
done successfully
Eliminate some useless minus zero check
BUG=
Please review this at https://codereview.chromium.org/61893018/
SVN Base: git://github.com/v8/v8.git@master
Affected files (+12, -3 lines):
M src/hydrogen-instructions.cc
M test/mjsunit/compiler/minus-zero.js
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
79962db8ad118ab80df7acc67298c1831e7756ac..abfce80c13c3925f1b317e9d80d7ec6f46d86e04
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1589,9 +1589,7 @@ Range* HChange::InferRange(Zone* zone) {
Range* result = (input_range != NULL)
? input_range->Copy(zone)
: HValue::InferRange(zone);
- result->set_can_be_minus_zero(!to().IsSmiOrInteger32() ||
- !(CheckFlag(kAllUsesTruncatingToInt32) ||
- CheckFlag(kAllUsesTruncatingToSmi)));
+ result->set_can_be_minus_zero(!to().IsSmiOrInteger32());
if (to().IsSmi()) result->ClampToSmi();
return result;
}
Index: test/mjsunit/compiler/minus-zero.js
diff --git a/test/mjsunit/compiler/minus-zero.js
b/test/mjsunit/compiler/minus-zero.js
index
6efceb54e36834c217732a7974f0c5d2a2cca132..5ff062cfaf12171d570abd2e5ed7d1beb337a910
100644
--- a/test/mjsunit/compiler/minus-zero.js
+++ b/test/mjsunit/compiler/minus-zero.js
@@ -35,3 +35,14 @@ assertEquals(0, add(0, 0));
assertEquals(0, add(0, 0));
%OptimizeFunctionOnNextCall(add);
assertEquals(-0, add(-0, -0));
+
+function foo(x, y, z) {
+ var w = x * y;
+ return w + z;
+}
+
+assertEquals(1, foo(0, 1, 1));
+assertEquals(1, foo(0, 1, 1));
+%OptimizeFunctionOnNextCall(foo);
+assertEquals(1, foo(0, -1, 1));
+assertOptimized(foo);
--
--
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.