Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index e5a93a7bd5b1f4ec513e0427d54f033b0fdf5dce..f13f79cc74e1d90cc81365f18c994363bd90a84e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2789,12 +2789,6 @@ void HGraphBuilder::BuildFillElementsWithValue(HValue* elements, |
} |
} |
- // Since we're about to store a hole value, the store instruction below must |
- // assume an elements kind that supports heap object values. |
- if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
- elements_kind = FAST_HOLEY_ELEMENTS; |
- } |
- |
if (initial_capacity >= 0) { |
for (int i = 0; i < initial_capacity; i++) { |
HInstruction* key = Add<HConstant>(i); |
@@ -2832,10 +2826,40 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements, |
? Add<HConstant>(factory->the_hole_value()) |
: Add<HConstant>(nan_double); |
+ // Since we're about to store a hole value, the store instruction below must |
+ // assume an elements kind that supports heap object values. |
+ if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
+ elements_kind = FAST_HOLEY_ELEMENTS; |
+ } |
+ |
BuildFillElementsWithValue(elements, elements_kind, from, to, hole); |
} |
+void HGraphBuilder::BuildCopyProperties(HValue* from_properties, |
+ HValue* to_properties, HValue* length, |
+ HValue* capacity) { |
+ ElementsKind kind = FAST_ELEMENTS; |
+ |
+ BuildFillElementsWithValue(to_properties, kind, length, capacity, |
+ graph()->GetConstantUndefined()); |
+ |
+ LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement); |
+ |
+ HValue* key = builder.BeginBody(length, graph()->GetConstant0(), Token::GT); |
+ |
+ key = AddUncasted<HSub>(key, graph()->GetConstant1()); |
+ key->ClearFlag(HValue::kCanOverflow); |
+ |
+ HValue* element = |
+ Add<HLoadKeyed>(from_properties, key, static_cast<HValue*>(NULL), kind); |
+ |
+ Add<HStoreKeyed>(to_properties, key, element, kind); |
+ |
+ builder.EndBody(); |
+} |
+ |
+ |
void HGraphBuilder::BuildCopyElements(HValue* from_elements, |
ElementsKind from_elements_kind, |
HValue* to_elements, |