Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index e6bb7ed40fe3036282d9594ad0a6cada9cfad8a3..b7adbfd5569d0e59097c1f20c4cdceecac25462f 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -3952,6 +3952,26 @@ void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { |
} |
+void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
+ ZoneList<Expression*>* args = expr->arguments(); |
+ DCHECK_LE(2, args->length()); |
+ // Push target, receiver and arguments onto the stack. |
+ for (Expression* const arg : *args) { |
+ VisitForStackValue(arg); |
+ } |
+ // Move target to rdi. |
+ int const argc = args->length() - 2; |
+ __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize)); |
+ // Call the target. |
+ __ Set(rax, argc); |
+ __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
+ // Restore context register. |
+ __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
+ // Discard the function left on TOS. |
+ context()->DropAndPlug(1, rax); |
+} |
+ |
+ |
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
ZoneList<Expression*>* args = expr->arguments(); |
DCHECK(args->length() >= 2); |
@@ -3977,7 +3997,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
__ bind(&runtime); |
__ Push(rax); |
- __ CallRuntime(Runtime::kCall, args->length()); |
+ __ CallRuntime(Runtime::kCallFunction, args->length()); |
__ bind(&done); |
context()->Plug(rax); |