Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index 9012cab3bb0905b967d51f094ab23645f5aad345..ff70841c2951886a4c3036ce95d1c3e9121cd878 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -1766,6 +1766,37 @@ void Builtins::Generate_Call(MacroAssembler* masm) { |
} |
+// static |
+void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- rax : the number of arguments (not including the receiver) |
+ // -- rbx : the address of the first argument to be pushed. Subsequent |
+ // arguments should be consecutive above this, in the same order as |
+ // they are to be pushed onto the stack. |
+ // -- rdi : the target to call (can be any Object). |
+ |
+ Label loop_header, loop_check; |
+ // Find the address of the last argument. |
+ __ movp(rcx, rax); |
+ __ addp(rcx, Immediate(1)); // Add one for receiver. |
+ __ shlp(rcx, Immediate(kPointerSizeLog2)); |
+ __ negp(rcx); |
+ __ addp(rcx, rbx); |
+ |
+ __ j(always, &loop_check); |
+ __ bind(&loop_header); |
+ __ Push(Operand(rbx, 0)); |
+ __ subp(rbx, Immediate(kPointerSize)); |
+ __ bind(&loop_check); |
+ __ cmpp(rbx, rcx); |
+ __ j(greater, &loop_header, Label::kNear); |
+ |
+ // Call the target. |
+ __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
Benedikt Meurer
2015/09/10 09:51:34
Hm, I think this should be Jump instead of Call+re
rmcilroy
2015/09/10 14:25:23
As discussed offline, this requires popping and re
|
+ __ ret(0); |
+} |
+ |
+ |
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
// Lookup the function in the JavaScript frame. |
__ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |