Reviewers: Kasper Lund, fschneider,
Description:
tighten invariants of HValue::InferRange
* src/hydrogen-instructions.cc (HValue::InferRange): Only mark values
with int32 representation as never being -0. Always return a non-NULL
value; callers should check for representation().IsNone() if that's
their concern.
In practice these invariants were not violated by callers, but they
were sometimes two calls away, which seems brittle.
BUG=
TEST=tests pass, modulo http://code.google.com/p/v8/issues/detail?id=1572
Please review this at http://codereview.chromium.org/7514040/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen-instructions.cc
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
2be2a032574b6bf9af1f8560e19fe95d1694bab7..4a27741887729c8c2c002e0d9e5cec0d1145c109
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -862,18 +862,15 @@ void HInstanceOf::PrintDataTo(StringStream* stream) {
Range* HValue::InferRange() {
- if (representation().IsTagged()) {
- // Tagged values are always in int32 range when converted to integer,
- // but they can contain -0.
+ if (representation().IsInteger32 ()) {
+ // Untagged integer32 cannot be -0.
+ return new Range ();
+ } else {
+ // Tagged values, untagged doubles, and values with unknown
representation
+ // can contain -0.
Range* result = new Range();
result->set_can_be_minus_zero(true);
return result;
- } else if (representation().IsNone()) {
- return NULL;
- } else {
- // Untagged integer32 cannot be -0 and we don't compute ranges for
- // untagged doubles.
- return new Range();
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev