| 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) { |
| 19 // ----------- S t a t e ------------- | 20 // ----------- S t a t e ------------- |
| 20 // -- rax : number of arguments excluding receiver | 21 // -- rax : number of arguments excluding receiver |
| 21 // -- rdi : target | 22 // -- rdi : target |
| 22 // -- rdx : new.target | 23 // -- rdx : new.target |
| 23 // -- rsp[0] : return address | 24 // -- rsp[0] : return address |
| 24 // -- rsp[8] : last argument | 25 // -- rsp[8] : last argument |
| 25 // -- ... | 26 // -- ... |
| 26 // -- rsp[8 * argc] : first argument | 27 // -- rsp[8 * argc] : first argument |
| 27 // -- rsp[8 * (argc + 1)] : receiver | 28 // -- rsp[8 * (argc + 1)] : receiver |
| 28 // ----------------------------------- | 29 // ----------------------------------- |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 const int num_extra_args = 2; | 40 const int num_extra_args = 2; |
| 40 __ PopReturnAddressTo(kScratchRegister); | 41 __ PopReturnAddressTo(kScratchRegister); |
| 41 __ Push(rdi); | 42 __ Push(rdi); |
| 42 __ Push(rdx); | 43 __ Push(rdx); |
| 43 __ PushReturnAddressFrom(kScratchRegister); | 44 __ PushReturnAddressFrom(kScratchRegister); |
| 44 | 45 |
| 45 // JumpToExternalReference expects rax to contain the number of arguments | 46 // JumpToExternalReference expects rax to contain the number of arguments |
| 46 // including the receiver and the extra arguments. | 47 // including the receiver and the extra arguments. |
| 47 __ addp(rax, Immediate(num_extra_args + 1)); | 48 __ addp(rax, Immediate(num_extra_args + 1)); |
| 48 | 49 |
| 49 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), |
| 51 exit_frame_type == BUILTIN_EXIT); |
| 50 } | 52 } |
| 51 | 53 |
| 52 | 54 |
| 53 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 55 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| 54 __ movp(kScratchRegister, | 56 __ movp(kScratchRegister, |
| 55 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 57 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 56 __ movp(kScratchRegister, | 58 __ movp(kScratchRegister, |
| 57 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); | 59 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); |
| 58 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); | 60 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); |
| 59 __ jmp(kScratchRegister); | 61 __ jmp(kScratchRegister); |
| (...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 __ ret(0); | 3042 __ ret(0); |
| 3041 } | 3043 } |
| 3042 | 3044 |
| 3043 | 3045 |
| 3044 #undef __ | 3046 #undef __ |
| 3045 | 3047 |
| 3046 } // namespace internal | 3048 } // namespace internal |
| 3047 } // namespace v8 | 3049 } // namespace v8 |
| 3048 | 3050 |
| 3049 #endif // V8_TARGET_ARCH_X64 | 3051 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |