Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 4d104ae9af70ec765eba3e9236297ecb20906df2..6cab811cebe5a712ae47e9a9fad7ee8f79f71a48 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -2006,6 +2006,7 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
// Record source position for debugger. |
SetSourcePosition(expr->position()); |
CallFunctionStub stub(arg_count, flags); |
+ __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
__ CallStub(&stub); |
RecordJSReturnSite(expr); |
// Restore context register. |
@@ -2096,6 +2097,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
// Record source position for debugger. |
SetSourcePosition(expr->position()); |
CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); |
+ __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
__ CallStub(&stub); |
RecordJSReturnSite(expr); |
// Restore context register. |
@@ -2961,12 +2963,24 @@ void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) { |
} |
VisitForAccumulatorValue(args->last()); // Function. |
+ // Check for proxy. |
+ Label proxy, done; |
+ __ CmpObjectType(rax, JS_FUNCTION_PROXY_TYPE, rbx); |
+ __ j(equal, &proxy); |
+ |
// InvokeFunction requires the function in rdi. Move it in there. |
__ movq(rdi, result_register()); |
ParameterCount count(arg_count); |
__ InvokeFunction(rdi, count, CALL_FUNCTION, |
NullCallWrapper(), CALL_AS_METHOD); |
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
+ __ jmp(&done); |
+ |
+ __ bind(&proxy); |
+ __ push(rax); |
+ __ CallRuntime(Runtime::kCall, args->length()); |
+ __ bind(&done); |
+ |
context()->Plug(rax); |
} |