| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
| 17 | 17 |
| 18 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | 18 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
| 19 ExitFrameType exit_frame_type) { | |
| 20 // ----------- S t a t e ------------- | 19 // ----------- S t a t e ------------- |
| 21 // -- rax : number of arguments excluding receiver | 20 // -- rax : number of arguments excluding receiver |
| 22 // -- rdi : target | 21 // -- rdi : target |
| 23 // -- rdx : new.target | 22 // -- rdx : new.target |
| 24 // -- rsp[0] : return address | 23 // -- rsp[0] : return address |
| 25 // -- rsp[8] : last argument | 24 // -- rsp[8] : last argument |
| 26 // -- ... | 25 // -- ... |
| 27 // -- rsp[8 * argc] : first argument | 26 // -- rsp[8 * argc] : first argument |
| 28 // -- rsp[8 * (argc + 1)] : receiver | 27 // -- rsp[8 * (argc + 1)] : receiver |
| 29 // ----------------------------------- | 28 // ----------------------------------- |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 const int num_extra_args = 2; | 39 const int num_extra_args = 2; |
| 41 __ PopReturnAddressTo(kScratchRegister); | 40 __ PopReturnAddressTo(kScratchRegister); |
| 42 __ Push(rdi); | 41 __ Push(rdi); |
| 43 __ Push(rdx); | 42 __ Push(rdx); |
| 44 __ PushReturnAddressFrom(kScratchRegister); | 43 __ PushReturnAddressFrom(kScratchRegister); |
| 45 | 44 |
| 46 // JumpToExternalReference expects rax to contain the number of arguments | 45 // JumpToExternalReference expects rax to contain the number of arguments |
| 47 // including the receiver and the extra arguments. | 46 // including the receiver and the extra arguments. |
| 48 __ addp(rax, Immediate(num_extra_args + 1)); | 47 __ addp(rax, Immediate(num_extra_args + 1)); |
| 49 | 48 |
| 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), | 49 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 51 exit_frame_type == BUILTIN_EXIT); | |
| 52 } | 50 } |
| 53 | 51 |
| 54 | 52 |
| 55 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 53 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| 56 __ movp(kScratchRegister, | 54 __ movp(kScratchRegister, |
| 57 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 55 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 58 __ movp(kScratchRegister, | 56 __ movp(kScratchRegister, |
| 59 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); | 57 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); |
| 60 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); | 58 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); |
| 61 __ jmp(kScratchRegister); | 59 __ jmp(kScratchRegister); |
| (...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 __ ret(0); | 3040 __ ret(0); |
| 3043 } | 3041 } |
| 3044 | 3042 |
| 3045 | 3043 |
| 3046 #undef __ | 3044 #undef __ |
| 3047 | 3045 |
| 3048 } // namespace internal | 3046 } // namespace internal |
| 3049 } // namespace v8 | 3047 } // namespace v8 |
| 3050 | 3048 |
| 3051 #endif // V8_TARGET_ARCH_X64 | 3049 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |