Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 903f776c47943d596ba0e40b0a7fecae23d63226..2cd1ee73f9ab3764790ecdba1800cd52a75bd265 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1094,13 +1094,9 @@ Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( |
Handle<Object> Factory::NewNumber(double value, |
PretenureFlag pretenure) { |
- // We need to distinguish the minus zero value and this cannot be |
- // done after conversion to int. Doing this by comparing bit |
- // patterns is faster than using fpclassify() et al. |
- if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure); |
- |
- int int_value = FastD2IChecked(value); |
- if (value == int_value && Smi::IsValid(int_value)) { |
+ // Materialize as a SMI if possible |
+ int32_t int_value; |
+ if (DoubleToSmiInteger(value, &int_value)) { |
return handle(Smi::FromInt(int_value), isolate()); |
} |