Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index e1cf70a0250cb2f281dda7e356fd318b7778754a..97193d0adb72ef9e44ce30a14c8e3edc0852749d 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8338,8 +8338,20 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { |
CHECK_ALIVE(VisitArgument(expr->expression())); |
HValue* constructor = HPushArgument::cast(Top())->argument(); |
CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
- HInstruction* call = |
- new(zone()) HCallNew(context, constructor, argument_count); |
+ HCallNew* call; |
+ if (!(expr->target().is_null()) && |
+ *(expr->target()) == isolate()->global_context()->array_function()) { |
+ Handle<Object> feedback = oracle()->GetInfo(expr->CallNewFeedbackId()); |
+ ASSERT(feedback->IsSmi()); |
+ Handle<JSGlobalPropertyCell> cell = |
+ isolate()->factory()->NewJSGlobalPropertyCell(feedback); |
+ AddInstruction(new(zone()) HCheckFunction(constructor, |
+ Handle<JSFunction>(isolate()->global_context()->array_function()))); |
+ call = new(zone()) HCallNewArray(context, constructor, argument_count, |
+ cell); |
+ } else { |
+ call = new(zone()) HCallNew(context, constructor, argument_count); |
+ } |
Drop(argument_count); |
call->set_position(expr->position()); |
return ast_context()->ReturnInstruction(call, expr->id()); |