Index: src/x64/builtins-x64.cc |
=================================================================== |
--- src/x64/builtins-x64.cc (revision 2264) |
+++ src/x64/builtins-x64.cc (working copy) |
@@ -34,11 +34,20 @@ |
#define __ ACCESS_MASM(masm) |
-void Builtins::Generate_Adaptor(MacroAssembler* masm, |
- Builtins::CFunctionId id) { |
- masm->int3(); // UNIMPLEMENTED. |
+void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
+ // TODO(1238487): Don't pass the function in a static variable. |
+ ExternalReference passed = ExternalReference::builtin_passed_function(); |
+ __ movq(kScratchRegister, passed.address(), RelocInfo::EXTERNAL_REFERENCE); |
+ __ movq(Operand(kScratchRegister, 0), rdi); |
+ |
+ // The actual argument count has already been loaded into register |
+ // rax, but JumpToBuiltin expects rax to contain the number of |
+ // arguments including the receiver. |
+ __ incq(rax); |
+ __ JumpToBuiltin(ExternalReference(id)); |
} |
+ |
static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
__ push(rbp); |
__ movq(rbp, rsp); |
@@ -161,10 +170,12 @@ |
void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
masm->int3(); // UNIMPLEMENTED. |
+ masm->movq(kScratchRegister, Immediate(0xBEFA)); // Debugging aid. |
} |
void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
masm->int3(); // UNIMPLEMENTED. |
+ masm->movq(kScratchRegister, Immediate(0xBEFC)); // Debugging aid. |
} |