Index: src/x64/full-codegen-x64.cc |
=================================================================== |
--- src/x64/full-codegen-x64.cc (revision 7623) |
+++ src/x64/full-codegen-x64.cc (working copy) |
@@ -3043,15 +3043,14 @@ |
void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) { |
ASSERT(args->length() >= 2); |
- int arg_count = args->length() - 2; // For receiver and function. |
- VisitForStackValue(args->at(0)); // Receiver. |
- for (int i = 0; i < arg_count; i++) { |
- VisitForStackValue(args->at(i + 1)); |
+ int arg_count = args->length() - 2; // 2 ~ receiver and function. |
+ for (int i = 0; i < arg_count + 1; i++) { |
+ VisitForStackValue(args->at(i)); |
} |
- VisitForAccumulatorValue(args->at(arg_count + 1)); // Function. |
+ VisitForAccumulatorValue(args->last()); // Function. |
- // InvokeFunction requires function in rdi. Move it in there. |
- if (!result_register().is(rdi)) __ movq(rdi, result_register()); |
+ // InvokeFunction requires the function in rdi. Move it in there. |
+ __ movq(rdi, result_register()); |
ParameterCount count(arg_count); |
__ InvokeFunction(rdi, count, CALL_FUNCTION); |
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |