OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 // | 1060 // |
1061 // Note that this stub must be generated before any use of Abort. | 1061 // Note that this stub must be generated before any use of Abort. |
1062 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); | 1062 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); |
1063 | 1063 |
1064 ASM_LOCATION("CEntryStub::Generate entry"); | 1064 ASM_LOCATION("CEntryStub::Generate entry"); |
1065 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1065 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1066 | 1066 |
1067 // Register parameters: | 1067 // Register parameters: |
1068 // x0: argc (including receiver, untagged) | 1068 // x0: argc (including receiver, untagged) |
1069 // x1: target | 1069 // x1: target |
| 1070 // If argv_in_register(): |
| 1071 // x11: argv (pointer to first argument) |
1070 // | 1072 // |
1071 // The stack on entry holds the arguments and the receiver, with the receiver | 1073 // The stack on entry holds the arguments and the receiver, with the receiver |
1072 // at the highest address: | 1074 // at the highest address: |
1073 // | 1075 // |
1074 // jssp]argc-1]: receiver | 1076 // jssp]argc-1]: receiver |
1075 // jssp[argc-2]: arg[argc-2] | 1077 // jssp[argc-2]: arg[argc-2] |
1076 // ... ... | 1078 // ... ... |
1077 // jssp[1]: arg[1] | 1079 // jssp[1]: arg[1] |
1078 // jssp[0]: arg[0] | 1080 // jssp[0]: arg[0] |
1079 // | 1081 // |
(...skipping 11 matching lines...) Expand all Loading... |
1091 // into their argument registers, rather than using callee-saved registers and | 1093 // into their argument registers, rather than using callee-saved registers and |
1092 // preserving them on the stack. | 1094 // preserving them on the stack. |
1093 const Register& argv = x21; | 1095 const Register& argv = x21; |
1094 const Register& argc = x22; | 1096 const Register& argc = x22; |
1095 const Register& target = x23; | 1097 const Register& target = x23; |
1096 | 1098 |
1097 // Derive argv from the stack pointer so that it points to the first argument | 1099 // Derive argv from the stack pointer so that it points to the first argument |
1098 // (arg[argc-2]), or just below the receiver in case there are no arguments. | 1100 // (arg[argc-2]), or just below the receiver in case there are no arguments. |
1099 // - Adjust for the arg[] array. | 1101 // - Adjust for the arg[] array. |
1100 Register temp_argv = x11; | 1102 Register temp_argv = x11; |
1101 __ Add(temp_argv, jssp, Operand(x0, LSL, kPointerSizeLog2)); | 1103 if (!argv_in_register()) { |
1102 // - Adjust for the receiver. | 1104 __ Add(temp_argv, jssp, Operand(x0, LSL, kPointerSizeLog2)); |
1103 __ Sub(temp_argv, temp_argv, 1 * kPointerSize); | 1105 // - Adjust for the receiver. |
| 1106 __ Sub(temp_argv, temp_argv, 1 * kPointerSize); |
| 1107 } |
1104 | 1108 |
1105 // Enter the exit frame. Reserve three slots to preserve x21-x23 callee-saved | 1109 // Enter the exit frame. Reserve three slots to preserve x21-x23 callee-saved |
1106 // registers. | 1110 // registers. |
1107 FrameScope scope(masm, StackFrame::MANUAL); | 1111 FrameScope scope(masm, StackFrame::MANUAL); |
1108 __ EnterExitFrame(save_doubles(), x10, 3); | 1112 __ EnterExitFrame(save_doubles(), x10, 3); |
1109 DCHECK(csp.Is(__ StackPointer())); | 1113 DCHECK(csp.Is(__ StackPointer())); |
1110 | 1114 |
1111 // Poke callee-saved registers into reserved space. | 1115 // Poke callee-saved registers into reserved space. |
1112 __ Poke(argv, 1 * kPointerSize); | 1116 __ Poke(argv, 1 * kPointerSize); |
1113 __ Poke(argc, 2 * kPointerSize); | 1117 __ Poke(argc, 2 * kPointerSize); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 | 1201 |
1198 // Restore callee-saved registers x21-x23. | 1202 // Restore callee-saved registers x21-x23. |
1199 __ Mov(x11, argc); | 1203 __ Mov(x11, argc); |
1200 | 1204 |
1201 __ Peek(argv, 1 * kPointerSize); | 1205 __ Peek(argv, 1 * kPointerSize); |
1202 __ Peek(argc, 2 * kPointerSize); | 1206 __ Peek(argc, 2 * kPointerSize); |
1203 __ Peek(target, 3 * kPointerSize); | 1207 __ Peek(target, 3 * kPointerSize); |
1204 | 1208 |
1205 __ LeaveExitFrame(save_doubles(), x10, true); | 1209 __ LeaveExitFrame(save_doubles(), x10, true); |
1206 DCHECK(jssp.Is(__ StackPointer())); | 1210 DCHECK(jssp.Is(__ StackPointer())); |
1207 // Pop or drop the remaining stack slots and return from the stub. | 1211 if (!argv_in_register()) { |
1208 // jssp[24]: Arguments array (of size argc), including receiver. | 1212 // Drop the remaining stack slots and return from the stub. |
1209 // jssp[16]: Preserved x23 (used for target). | 1213 __ Drop(x11); |
1210 // jssp[8]: Preserved x22 (used for argc). | 1214 } |
1211 // jssp[0]: Preserved x21 (used for argv). | |
1212 __ Drop(x11); | |
1213 __ AssertFPCRState(); | 1215 __ AssertFPCRState(); |
1214 __ Ret(); | 1216 __ Ret(); |
1215 | 1217 |
1216 // The stack pointer is still csp if we aren't returning, and the frame | 1218 // The stack pointer is still csp if we aren't returning, and the frame |
1217 // hasn't changed (except for the return address). | 1219 // hasn't changed (except for the return address). |
1218 __ SetStackPointer(csp); | 1220 __ SetStackPointer(csp); |
1219 | 1221 |
1220 // Handling of exception. | 1222 // Handling of exception. |
1221 __ Bind(&exception_returned); | 1223 __ Bind(&exception_returned); |
1222 | 1224 |
(...skipping 4764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5987 MemOperand(fp, 6 * kPointerSize), NULL); | 5989 MemOperand(fp, 6 * kPointerSize), NULL); |
5988 } | 5990 } |
5989 | 5991 |
5990 | 5992 |
5991 #undef __ | 5993 #undef __ |
5992 | 5994 |
5993 } // namespace internal | 5995 } // namespace internal |
5994 } // namespace v8 | 5996 } // namespace v8 |
5995 | 5997 |
5996 #endif // V8_TARGET_ARCH_ARM64 | 5998 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |