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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // -- rsp[8 * (argc + 1)] : receiver | 28 // -- rsp[8 * (argc + 1)] : receiver |
29 // ----------------------------------- | 29 // ----------------------------------- |
30 __ AssertFunction(rdi); | 30 __ AssertFunction(rdi); |
31 | 31 |
32 // Make sure we operate in the context of the called function (for example | 32 // Make sure we operate in the context of the called function (for example |
33 // ConstructStubs implemented in C++ will be run in the context of the caller | 33 // ConstructStubs implemented in C++ will be run in the context of the caller |
34 // instead of the callee, due to the way that [[Construct]] is defined for | 34 // instead of the callee, due to the way that [[Construct]] is defined for |
35 // ordinary functions). | 35 // ordinary functions). |
36 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 36 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
37 | 37 |
38 // Unconditionally insert the target and new target as extra arguments. They | 38 // JumpToExternalReference expects rax to contain the number of arguments |
| 39 // including the receiver and the extra arguments. |
| 40 const int num_extra_args = 3; |
| 41 __ addp(rax, Immediate(num_extra_args + 1)); |
| 42 |
| 43 // Unconditionally insert argc, target and new target as extra arguments. They |
39 // will be used by stack frame iterators when constructing the stack trace. | 44 // will be used by stack frame iterators when constructing the stack trace. |
40 const int num_extra_args = 2; | |
41 __ PopReturnAddressTo(kScratchRegister); | 45 __ PopReturnAddressTo(kScratchRegister); |
| 46 __ Integer32ToSmi(rax, rax); |
| 47 __ Push(rax); |
| 48 __ SmiToInteger32(rax, rax); |
42 __ Push(rdi); | 49 __ Push(rdi); |
43 __ Push(rdx); | 50 __ Push(rdx); |
44 __ PushReturnAddressFrom(kScratchRegister); | 51 __ PushReturnAddressFrom(kScratchRegister); |
45 | 52 |
46 // JumpToExternalReference expects rax to contain the number of arguments | |
47 // including the receiver and the extra arguments. | |
48 __ addp(rax, Immediate(num_extra_args + 1)); | |
49 | |
50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), | 53 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), |
51 exit_frame_type == BUILTIN_EXIT); | 54 exit_frame_type == BUILTIN_EXIT); |
52 } | 55 } |
53 | 56 |
54 | 57 |
55 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 58 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
56 __ movp(kScratchRegister, | 59 __ movp(kScratchRegister, |
57 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 60 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
58 __ movp(kScratchRegister, | 61 __ movp(kScratchRegister, |
59 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); | 62 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); |
(...skipping 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 __ ret(0); | 3045 __ ret(0); |
3043 } | 3046 } |
3044 | 3047 |
3045 | 3048 |
3046 #undef __ | 3049 #undef __ |
3047 | 3050 |
3048 } // namespace internal | 3051 } // namespace internal |
3049 } // namespace v8 | 3052 } // namespace v8 |
3050 | 3053 |
3051 #endif // V8_TARGET_ARCH_X64 | 3054 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |