Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: src/heap/heap.cc

Issue 2652553003: Access double fields in C++ as uint64_t fields to preserve signaling bit of a NaN. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | src/objects-inl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 36034200a6d74a434839362ceaa9cb57902e1e92..5e77e06b35f4cc49e66a8cfc80c7ca2c85d77119 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2415,8 +2415,7 @@ bool Heap::CreateInitialMaps() {
return true;
}
-
-AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode,
+AllocationResult Heap::AllocateHeapNumber(MutableMode mode,
PretenureFlag pretenure) {
// Statically ensure that it is safe to allocate heap numbers in paged
// spaces.
@@ -2433,7 +2432,6 @@ AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode,
Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map();
HeapObject::cast(result)->set_map_no_write_barrier(map);
- HeapNumber::cast(result)->set_value(value);
return result;
}
@@ -2600,8 +2598,11 @@ void Heap::CreateInitialObjects() {
set_nan_value(*factory->NewHeapNumber(
std::numeric_limits<double>::quiet_NaN(), IMMUTABLE, TENURED));
- set_hole_nan_value(*factory->NewHeapNumber(bit_cast<double>(kHoleNanInt64),
- IMMUTABLE, TENURED));
+ {
+ Handle<HeapNumber> value = factory->NewHeapNumber(0.0, IMMUTABLE, TENURED);
+ value->set_value_as_bits(kHoleNanInt64);
+ set_hole_nan_value(*value);
+ }
set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED));
set_minus_infinity_value(
*factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED));
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698