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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 // arguments should be consecutive above this, in the same order as | 1179 // arguments should be consecutive above this, in the same order as |
1180 // they are to be pushed onto the stack. | 1180 // they are to be pushed onto the stack. |
1181 // -- x1 : the target to call (can be any Object). | 1181 // -- x1 : the target to call (can be any Object). |
1182 // ----------------------------------- | 1182 // ----------------------------------- |
1183 | 1183 |
1184 // Find the address of the last argument. | 1184 // Find the address of the last argument. |
1185 __ add(x3, x0, Operand(1)); // Add one for receiver. | 1185 __ add(x3, x0, Operand(1)); // Add one for receiver. |
1186 __ lsl(x3, x3, kPointerSizeLog2); | 1186 __ lsl(x3, x3, kPointerSizeLog2); |
1187 __ sub(x4, x2, x3); | 1187 __ sub(x4, x2, x3); |
1188 | 1188 |
1189 // TODO(mythria): Add a stack check before pushing arguments. | |
1190 // Push the arguments. | 1189 // Push the arguments. |
1191 Label loop_header, loop_check; | 1190 Label loop_header, loop_check; |
1192 __ Mov(x5, jssp); | 1191 __ Mov(x5, jssp); |
1193 __ Claim(x3, 1); | 1192 __ Claim(x3, 1); |
1194 __ B(&loop_check); | 1193 __ B(&loop_check); |
1195 __ Bind(&loop_header); | 1194 __ Bind(&loop_header); |
1196 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | 1195 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
1197 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); | 1196 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); |
1198 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); | 1197 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); |
1199 __ Bind(&loop_check); | 1198 __ Bind(&loop_check); |
1200 __ Cmp(x2, x4); | 1199 __ Cmp(x2, x4); |
1201 __ B(gt, &loop_header); | 1200 __ B(gt, &loop_header); |
1202 | 1201 |
1203 // Call the target. | 1202 // Call the target. |
1204 if (function_type == CallableType::kJSFunction) { | 1203 if (function_type == CallableType::kJSFunction) { |
1205 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 1204 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
1206 tail_call_mode), | 1205 tail_call_mode), |
1207 RelocInfo::CODE_TARGET); | 1206 RelocInfo::CODE_TARGET); |
1208 } else { | 1207 } else { |
1209 DCHECK_EQ(function_type, CallableType::kAny); | 1208 DCHECK_EQ(function_type, CallableType::kAny); |
1210 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1209 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1211 tail_call_mode), | 1210 tail_call_mode), |
1212 RelocInfo::CODE_TARGET); | 1211 RelocInfo::CODE_TARGET); |
1213 } | 1212 } |
1214 } | 1213 } |
1215 | 1214 |
1216 // static | 1215 // static |
1217 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 1216 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1218 MacroAssembler* masm, CallableType construct_type) { | |
1219 // ----------- S t a t e ------------- | 1217 // ----------- S t a t e ------------- |
1220 // -- x0 : argument count (not including receiver) | 1218 // -- x0 : argument count (not including receiver) |
1221 // -- x3 : new target | 1219 // -- x3 : new target |
1222 // -- x1 : constructor to call | 1220 // -- x1 : constructor to call |
1223 // -- x2 : allocation site feedback if available, undefined otherwise | 1221 // -- x2 : address of the first argument |
1224 // -- x4 : address of the first argument | |
1225 // ----------------------------------- | 1222 // ----------------------------------- |
1226 | 1223 |
1227 // Find the address of the last argument. | 1224 // Find the address of the last argument. |
1228 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). | 1225 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). |
1229 __ lsl(x5, x5, kPointerSizeLog2); | 1226 __ lsl(x5, x5, kPointerSizeLog2); |
1230 | 1227 |
1231 // Set stack pointer and where to stop. | 1228 // Set stack pointer and where to stop. |
1232 __ Mov(x6, jssp); | 1229 __ Mov(x6, jssp); |
1233 __ Claim(x5, 1); | 1230 __ Claim(x5, 1); |
1234 __ sub(x7, x6, x5); | 1231 __ sub(x4, x6, x5); |
1235 | 1232 |
1236 // Push a slot for the receiver. | 1233 // Push a slot for the receiver. |
1237 __ Str(xzr, MemOperand(x6, -kPointerSize, PreIndex)); | 1234 __ Str(xzr, MemOperand(x6, -kPointerSize, PreIndex)); |
1238 | 1235 |
1239 Label loop_header, loop_check; | 1236 Label loop_header, loop_check; |
1240 // TODO(mythria): Add a stack check before pushing arguments. | |
1241 // Push the arguments. | 1237 // Push the arguments. |
1242 __ B(&loop_check); | 1238 __ B(&loop_check); |
1243 __ Bind(&loop_header); | 1239 __ Bind(&loop_header); |
1244 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | 1240 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
1245 __ Ldr(x5, MemOperand(x4, -kPointerSize, PostIndex)); | 1241 __ Ldr(x5, MemOperand(x2, -kPointerSize, PostIndex)); |
1246 __ Str(x5, MemOperand(x6, -kPointerSize, PreIndex)); | 1242 __ Str(x5, MemOperand(x6, -kPointerSize, PreIndex)); |
1247 __ Bind(&loop_check); | 1243 __ Bind(&loop_check); |
1248 __ Cmp(x6, x7); | 1244 __ Cmp(x6, x4); |
1249 __ B(gt, &loop_header); | 1245 __ B(gt, &loop_header); |
1250 | 1246 |
1251 __ AssertUndefinedOrAllocationSite(x2, x6); | 1247 // Call the constructor with x0, x1, and x3 unmodified. |
1252 if (construct_type == CallableType::kJSFunction) { | 1248 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1253 __ AssertFunction(x1); | |
1254 | |
1255 // Tail call to the function-specific construct stub (still in the caller | |
1256 // context at this point). | |
1257 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | |
1258 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); | |
1259 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); | |
1260 __ Br(x4); | |
1261 } else { | |
1262 DCHECK_EQ(construct_type, CallableType::kAny); | |
1263 // Call the constructor with x0, x1, and x3 unmodified. | |
1264 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
1265 } | |
1266 } | 1249 } |
1267 | 1250 |
1268 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1251 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1269 // Set the return address to the correct point in the interpreter entry | 1252 // Set the return address to the correct point in the interpreter entry |
1270 // trampoline. | 1253 // trampoline. |
1271 Smi* interpreter_entry_return_pc_offset( | 1254 Smi* interpreter_entry_return_pc_offset( |
1272 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1255 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1273 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1256 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1274 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1257 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1275 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() + | 1258 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() + |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 __ Unreachable(); | 3033 __ Unreachable(); |
3051 } | 3034 } |
3052 } | 3035 } |
3053 | 3036 |
3054 #undef __ | 3037 #undef __ |
3055 | 3038 |
3056 } // namespace internal | 3039 } // namespace internal |
3057 } // namespace v8 | 3040 } // namespace v8 |
3058 | 3041 |
3059 #endif // V8_TARGET_ARCH_ARM | 3042 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |