Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Unified Diff: src/hydrogen.cc

Issue 1132763002: Initialize sub-array literals first before pointing to it. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/regress/regress-484544.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/regress/regress-484544.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698