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