Revision: 19693
Author: [email protected]
Date: Thu Mar 6 16:21:09 2014 UTC
Log: Fix HConstants with Smi-ranged HeapNumber values
BUG=chromium:349878
LOG=y
[email protected]
Review URL: https://codereview.chromium.org/186123003
http://code.google.com/p/v8/source/detail?r=19693
Added:
/branches/bleeding_edge/test/mjsunit/regress/regress-crbug-349878.js
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-349878.js
Thu Mar 6 16:21:09 2014 UTC
@@ -0,0 +1,33 @@
+// 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(a, b) {
+ a == b;
+}
+
+f({}, {});
+
+var a = { y: 1.5 };
+a.y = 777;
+var b = a.y;
+
+function h() {
+ var d = 1;
+ var e = 777;
+ while (d-- > 0) e++;
+ f(1, e);
+}
+
+var global;
+function g() {
+ global = b;
+ return h(b);
+}
+
+g();
+g();
+%OptimizeFunctionOnNextCall(g);
+g();
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Mar 6
09:49:10 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Mar 6
16:21:09 2014 UTC
@@ -2562,7 +2562,11 @@
boolean_value_(integer_value != 0),
int32_value_(integer_value),
double_value_(FastI2D(integer_value)) {
- set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber());
+ // It's possible to create a constant with a value in Smi-range but
stored
+ // in a (pre-existing) HeapNumber. See crbug.com/349878.
+ bool could_be_heapobject = r.IsTagged() && !object.handle().is_null();
+ bool is_smi = has_smi_value_ && !could_be_heapobject;
+ set_type(is_smi ? HType::Smi() : HType::TaggedNumber());
Initialize(r);
}
@@ -2582,7 +2586,11 @@
int32_value_(DoubleToInt32(double_value)),
double_value_(double_value) {
has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_);
- set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber());
+ // It's possible to create a constant with a value in Smi-range but
stored
+ // in a (pre-existing) HeapNumber. See crbug.com/349878.
+ bool could_be_heapobject = r.IsTagged() && !object.handle().is_null();
+ bool is_smi = has_smi_value_ && !could_be_heapobject;
+ set_type(is_smi ? HType::Smi() : HType::TaggedNumber());
Initialize(r);
}
--
--
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.