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/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 __ CallRuntime(Runtime::kCompileBaseline); | 1133 __ CallRuntime(Runtime::kCompileBaseline); |
1134 | 1134 |
1135 // Restore return value. | 1135 // Restore return value. |
1136 __ pop(x0); | 1136 __ pop(x0); |
1137 } | 1137 } |
1138 __ Ret(); | 1138 __ Ret(); |
1139 } | 1139 } |
1140 | 1140 |
1141 // static | 1141 // static |
1142 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 1142 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
1143 MacroAssembler* masm, TailCallMode tail_call_mode) { | 1143 MacroAssembler* masm, TailCallMode tail_call_mode, |
| 1144 CallableType function_type) { |
1144 // ----------- S t a t e ------------- | 1145 // ----------- S t a t e ------------- |
1145 // -- x0 : the number of arguments (not including the receiver) | 1146 // -- x0 : the number of arguments (not including the receiver) |
1146 // -- x2 : the address of the first argument to be pushed. Subsequent | 1147 // -- x2 : the address of the first argument to be pushed. Subsequent |
1147 // arguments should be consecutive above this, in the same order as | 1148 // arguments should be consecutive above this, in the same order as |
1148 // they are to be pushed onto the stack. | 1149 // they are to be pushed onto the stack. |
1149 // -- x1 : the target to call (can be any Object). | 1150 // -- x1 : the target to call (can be any Object). |
1150 // ----------------------------------- | 1151 // ----------------------------------- |
1151 | 1152 |
1152 // Find the address of the last argument. | 1153 // Find the address of the last argument. |
1153 __ add(x3, x0, Operand(1)); // Add one for receiver. | 1154 __ add(x3, x0, Operand(1)); // Add one for receiver. |
1154 __ lsl(x3, x3, kPointerSizeLog2); | 1155 __ lsl(x3, x3, kPointerSizeLog2); |
1155 __ sub(x4, x2, x3); | 1156 __ sub(x4, x2, x3); |
1156 | 1157 |
1157 // Push the arguments. | 1158 // Push the arguments. |
1158 Label loop_header, loop_check; | 1159 Label loop_header, loop_check; |
1159 __ Mov(x5, jssp); | 1160 __ Mov(x5, jssp); |
1160 __ Claim(x3, 1); | 1161 __ Claim(x3, 1); |
1161 __ B(&loop_check); | 1162 __ B(&loop_check); |
1162 __ Bind(&loop_header); | 1163 __ Bind(&loop_header); |
1163 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | 1164 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
1164 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); | 1165 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); |
1165 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); | 1166 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); |
1166 __ Bind(&loop_check); | 1167 __ Bind(&loop_check); |
1167 __ Cmp(x2, x4); | 1168 __ Cmp(x2, x4); |
1168 __ B(gt, &loop_header); | 1169 __ B(gt, &loop_header); |
1169 | 1170 |
1170 // Call the target. | 1171 // Call the target. |
1171 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1172 if (function_type == CallableType::kJSFunction) { |
1172 tail_call_mode), | 1173 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
1173 RelocInfo::CODE_TARGET); | 1174 tail_call_mode), |
| 1175 RelocInfo::CODE_TARGET); |
| 1176 } else { |
| 1177 DCHECK_EQ(function_type, CallableType::kAny); |
| 1178 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1179 tail_call_mode), |
| 1180 RelocInfo::CODE_TARGET); |
| 1181 } |
1174 } | 1182 } |
1175 | 1183 |
1176 // static | 1184 // static |
1177 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1185 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1178 // ----------- S t a t e ------------- | 1186 // ----------- S t a t e ------------- |
1179 // -- x0 : argument count (not including receiver) | 1187 // -- x0 : argument count (not including receiver) |
1180 // -- x3 : new target | 1188 // -- x3 : new target |
1181 // -- x1 : constructor to call | 1189 // -- x1 : constructor to call |
1182 // -- x2 : address of the first argument | 1190 // -- x2 : address of the first argument |
1183 // ----------------------------------- | 1191 // ----------------------------------- |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3039 } | 3047 } |
3040 } | 3048 } |
3041 | 3049 |
3042 | 3050 |
3043 #undef __ | 3051 #undef __ |
3044 | 3052 |
3045 } // namespace internal | 3053 } // namespace internal |
3046 } // namespace v8 | 3054 } // namespace v8 |
3047 | 3055 |
3048 #endif // V8_TARGET_ARCH_ARM | 3056 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |