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.
}
-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,
void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object,
HInstruction* object);
- void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object,
- HInstruction* object,
- HInstruction* object_elements);
-
void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object,
HInstruction* object,
AllocationSiteUsageContext* site_context,
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --nouse-allocation-folding --stress-compaction --predictable
+
+function f() {
+ return [[], [], [[], [], []]];
+}
+
+for (var i=0; i<10000; i++) {
+ f();
+}