Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 04a045b31586428cc1a58abde8bf33c4d0f8d32d..8237cbbd0b950993796d273ef97f99d23d2b3c9e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -9757,6 +9757,18 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
elements->map() != isolate()->heap()->fixed_cow_array_map()) ? |
elements->Size() : 0; |
+ if (pretenure_flag == TENURED && |
+ elements->map() == isolate()->heap()->fixed_cow_array_map() && |
+ isolate()->heap()->InNewSpace(*elements)) { |
+ // If we would like to pretenure a fixed cow array, we must ensure that the |
+ // array is already in old space, otherwise we'll create too many old-to- |
+ // new-space pointers (overflowing the store buffer). |
+ elements = Handle<FixedArrayBase>( |
+ isolate()->factory()->CopyAndTenureFixedCOWArray( |
+ Handle<FixedArray>::cast(elements))); |
+ boilerplate_object->set_elements(*elements); |
+ } |
+ |
HInstruction* object_elements = NULL; |
if (elements_size > 0) { |
HValue* object_elements_size = Add<HConstant>(elements_size); |