Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 4544) |
+++ src/heap.cc (working copy) |
@@ -1761,41 +1761,6 @@ |
} |
-Object* Heap::SmiOrNumberFromDouble(double value, |
- bool new_object, |
- 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. |
- static const DoubleRepresentation plus_zero(0.0); |
- static const DoubleRepresentation minus_zero(-0.0); |
- static const DoubleRepresentation nan(OS::nan_value()); |
- ASSERT(minus_zero_value() != NULL); |
- ASSERT(sizeof(plus_zero.value) == sizeof(plus_zero.bits)); |
- |
- DoubleRepresentation rep(value); |
- if (rep.bits == plus_zero.bits) return Smi::FromInt(0); // not uncommon |
- if (rep.bits == minus_zero.bits) { |
- return new_object ? AllocateHeapNumber(-0.0, pretenure) |
- : minus_zero_value(); |
- } |
- if (rep.bits == nan.bits) { |
- return new_object |
- ? AllocateHeapNumber(OS::nan_value(), pretenure) |
- : nan_value(); |
- } |
- |
- // Try to represent the value as a tagged small integer. |
- int int_value = FastD2I(value); |
- if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { |
- return Smi::FromInt(int_value); |
- } |
- |
- // Materialize the value in the heap. |
- return AllocateHeapNumber(value, pretenure); |
-} |
- |
- |
Object* Heap::NumberToString(Object* number, bool check_number_string_cache) { |
Counters::number_to_string_runtime.Increment(); |
if (check_number_string_cache) { |
@@ -1853,17 +1818,24 @@ |
} |
-Object* Heap::NewNumberFromDouble(double value, PretenureFlag pretenure) { |
- return SmiOrNumberFromDouble(value, |
- true /* number object must be new */, |
- pretenure); |
-} |
+Object* Heap::NumberFromDouble(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. |
+ static const DoubleRepresentation minus_zero(-0.0); |
+ DoubleRepresentation rep(value); |
+ if (rep.bits == minus_zero.bits) { |
+ return AllocateHeapNumber(-0.0, pretenure); |
+ } |
-Object* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { |
- return SmiOrNumberFromDouble(value, |
- false /* use preallocated NaN, -0.0 */, |
- pretenure); |
+ int int_value = FastD2I(value); |
+ if (value == int_value && Smi::IsValid(int_value)) { |
+ return Smi::FromInt(int_value); |
+ } |
+ |
+ // Materialize the value in the heap. |
+ return AllocateHeapNumber(value, pretenure); |
} |