| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 __ Pop(R4); | 392 __ Pop(R4); |
| 393 // Remove the stub frame. | 393 // Remove the stub frame. |
| 394 __ LeaveStubFrame(); | 394 __ LeaveStubFrame(); |
| 395 // Jump to the dart function. | 395 // Jump to the dart function. |
| 396 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset()); | 396 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset()); |
| 397 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); | 397 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); |
| 398 __ br(R0); | 398 __ br(R0); |
| 399 } | 399 } |
| 400 | 400 |
| 401 | 401 |
| 402 // Input parameters: |
| 403 // R2: smi-tagged argument count, may be zero. |
| 404 // FP[kParamEndSlotFromFp + 1]: last argument. |
| 405 static void PushArgumentsArray(Assembler* assembler) { |
| 406 // Allocate array to store arguments of caller. |
| 407 __ LoadObject(R1, Object::null_object(), PP); |
| 408 // R1: null element type for raw Array. |
| 409 // R2: smi-tagged argument count, may be zero. |
| 410 __ BranchLink(&StubCode::AllocateArrayLabel(), PP); |
| 411 // R0: newly allocated array. |
| 412 // R2: smi-tagged argument count, may be zero (was preserved by the stub). |
| 413 __ Push(R0); // Array is in R0 and on top of stack. |
| 414 __ add(R1, FP, Operand(R2, LSL, 2)); |
| 415 __ AddImmediate(R1, R1, kParamEndSlotFromFp * kWordSize, PP); |
| 416 __ AddImmediate(R3, R0, Array::data_offset() - kHeapObjectTag, PP); |
| 417 // R1: address of first argument on stack. |
| 418 // R3: address of first argument in array. |
| 419 |
| 420 Label loop, loop_exit; |
| 421 __ CompareRegisters(R2, ZR); |
| 422 __ b(&loop_exit, LE); |
| 423 __ Bind(&loop); |
| 424 __ ldr(R7, Address(R1)); |
| 425 __ AddImmediate(R1, R1, -kWordSize, PP); |
| 426 __ AddImmediate(R3, R3, kWordSize, PP); |
| 427 __ AddImmediateSetFlags(R2, R2, -Smi::RawValue(1), PP); |
| 428 __ str(R7, Address(R3, -kWordSize)); |
| 429 __ b(&loop, GE); |
| 430 __ Bind(&loop_exit); |
| 431 } |
| 432 |
| 433 |
| 402 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 434 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
| 403 intptr_t deopt_reason, | 435 intptr_t deopt_reason, |
| 404 uword saved_registers_address); | 436 uword saved_registers_address); |
| 405 | 437 |
| 406 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); | 438 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); |
| 407 | 439 |
| 408 | 440 |
| 409 // Used by eager and lazy deoptimization. Preserve result in RAX if necessary. | 441 // Used by eager and lazy deoptimization. Preserve result in RAX if necessary. |
| 410 // This stub translates optimized frame into unoptimized frame. The optimized | 442 // This stub translates optimized frame into unoptimized frame. The optimized |
| 411 // frame can contain values in registers and on stack, the unoptimized | 443 // frame can contain values in registers and on stack, the unoptimized |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1203 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1172 __ Drop(2); // Pop arguments. | 1204 __ Drop(2); // Pop arguments. |
| 1173 __ Pop(R0); // Pop result (newly allocated object). | 1205 __ Pop(R0); // Pop result (newly allocated object). |
| 1174 // R0: new object | 1206 // R0: new object |
| 1175 // Restore the frame pointer. | 1207 // Restore the frame pointer. |
| 1176 __ LeaveStubFrame(); | 1208 __ LeaveStubFrame(); |
| 1177 __ ret(); | 1209 __ ret(); |
| 1178 } | 1210 } |
| 1179 | 1211 |
| 1180 | 1212 |
| 1213 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1214 // from the entry code of a dart function after an error in passed argument |
| 1215 // name or number is detected. |
| 1216 // Input parameters: |
| 1217 // LR : return address. |
| 1218 // SP : address of last argument. |
| 1219 // R5: inline cache data object. |
| 1220 // R4: arguments descriptor array. |
| 1181 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { | 1221 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { |
| 1182 __ Stop("GenerateCallNoSuchMethodFunctionStub"); | 1222 __ EnterStubFrame(true); |
| 1223 |
| 1224 // Load the receiver. |
| 1225 __ LoadFieldFromOffset(R2, R4, ArgumentsDescriptor::count_offset()); |
| 1226 __ add(TMP, FP, Operand(R2, LSL, 2)); // R2 is Smi. |
| 1227 __ LoadFromOffset(R6, TMP, kParamEndSlotFromFp * kWordSize); |
| 1228 |
| 1229 // Push space for the return value. |
| 1230 // Push the receiver. |
| 1231 // Push IC data object. |
| 1232 // Push arguments descriptor array. |
| 1233 __ PushObject(Object::null_object(), PP); |
| 1234 __ Push(R6); |
| 1235 __ Push(R5); |
| 1236 __ Push(R4); |
| 1237 |
| 1238 // R2: Smi-tagged arguments array length. |
| 1239 PushArgumentsArray(assembler); |
| 1240 |
| 1241 __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4); |
| 1242 // Remove arguments. |
| 1243 __ Drop(4); |
| 1244 __ Pop(R0); // Get result into R0. |
| 1245 __ LeaveStubFrame(); |
| 1246 __ ret(); |
| 1183 } | 1247 } |
| 1184 | 1248 |
| 1185 | 1249 |
| 1186 // R6: function object. | 1250 // R6: function object. |
| 1187 // R5: inline cache data object. | 1251 // R5: inline cache data object. |
| 1188 // Cannot use function object from ICData as it may be the inlined | 1252 // Cannot use function object from ICData as it may be the inlined |
| 1189 // function and not the top-scope function. | 1253 // function and not the top-scope function. |
| 1190 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { | 1254 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { |
| 1191 Register ic_reg = R5; | 1255 Register ic_reg = R5; |
| 1192 Register func_reg = R6; | 1256 Register func_reg = R6; |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 const Register right = R0; | 1903 const Register right = R0; |
| 1840 __ LoadFromOffset(left, SP, 1 * kWordSize); | 1904 __ LoadFromOffset(left, SP, 1 * kWordSize); |
| 1841 __ LoadFromOffset(right, SP, 0 * kWordSize); | 1905 __ LoadFromOffset(right, SP, 0 * kWordSize); |
| 1842 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1906 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1843 __ ret(); | 1907 __ ret(); |
| 1844 } | 1908 } |
| 1845 | 1909 |
| 1846 } // namespace dart | 1910 } // namespace dart |
| 1847 | 1911 |
| 1848 #endif // defined TARGET_ARCH_ARM64 | 1912 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |