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

Unified Diff: src/hydrogen.cc

Issue 13693004: Refactoring BuildAllocateElements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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') | no next file » | 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 20973f02338f88996f17d57d974eb5fe3a0c02fd..bb3ef5e4706c7474ba58c4002925e71861b65a3e 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1245,7 +1245,6 @@ HInstruction* HGraphBuilder::BuildFastArrayLengthLoad(HValue* object,
HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
ElementsKind kind,
HValue* capacity) {
- BailoutId ast_id = current_block()->last_environment()->previous_ast_id();
Zone* zone = this->zone();
int elements_size = IsFastDoubleElementsKind(kind)
@@ -1280,7 +1279,15 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
HValue* elements =
AddInstruction(new(zone) HAllocate(context, total_size,
HType::JSArray(), flags));
+ return elements;
+}
+
+void HGraphBuilder::BuildInitializeElements(HValue* elements,
+ ElementsKind kind,
+ HValue* capacity) {
+ Zone* zone = this->zone();
+ BailoutId ast_id = current_block()->last_environment()->previous_ast_id();
Factory* factory = isolate()->factory();
Handle<Map> map = IsFastDoubleElementsKind(kind)
? factory->fixed_double_array_map()
@@ -1293,8 +1300,16 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
capacity, true, FixedArray::kLengthOffset);
AddInstruction(store_length);
AddSimulate(ast_id, REMOVABLE_SIMULATE);
+}
- return elements;
+
+HValue* HGraphBuilder::BuildAllocateAndInitializeElements(HValue* context,
+ ElementsKind kind,
+ HValue* capacity) {
+ HValue* new_elements =
+ BuildAllocateElements(context, kind, capacity);
+ BuildInitializeElements(new_elements, kind, capacity);
+ return new_elements;
}
@@ -1379,7 +1394,7 @@ HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
BuildNewSpaceArrayCheck(new_capacity, kind);
HValue* new_elements =
- BuildAllocateElements(context, kind, new_capacity);
+ BuildAllocateAndInitializeElements(context, kind, new_capacity);
BuildCopyElements(context, elements, kind,
new_elements, kind,
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698