| Index: src/crankshaft/hydrogen-instructions.cc
|
| diff --git a/src/crankshaft/hydrogen-instructions.cc b/src/crankshaft/hydrogen-instructions.cc
|
| index 9947dee6d4b4a172c0c1abf5b317e53d1f5d5d6a..b8020c727064914dae35b8478b9be95be8bbee8b 100644
|
| --- a/src/crankshaft/hydrogen-instructions.cc
|
| +++ b/src/crankshaft/hydrogen-instructions.cc
|
| @@ -2172,6 +2172,32 @@ HConstant::HConstant(Handle<Object> object, Representation r)
|
| BooleanValueField::encode(object->BooleanValue()) |
|
| IsUndetectableField::encode(false) | IsCallableField::encode(false) |
|
| InstanceTypeField::encode(kUnknownInstanceType)) {
|
| + if (object->IsNumber()) {
|
| + double n = object->Number();
|
| + bool has_int32_value = IsInteger32(n);
|
| + bit_field_ = HasInt32ValueField::update(bit_field_, has_int32_value);
|
| + int32_value_ = DoubleToInt32(n);
|
| + bit_field_ = HasSmiValueField::update(
|
| + bit_field_, has_int32_value && Smi::IsValid(int32_value_));
|
| + if (std::isnan(n)) {
|
| + double_value_ = std::numeric_limits<double>::quiet_NaN();
|
| + // Canonicalize object with NaN value.
|
| + DCHECK(object->IsHeapObject()); // NaN can't be a Smi.
|
| + Isolate* isolate = HeapObject::cast(*object)->GetIsolate();
|
| + object = isolate->factory()->nan_value();
|
| + object_ = Unique<Object>::CreateUninitialized(object);
|
| + } else {
|
| + double_value_ = n;
|
| + // Canonicalize object with -0.0 value.
|
| + if (bit_cast<int64_t>(n) == bit_cast<int64_t>(-0.0)) {
|
| + DCHECK(object->IsHeapObject()); // -0.0 can't be a Smi.
|
| + Isolate* isolate = HeapObject::cast(*object)->GetIsolate();
|
| + object = isolate->factory()->minus_zero_value();
|
| + object_ = Unique<Object>::CreateUninitialized(object);
|
| + }
|
| + }
|
| + bit_field_ = HasDoubleValueField::update(bit_field_, true);
|
| + }
|
| if (object->IsHeapObject()) {
|
| Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object);
|
| Isolate* isolate = heap_object->GetIsolate();
|
| @@ -2187,20 +2213,6 @@ HConstant::HConstant(Handle<Object> object, Representation r)
|
| bit_field_,
|
| HasMapValue() && Handle<Map>::cast(heap_object)->is_stable());
|
| }
|
| - if (object->IsNumber()) {
|
| - double n = object->Number();
|
| - bool has_int32_value = IsInteger32(n);
|
| - bit_field_ = HasInt32ValueField::update(bit_field_, has_int32_value);
|
| - int32_value_ = DoubleToInt32(n);
|
| - bit_field_ = HasSmiValueField::update(
|
| - bit_field_, has_int32_value && Smi::IsValid(int32_value_));
|
| - if (std::isnan(n)) {
|
| - double_value_ = std::numeric_limits<double>::quiet_NaN();
|
| - } else {
|
| - double_value_ = n;
|
| - }
|
| - bit_field_ = HasDoubleValueField::update(bit_field_, true);
|
| - }
|
|
|
| Initialize(r);
|
| }
|
|
|