OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 #include "codegen-inl.h" | 29 #include "codegen-inl.h" |
30 #include "macro-assembler.h" | 30 #include "macro-assembler.h" |
31 | 31 |
32 namespace v8 { | 32 namespace v8 { |
33 namespace internal { | 33 namespace internal { |
34 | 34 |
35 #define __ ACCESS_MASM(masm) | 35 #define __ ACCESS_MASM(masm) |
36 | 36 |
37 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 37 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
38 Builtins::CFunctionId id) { | 38 // TODO(1238487): Don't pass the function in a static variable. |
39 masm->int3(); // UNIMPLEMENTED. | 39 ExternalReference passed = ExternalReference::builtin_passed_function(); |
| 40 __ movq(kScratchRegister, passed.address(), RelocInfo::EXTERNAL_REFERENCE); |
| 41 __ movq(Operand(kScratchRegister, 0), rdi); |
| 42 |
| 43 // The actual argument count has already been loaded into register |
| 44 // rax, but JumpToBuiltin expects rax to contain the number of |
| 45 // arguments including the receiver. |
| 46 __ incq(rax); |
| 47 __ JumpToBuiltin(ExternalReference(id)); |
40 } | 48 } |
41 | 49 |
| 50 |
42 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 51 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
43 __ push(rbp); | 52 __ push(rbp); |
44 __ movq(rbp, rsp); | 53 __ movq(rbp, rsp); |
45 | 54 |
46 // Store the arguments adaptor context sentinel. | 55 // Store the arguments adaptor context sentinel. |
47 __ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 56 __ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); |
48 | 57 |
49 // Push the function on the stack. | 58 // Push the function on the stack. |
50 __ push(rdi); | 59 __ push(rdi); |
51 | 60 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // ------------------------------------------- | 163 // ------------------------------------------- |
155 // Dont adapt arguments. | 164 // Dont adapt arguments. |
156 // ------------------------------------------- | 165 // ------------------------------------------- |
157 __ bind(&dont_adapt_arguments); | 166 __ bind(&dont_adapt_arguments); |
158 __ jmp(rdx); | 167 __ jmp(rdx); |
159 } | 168 } |
160 | 169 |
161 | 170 |
162 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 171 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
163 masm->int3(); // UNIMPLEMENTED. | 172 masm->int3(); // UNIMPLEMENTED. |
| 173 masm->movq(kScratchRegister, Immediate(0xBEFA)); // Debugging aid. |
164 } | 174 } |
165 | 175 |
166 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 176 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
167 masm->int3(); // UNIMPLEMENTED. | 177 masm->int3(); // UNIMPLEMENTED. |
| 178 masm->movq(kScratchRegister, Immediate(0xBEFC)); // Debugging aid. |
168 } | 179 } |
169 | 180 |
170 | 181 |
171 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 182 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
172 // ----------- S t a t e ------------- | 183 // ----------- S t a t e ------------- |
173 // -- rax: number of arguments | 184 // -- rax: number of arguments |
174 // -- rdi: constructor function | 185 // -- rdi: constructor function |
175 // ----------------------------------- | 186 // ----------------------------------- |
176 | 187 |
177 Label non_function_call; | 188 Label non_function_call; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 420 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
410 Generate_JSEntryTrampolineHelper(masm, false); | 421 Generate_JSEntryTrampolineHelper(masm, false); |
411 } | 422 } |
412 | 423 |
413 | 424 |
414 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 425 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
415 Generate_JSEntryTrampolineHelper(masm, true); | 426 Generate_JSEntryTrampolineHelper(masm, true); |
416 } | 427 } |
417 | 428 |
418 } } // namespace v8::internal | 429 } } // namespace v8::internal |
OLD | NEW |