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 #define __ ACCESS_MASM(masm) | 15 #define __ ACCESS_MASM(masm) |
16 | 16 |
17 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | 17 void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, |
18 ExitFrameType exit_frame_type) { | 18 ExitFrameType exit_frame_type) { |
19 // ----------- S t a t e ------------- | 19 // ----------- S t a t e ------------- |
20 // -- rax : number of arguments excluding receiver | 20 // -- rax : number of arguments excluding receiver |
21 // -- rdi : target | 21 // -- rdi : target |
22 // -- rdx : new.target | 22 // -- rdx : new.target |
23 // -- rsp[0] : return address | 23 // -- rsp[0] : return address |
24 // -- rsp[8] : last argument | 24 // -- rsp[8] : last argument |
25 // -- ... | 25 // -- ... |
26 // -- rsp[8 * argc] : first argument | 26 // -- rsp[8 * argc] : first argument |
27 // -- rsp[8 * (argc + 1)] : receiver | 27 // -- rsp[8 * (argc + 1)] : receiver |
(...skipping 14 matching lines...) Expand all Loading... |
42 // Unconditionally insert argc, target and new target as extra arguments. They | 42 // Unconditionally insert argc, target and new target as extra arguments. They |
43 // will be used by stack frame iterators when constructing the stack trace. | 43 // will be used by stack frame iterators when constructing the stack trace. |
44 __ PopReturnAddressTo(kScratchRegister); | 44 __ PopReturnAddressTo(kScratchRegister); |
45 __ Integer32ToSmi(rax, rax); | 45 __ Integer32ToSmi(rax, rax); |
46 __ Push(rax); | 46 __ Push(rax); |
47 __ SmiToInteger32(rax, rax); | 47 __ SmiToInteger32(rax, rax); |
48 __ Push(rdi); | 48 __ Push(rdi); |
49 __ Push(rdx); | 49 __ Push(rdx); |
50 __ PushReturnAddressFrom(kScratchRegister); | 50 __ PushReturnAddressFrom(kScratchRegister); |
51 | 51 |
52 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), | 52 __ JumpToExternalReference(ExternalReference(address, masm->isolate()), |
53 exit_frame_type == BUILTIN_EXIT); | 53 exit_frame_type == BUILTIN_EXIT); |
54 } | 54 } |
55 | 55 |
56 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 56 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
57 __ movp(kScratchRegister, | 57 __ movp(kScratchRegister, |
58 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 58 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
59 __ movp(kScratchRegister, | 59 __ movp(kScratchRegister, |
60 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); | 60 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); |
61 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); | 61 __ leap(kScratchRegister, FieldOperand(kScratchRegister, Code::kHeaderSize)); |
62 __ jmp(kScratchRegister); | 62 __ jmp(kScratchRegister); |
(...skipping 2971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 // And "return" to the OSR entry point of the function. | 3034 // And "return" to the OSR entry point of the function. |
3035 __ ret(0); | 3035 __ ret(0); |
3036 } | 3036 } |
3037 | 3037 |
3038 #undef __ | 3038 #undef __ |
3039 | 3039 |
3040 } // namespace internal | 3040 } // namespace internal |
3041 } // namespace v8 | 3041 } // namespace v8 |
3042 | 3042 |
3043 #endif // V8_TARGET_ARCH_X64 | 3043 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |