Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 2ac3d520dbfbbba913f20e1e3e729223caf54de0..f226730a2b7ecff126703c6d9b0a214a7c2bb946 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -11338,13 +11338,16 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
object_elements = |
Add<HAllocate>(object_elements_size, HType::HeapObject(), |
pretenure_flag, instance_type, current_site); |
- } |
- BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); |
- |
- // Copy object elements if non-COW. |
- if (object_elements != NULL) { |
BuildEmitElements(boilerplate_object, elements, object_elements, |
site_context); |
+ Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
+ object_elements); |
+ } else { |
+ Handle<Object> elements_field = |
+ Handle<Object>(boilerplate_object->elements(), isolate()); |
+ HInstruction* object_elements_cow = Add<HConstant>(elements_field); |
+ Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
+ object_elements_cow); |
} |
// Copy in-object properties. |
@@ -11386,21 +11389,6 @@ void HOptimizedGraphBuilder::BuildEmitObjectHeader( |
} |
-void HOptimizedGraphBuilder::BuildInitElementsInObjectHeader( |
- Handle<JSObject> boilerplate_object, |
- HInstruction* object, |
- HInstruction* object_elements) { |
- DCHECK(boilerplate_object->properties()->length() == 0); |
- if (object_elements == NULL) { |
- Handle<Object> elements_field = |
- Handle<Object>(boilerplate_object->elements(), isolate()); |
- object_elements = Add<HConstant>(elements_field); |
- } |
- Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
- object_elements); |
-} |
- |
- |
void HOptimizedGraphBuilder::BuildEmitInObjectProperties( |
Handle<JSObject> boilerplate_object, |
HInstruction* object, |