OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 } | 3634 } |
3635 } else { | 3635 } else { |
3636 DCHECK_EQ(kData, old_details.kind()); | 3636 DCHECK_EQ(kData, old_details.kind()); |
3637 value = handle(old_descriptors->GetValue(i), isolate); | 3637 value = handle(old_descriptors->GetValue(i), isolate); |
3638 DCHECK(!old_representation.IsDouble() && !representation.IsDouble()); | 3638 DCHECK(!old_representation.IsDouble() && !representation.IsDouble()); |
3639 } | 3639 } |
3640 } else { | 3640 } else { |
3641 DCHECK_EQ(kField, old_details.location()); | 3641 DCHECK_EQ(kField, old_details.location()); |
3642 FieldIndex index = FieldIndex::ForDescriptor(*old_map, i); | 3642 FieldIndex index = FieldIndex::ForDescriptor(*old_map, i); |
3643 if (object->IsUnboxedDoubleField(index)) { | 3643 if (object->IsUnboxedDoubleField(index)) { |
3644 double old = object->RawFastDoublePropertyAt(index); | 3644 uint64_t old_bits = object->RawFastDoublePropertyAsBitsAt(index); |
3645 value = isolate->factory()->NewHeapNumber( | 3645 value = isolate->factory()->NewHeapNumberFromBits( |
3646 old, representation.IsDouble() ? MUTABLE : IMMUTABLE); | 3646 old_bits, representation.IsDouble() ? MUTABLE : IMMUTABLE); |
3647 | 3647 |
3648 } else { | 3648 } else { |
3649 value = handle(object->RawFastPropertyAt(index), isolate); | 3649 value = handle(object->RawFastPropertyAt(index), isolate); |
3650 if (!old_representation.IsDouble() && representation.IsDouble()) { | 3650 if (!old_representation.IsDouble() && representation.IsDouble()) { |
3651 DCHECK_IMPLIES(old_representation.IsNone(), | 3651 DCHECK_IMPLIES(old_representation.IsNone(), |
3652 value->IsUninitialized(isolate)); | 3652 value->IsUninitialized(isolate)); |
3653 value = Object::NewStorageFor(isolate, value, representation); | 3653 value = Object::NewStorageFor(isolate, value, representation); |
3654 } else if (old_representation.IsDouble() && | 3654 } else if (old_representation.IsDouble() && |
3655 !representation.IsDouble()) { | 3655 !representation.IsDouble()) { |
3656 value = Object::WrapForRead(isolate, value, old_representation); | 3656 value = Object::WrapForRead(isolate, value, old_representation); |
(...skipping 29 matching lines...) Expand all Loading... |
3686 // Copy (real) inobject properties. If necessary, stop at number_of_fields to | 3686 // Copy (real) inobject properties. If necessary, stop at number_of_fields to |
3687 // avoid overwriting |one_pointer_filler_map|. | 3687 // avoid overwriting |one_pointer_filler_map|. |
3688 int limit = Min(inobject, number_of_fields); | 3688 int limit = Min(inobject, number_of_fields); |
3689 for (int i = 0; i < limit; i++) { | 3689 for (int i = 0; i < limit; i++) { |
3690 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); | 3690 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); |
3691 Object* value = array->get(external + i); | 3691 Object* value = array->get(external + i); |
3692 // Can't use JSObject::FastPropertyAtPut() because proper map was not set | 3692 // Can't use JSObject::FastPropertyAtPut() because proper map was not set |
3693 // yet. | 3693 // yet. |
3694 if (new_map->IsUnboxedDoubleField(index)) { | 3694 if (new_map->IsUnboxedDoubleField(index)) { |
3695 DCHECK(value->IsMutableHeapNumber()); | 3695 DCHECK(value->IsMutableHeapNumber()); |
3696 object->RawFastDoublePropertyAtPut(index, | 3696 // Ensure that all bits of the double value are preserved. |
3697 HeapNumber::cast(value)->value()); | 3697 object->RawFastDoublePropertyAsBitsAtPut( |
| 3698 index, HeapNumber::cast(value)->value_as_bits()); |
3698 if (i < old_number_of_fields && !old_map->IsUnboxedDoubleField(index)) { | 3699 if (i < old_number_of_fields && !old_map->IsUnboxedDoubleField(index)) { |
3699 // Transition from tagged to untagged slot. | 3700 // Transition from tagged to untagged slot. |
3700 heap->ClearRecordedSlot(*object, | 3701 heap->ClearRecordedSlot(*object, |
3701 HeapObject::RawField(*object, index.offset())); | 3702 HeapObject::RawField(*object, index.offset())); |
3702 } else { | 3703 } else { |
3703 DCHECK(!heap->HasRecordedSlot( | 3704 DCHECK(!heap->HasRecordedSlot( |
3704 *object, HeapObject::RawField(*object, index.offset()))); | 3705 *object, HeapObject::RawField(*object, index.offset()))); |
3705 } | 3706 } |
3706 } else { | 3707 } else { |
3707 object->RawFastPropertyAtPut(index, value); | 3708 object->RawFastPropertyAtPut(index, value); |
(...skipping 4234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7942 if (copy->HasFastProperties()) { | 7943 if (copy->HasFastProperties()) { |
7943 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); | 7944 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); |
7944 int limit = copy->map()->NumberOfOwnDescriptors(); | 7945 int limit = copy->map()->NumberOfOwnDescriptors(); |
7945 for (int i = 0; i < limit; i++) { | 7946 for (int i = 0; i < limit; i++) { |
7946 PropertyDetails details = descriptors->GetDetails(i); | 7947 PropertyDetails details = descriptors->GetDetails(i); |
7947 if (details.location() != kField) continue; | 7948 if (details.location() != kField) continue; |
7948 DCHECK_EQ(kData, details.kind()); | 7949 DCHECK_EQ(kData, details.kind()); |
7949 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); | 7950 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); |
7950 if (object->IsUnboxedDoubleField(index)) { | 7951 if (object->IsUnboxedDoubleField(index)) { |
7951 if (copying) { | 7952 if (copying) { |
7952 double value = object->RawFastDoublePropertyAt(index); | 7953 // Ensure that all bits of the double value are preserved. |
7953 copy->RawFastDoublePropertyAtPut(index, value); | 7954 uint64_t value = object->RawFastDoublePropertyAsBitsAt(index); |
| 7955 copy->RawFastDoublePropertyAsBitsAtPut(index, value); |
7954 } | 7956 } |
7955 } else { | 7957 } else { |
7956 Handle<Object> value(object->RawFastPropertyAt(index), isolate); | 7958 Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
7957 if (value->IsJSObject()) { | 7959 if (value->IsJSObject()) { |
7958 ASSIGN_RETURN_ON_EXCEPTION( | 7960 ASSIGN_RETURN_ON_EXCEPTION( |
7959 isolate, value, | 7961 isolate, value, |
7960 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), | 7962 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), |
7961 JSObject); | 7963 JSObject); |
7962 if (copying) { | 7964 if (copying) { |
7963 copy->FastPropertyAtPut(index, *value); | 7965 copy->FastPropertyAtPut(index, *value); |
(...skipping 12100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20064 // depend on this. | 20066 // depend on this. |
20065 return DICTIONARY_ELEMENTS; | 20067 return DICTIONARY_ELEMENTS; |
20066 } | 20068 } |
20067 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20069 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20068 return kind; | 20070 return kind; |
20069 } | 20071 } |
20070 } | 20072 } |
20071 | 20073 |
20072 } // namespace internal | 20074 } // namespace internal |
20073 } // namespace v8 | 20075 } // namespace v8 |
OLD | NEW |