Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 58a9b78750bb7401bfdc9e167800f8f01d3ef078..258ff091df9d815ab6e1a3d65085c42bd1568386 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()) |
@@ -9643,16 +9658,13 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { |
CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
HCallNew* call; |
if (use_call_new_array) { |
- AddInstruction(new(zone()) HCheckFunction(constructor, |
- Handle<JSFunction>(isolate()->global_context()->array_function()))); |
- Handle<Object> feedback = oracle()->GetInfo(expr->CallNewFeedbackId()); |
- ASSERT(feedback->IsSmi()); |
- |
// TODO(mvstanton): It would be better to use the already created global |
// property cell that is shared by full code gen. That way, any transition |
// information that happened after crankshaft won't be lost. The right |
// way to do that is to begin passing the cell to the type feedback oracle |
// instead of just the value in the cell. Do this in a follow-up checkin. |
+ Handle<Object> feedback = oracle()->GetInfo(expr->CallNewFeedbackId()); |
+ ASSERT(feedback->IsSmi()); |
Handle<JSGlobalPropertyCell> cell = |
isolate()->factory()->NewJSGlobalPropertyCell(feedback); |