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

Unified Diff: src/hydrogen.cc

Issue 14576005: Adapt hydrogen-based Array constructor to also support InternalArray and function call (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Refactoring and restored flag for now Created 7 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index de3254a2721cfc12c599f6a83639fed48928d2bf..d8819620b26e9bcd40cd284ebf4ac7e47a6d9cf5 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1894,7 +1894,8 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
AllocationSiteMode mode) :
builder_(builder),
Michael Starzinger 2013/05/23 09:16:49 nit: Indentation is off.
mvstanton 2013/05/23 14:46:05 Done.
kind_(kind),
- allocation_site_payload_(allocation_site_payload) {
+ allocation_site_payload_(allocation_site_payload),
+ constructor_function_(NULL) {
if (mode == DONT_TRACK_ALLOCATION_SITE) {
mode_ = mode;
} else {
@@ -1903,6 +1904,17 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
}
+HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
+ ElementsKind kind,
+ HValue* constructor_function) :
+ builder_(builder),
Michael Starzinger 2013/05/23 09:16:49 nit: Indentation is off.
mvstanton 2013/05/23 14:46:05 Done.
+ kind_(kind),
+ mode_(DONT_TRACK_ALLOCATION_SITE),
+ allocation_site_payload_(NULL),
+ constructor_function_(constructor_function) {
+}
+
+
HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) {
HInstruction* native_context = builder()->BuildGetNativeContext(context);
int offset = Context::kHeaderSize +
@@ -1915,6 +1927,15 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) {
}
+HValue* HGraphBuilder::JSArrayBuilder::InternalEmitMapCode() {
+ // Find the map near the constructor function
+ HValue* initial_map = AddInstruction(new(zone())
+ HLoadNamedField(constructor_function_, true, Representation::Tagged(),
+ JSFunction::kPrototypeOrInitialMapOffset));
+ return initial_map;
+}
+
+
HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
HValue* length_node) {
HValue* context = builder()->environment()->LookupContext();
@@ -2001,7 +2022,12 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes,
AddInstruction(new_object);
// Fill in the fields: map, properties, length
- HValue* map = EmitMapCode(context);
+ HValue* map;
+ if (constructor_function_ != NULL) {
+ map = InternalEmitMapCode();
+ } else {
+ map = EmitMapCode(context);
+ }
elements_location_ = builder()->BuildJSArrayHeader(new_object,
map,
mode_,
« src/hydrogen.h ('K') | « src/hydrogen.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698