Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 8dbda270fe3644d6647db538d05b67274e19aacf..efdb5499d212ef55c16cc214f5a088736d47553e 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -3388,17 +3388,22 @@ MaybeObject* Heap::CopyJSObject(JSObject* source) { |
object_size); |
} |
- FixedArray* elements = FixedArray::cast(source->elements()); |
+ FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); |
FixedArray* properties = FixedArray::cast(source->properties()); |
// Update elements if necessary. |
if (elements->length() > 0) { |
Object* elem; |
- { MaybeObject* maybe_elem = |
- (elements->map() == fixed_cow_array_map()) ? |
- elements : CopyFixedArray(elements); |
+ { MaybeObject* maybe_elem; |
+ if (elements->map() == fixed_cow_array_map()) { |
+ maybe_elem = FixedArray::cast(elements); |
+ } else if (source->HasFastDoubleElements()) { |
+ maybe_elem = CopyFixedDoubleArray(FixedDoubleArray::cast(elements)); |
+ } else { |
+ maybe_elem = CopyFixedArray(FixedArray::cast(elements)); |
+ } |
if (!maybe_elem->ToObject(&elem)) return maybe_elem; |
} |
- JSObject::cast(clone)->set_elements(FixedArray::cast(elem)); |
+ JSObject::cast(clone)->set_elements(FixedArrayBase::cast(elem)); |
} |
// Update properties if necessary. |
if (properties->length() > 0) { |
@@ -3757,6 +3762,23 @@ MaybeObject* Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) { |
} |
+MaybeObject* Heap::CopyFixedDoubleArrayWithMap(FixedDoubleArray* src, |
+ Map* map) { |
+ int len = src->length(); |
+ Object* obj; |
+ { MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(len, NOT_TENURED); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
+ HeapObject* dst = HeapObject::cast(obj); |
+ dst->set_map(map); |
+ CopyBlock( |
+ dst->address() + FixedDoubleArray::kLengthOffset, |
+ src->address() + FixedDoubleArray::kLengthOffset, |
+ FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset); |
+ return obj; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateFixedArray(int length) { |
ASSERT(length >= 0); |
if (length == 0) return empty_fixed_array(); |