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

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: Adapt to bugfix for 244461 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
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('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 7ee6081026b7c58a786a3e3a5985a69259b1f787..1a3588f6a7a93175ce4f2833825b7ecfe9d7dd99 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1767,9 +1767,10 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
ElementsKind kind,
HValue* allocation_site_payload,
AllocationSiteMode mode) :
- builder_(builder),
- kind_(kind),
- allocation_site_payload_(allocation_site_payload) {
+ builder_(builder),
+ kind_(kind),
+ allocation_site_payload_(allocation_site_payload),
+ constructor_function_(NULL) {
if (mode == DONT_TRACK_ALLOCATION_SITE) {
mode_ = mode;
} else {
@@ -1778,6 +1779,17 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
}
+HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
+ ElementsKind kind,
+ HValue* constructor_function) :
+ builder_(builder),
+ 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);
@@ -1795,6 +1807,16 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) {
}
+HValue* HGraphBuilder::JSArrayBuilder::EmitInternalMapCode() {
+ // Find the map near the constructor function
+ HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap();
+ return AddInstruction(
+ builder()->BuildLoadNamedField(constructor_function_,
+ access,
+ Representation::Tagged()));
+}
+
+
HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
HValue* length_node) {
HValue* context = builder()->environment()->LookupContext();
@@ -1881,7 +1903,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 = EmitInternalMapCode();
+ } else {
+ map = EmitMapCode(context);
+ }
elements_location_ = builder()->BuildJSArrayHeader(new_object,
map,
mode_,
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698