Version 2.2.7
Added support for ES5 date time string format to Date.parse.
Performance improvements in the x64 backend.
git-svn-id: http://v8.googlecode.com/svn/trunk@4565 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/heap.cc b/src/heap.cc
index 0cd1791..55d6c97 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -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) {
- return SmiOrNumberFromDouble(value,
- false /* use preallocated NaN, -0.0 */,
- 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);
+ }
+
+ 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);
}