Index: src/hydrogen.cc |
=================================================================== |
--- src/hydrogen.cc (revision 6891) |
+++ src/hydrogen.cc (working copy) |
@@ -2258,7 +2258,8 @@ |
} |
-void HGraphBuilder::PreProcessCall(HCall* call) { |
+template <int V> |
+HInstruction* HGraphBuilder::PreProcessCall(HCall<V>* call) { |
int count = call->argument_count(); |
ZoneList<HValue*> arguments(count); |
for (int i = 0; i < count; ++i) { |
@@ -2268,6 +2269,7 @@ |
while (!arguments.is_empty()) { |
AddInstruction(new HPushArgument(arguments.RemoveLast())); |
} |
+ return call; |
} |
@@ -3950,7 +3952,8 @@ |
// Check for bailout, as trying to inline might fail due to bailout |
// during hydrogen processing. |
CHECK_BAILOUT; |
- HCall* call = new HCallConstantFunction(expr->target(), argument_count); |
+ HCallConstantFunction* call = |
+ new HCallConstantFunction(expr->target(), argument_count); |
call->set_position(expr->position()); |
PreProcessCall(call); |
PushAndAdd(call); |
@@ -3967,7 +3970,7 @@ |
if (maps.length() == 0) { |
HContext* context = new HContext; |
AddInstruction(context); |
- HCall* call = new HCallNamed(context, name, argument_count); |
+ HCallNamed* call = new HCallNamed(context, name, argument_count); |
call->set_position(expr->position()); |
PreProcessCall(call); |
ast_context()->ReturnInstruction(call, expr->id()); |
@@ -3980,7 +3983,7 @@ |
} else { |
HContext* context = new HContext; |
AddInstruction(context); |
- HCall* call = new HCallNamed(context, name, argument_count); |
+ HCallNamed* call = new HCallNamed(context, name, argument_count); |
call->set_position(expr->position()); |
PreProcessCall(call); |
PushAndAdd(call); |
@@ -4383,7 +4386,7 @@ |
void HGraphBuilder::VisitCall(Call* expr) { |
Expression* callee = expr->expression(); |
int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
- HCall* call = NULL; |
+ HInstruction* call = NULL; |
Property* prop = callee->AsProperty(); |
if (prop != NULL) { |
@@ -4403,9 +4406,8 @@ |
HContext* context = new HContext; |
AddInstruction(context); |
- call = new HCallKeyed(context, key, argument_count); |
+ call = PreProcessCall(new HCallKeyed(context, key, argument_count)); |
call->set_position(expr->position()); |
- PreProcessCall(call); |
Drop(1); // Key. |
ast_context()->ReturnInstruction(call, expr->id()); |
return; |
@@ -4445,7 +4447,7 @@ |
// IC when a primitive receiver check is required. |
HContext* context = new HContext; |
AddInstruction(context); |
- call = new HCallNamed(context, name, argument_count); |
+ call = PreProcessCall(new HCallNamed(context, name, argument_count)); |
} else { |
AddCheckConstantFunction(expr, receiver, receiver_map, true); |
@@ -4465,7 +4467,8 @@ |
// Check for bailout, as the TryInline call in the if condition above |
// might return false due to bailout during hydrogen processing. |
CHECK_BAILOUT; |
- call = new HCallConstantFunction(expr->target(), argument_count); |
+ call = PreProcessCall(new HCallConstantFunction(expr->target(), |
+ argument_count)); |
} |
} |
} else if (types != NULL && types->length() > 1) { |
@@ -4476,7 +4479,7 @@ |
} else { |
HContext* context = new HContext; |
AddInstruction(context); |
- call = new HCallNamed(context, name, argument_count); |
+ call = PreProcessCall(new HCallNamed(context, name, argument_count)); |
} |
} else { |
@@ -4537,7 +4540,8 @@ |
// during hydrogen processing. |
CHECK_BAILOUT; |
- call = new HCallKnownGlobal(expr->target(), argument_count); |
+ call = PreProcessCall(new HCallKnownGlobal(expr->target(), |
+ argument_count)); |
} else { |
HContext* context = new HContext; |
AddInstruction(context); |
@@ -4545,7 +4549,9 @@ |
VisitExpressions(expr->arguments()); |
CHECK_BAILOUT; |
- call = new HCallGlobal(context, var->name(), argument_count); |
+ call = PreProcessCall(new HCallGlobal(context, |
+ var->name(), |
+ argument_count)); |
} |
} else { |
@@ -4557,12 +4563,11 @@ |
VisitExpressions(expr->arguments()); |
CHECK_BAILOUT; |
- call = new HCallFunction(context, argument_count); |
+ call = PreProcessCall(new HCallFunction(context, argument_count)); |
} |
} |
call->set_position(expr->position()); |
- PreProcessCall(call); |
ast_context()->ReturnInstruction(call, expr->id()); |
} |
@@ -4581,7 +4586,7 @@ |
// to the construct call. |
int arg_count = expr->arguments()->length() + 1; // Plus constructor. |
HValue* constructor = environment()->ExpressionStackAt(arg_count - 1); |
- HCall* call = new HCallNew(context, constructor, arg_count); |
+ HCallNew* call = new HCallNew(context, constructor, arg_count); |
call->set_position(expr->position()); |
PreProcessCall(call); |
ast_context()->ReturnInstruction(call, expr->id()); |
@@ -4630,7 +4635,7 @@ |
Handle<String> name = expr->name(); |
int argument_count = expr->arguments()->length(); |
- HCall* call = new HCallRuntime(name, function, argument_count); |
+ HCallRuntime* call = new HCallRuntime(name, function, argument_count); |
call->set_position(RelocInfo::kNoPosition); |
Drop(argument_count); |
ast_context()->ReturnInstruction(call, expr->id()); |