| 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_,
|
|
|