Index: src/lookup.cc |
diff --git a/src/lookup.cc b/src/lookup.cc |
index 834870a454eabd85669d2e607210f3aa18ce9861..296d192083a76120b5e5a6697ae8822130f00495 100644 |
--- a/src/lookup.cc |
+++ b/src/lookup.cc |
@@ -121,26 +121,10 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) { |
JSObject::UpdateAllocationSite(holder, new_kind); |
if (IsFastDoubleElementsKind(old_kind) != |
IsFastDoubleElementsKind(new_kind)) { |
- Handle<FixedArrayBase> old_elements(holder->elements()); |
- int capacity = old_elements->length(); |
- Handle<FixedArrayBase> new_elements; |
- if (IsFastDoubleElementsKind(new_kind)) { |
- new_elements = factory()->NewFixedDoubleArray(capacity); |
- } else { |
- new_elements = factory()->NewFixedArray(capacity); |
- } |
- |
+ uint32_t capacity = holder->elements()->length(); |
ElementsAccessor* accessor = ElementsAccessor::ForKind(new_kind); |
- accessor->CopyElements(holder, new_elements, old_kind); |
- |
- JSObject::ValidateElements(holder); |
- JSObject::SetMapAndElements(holder, holder_map_, new_elements); |
- |
- if (FLAG_trace_elements_transitions) { |
- JSObject::PrintElementsTransition( |
- stdout, holder, old_kind, old_elements, new_kind, new_elements); |
- } |
- // SetMapAndElements above migrated the object. No reloading of property |
+ accessor->GrowCapacityAndConvert(holder, capacity); |
+ // GrowCapacityAndConvert migrated the object. No reloading of property |
// infomation is necessary for elements. |
return; |
} else if (FLAG_trace_elements_transitions) { |