Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index c836dc21653129de5d7255a3c8d8b2e9c63e71c0..c25d1f77d260db6a71e3bbad65a22b5bf2200cab 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2536,6 +2536,17 @@ void HGraphBuilder::BuildCopyElements(HValue* array, |
} |
} |
+ bool pre_fill_with_holes = |
+ IsFastDoubleElementsKind(from_elements_kind) && |
+ IsFastObjectElementsKind(to_elements_kind); |
+ if (pre_fill_with_holes) { |
+ // If the copy might trigger a GC, make sure that the FixedArray is |
+ // pre-initialized with holes to make sure that it's always in a |
+ // consistent state. |
+ BuildFillElementsWithHole(to_elements, to_elements_kind, |
+ graph()->GetConstant0(), NULL); |
+ } |
+ |
if (constant_capacity != -1) { |
// Unroll the loop for small elements kinds. |
for (int i = 0; i < constant_capacity; i++) { |
@@ -2546,17 +2557,8 @@ void HGraphBuilder::BuildCopyElements(HValue* array, |
Add<HStoreKeyed>(to_elements, key_constant, value, to_elements_kind); |
} |
} else { |
- bool pre_fill_with_holes = |
- IsFastDoubleElementsKind(from_elements_kind) && |
- IsFastObjectElementsKind(to_elements_kind); |
- |
- if (pre_fill_with_holes) { |
- // If the copy might trigger a GC, make sure that the FixedArray is |
- // pre-initialized with holes to make sure that it's always in a |
- // consistent state. |
- BuildFillElementsWithHole(to_elements, to_elements_kind, |
- graph()->GetConstant0(), NULL); |
- } else if (capacity == NULL || !length->Equals(capacity)) { |
+ if (!pre_fill_with_holes && |
+ (capacity == NULL || !length->Equals(capacity))) { |
BuildFillElementsWithHole(to_elements, to_elements_kind, |
length, NULL); |
} |