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

Unified Diff: src/objects.cc

Issue 2652553003: Access double fields in C++ as uint64_t fields to preserve signaling bit of a NaN. (Closed)
Patch Set: More fixes 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 2114009472be31d7418463d50b760a7308a8e450..4542e19293a7b216fc1af216877b17fd8bf8bc13 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3641,9 +3641,9 @@ void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
DCHECK_EQ(kField, old_details.location());
FieldIndex index = FieldIndex::ForDescriptor(*old_map, i);
if (object->IsUnboxedDoubleField(index)) {
- double old = object->RawFastDoublePropertyAt(index);
- value = isolate->factory()->NewHeapNumber(
- old, representation.IsDouble() ? MUTABLE : IMMUTABLE);
+ uint64_t old_bits = object->RawFastDoublePropertyAsBitsAt(index);
+ value = isolate->factory()->NewHeapNumberFromBits(
+ old_bits, representation.IsDouble() ? MUTABLE : IMMUTABLE);
} else {
value = handle(object->RawFastPropertyAt(index), isolate);
@@ -3693,8 +3693,9 @@ void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
// yet.
if (new_map->IsUnboxedDoubleField(index)) {
DCHECK(value->IsMutableHeapNumber());
- object->RawFastDoublePropertyAtPut(index,
- HeapNumber::cast(value)->value());
+ // Ensure that all bits of the double value are preserved.
+ object->RawFastDoublePropertyAsBitsAtPut(
+ index, HeapNumber::cast(value)->value_as_bits());
if (i < old_number_of_fields && !old_map->IsUnboxedDoubleField(index)) {
// Transition from tagged to untagged slot.
heap->ClearRecordedSlot(*object,
@@ -7949,8 +7950,9 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i);
if (object->IsUnboxedDoubleField(index)) {
if (copying) {
- double value = object->RawFastDoublePropertyAt(index);
- copy->RawFastDoublePropertyAtPut(index, value);
+ // Ensure that all bits of the double value are preserved.
+ uint64_t value = object->RawFastDoublePropertyAsBitsAt(index);
+ copy->RawFastDoublePropertyAsBitsAtPut(index, value);
}
} else {
Handle<Object> value(object->RawFastPropertyAt(index), isolate);
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698