Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 58a9b78750bb7401bfdc9e167800f8f01d3ef078..98cca076a79e53966094be47f580c84682893b96 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1863,6 +1863,26 @@ HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object, |
} |
+HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) { |
+ HInstruction* global_object = AddInstruction(new(zone()) |
+ HGlobalObject(context)); |
+ HInstruction* native_context = AddInstruction(new(zone()) |
+ HLoadNamedField(global_object, true, Representation::Tagged(), |
+ GlobalObject::kNativeContextOffset)); |
+ return native_context; |
+} |
+ |
+ |
+HInstruction* HGraphBuilder::BuildGetArrayFunction(HValue* context) { |
+ HInstruction* native_context = BuildGetNativeContext(context); |
+ int offset = Context::kHeaderSize + |
+ kPointerSize * Context::ARRAY_FUNCTION_INDEX; |
+ HInstruction* array_function = AddInstruction(new(zone()) |
+ HLoadNamedField(native_context, true, Representation::Tagged(), offset)); |
+ return array_function; |
+} |
+ |
+ |
HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, |
ElementsKind kind, |
HValue* allocation_site_payload, |
@@ -1879,12 +1899,7 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, |
HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) { |
- // Get the global context, the native context, the map array |
- HInstruction* global_object = AddInstruction(new(zone()) |
- HGlobalObject(context)); |
- HInstruction* native_context = AddInstruction(new(zone()) |
- HLoadNamedField(global_object, true, Representation::Tagged(), |
- GlobalObject::kNativeContextOffset)); |
+ HInstruction* native_context = builder()->BuildGetNativeContext(context); |
int offset = Context::kHeaderSize + |
kPointerSize * Context::JS_ARRAY_MAPS_INDEX; |
HInstruction* map_array = AddInstruction(new(zone()) |