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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
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/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 ldr(TMP, Address(TMP2, count_field_offset)); | 1315 ldr(TMP, Address(TMP2, count_field_offset)); |
1316 AddImmediate(TMP, TMP, 1, pp); | 1316 AddImmediate(TMP, TMP, 1, pp); |
1317 str(TMP, Address(TMP2, count_field_offset)); | 1317 str(TMP, Address(TMP2, count_field_offset)); |
1318 ldr(TMP, Address(TMP2, size_field_offset)); | 1318 ldr(TMP, Address(TMP2, size_field_offset)); |
1319 add(TMP, TMP, Operand(size_reg)); | 1319 add(TMP, TMP, Operand(size_reg)); |
1320 str(TMP, Address(TMP2, size_field_offset)); | 1320 str(TMP, Address(TMP2, size_field_offset)); |
1321 } | 1321 } |
1322 } | 1322 } |
1323 | 1323 |
1324 | 1324 |
| 1325 void Assembler::MaybeTraceAllocation(intptr_t cid, |
| 1326 Register temp_reg, |
| 1327 Register pp, |
| 1328 Label* trace) { |
| 1329 ASSERT(cid > 0); |
| 1330 Isolate* isolate = Isolate::Current(); |
| 1331 ClassTable* class_table = isolate->class_table(); |
| 1332 const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
| 1333 if (cid < kNumPredefinedCids) { |
| 1334 const uword class_heap_stats_table_address = |
| 1335 class_table->PredefinedClassHeapStatsTableAddress(); |
| 1336 LoadImmediate(temp_reg, class_heap_stats_table_address + class_offset, pp); |
| 1337 } else { |
| 1338 LoadImmediate(temp_reg, class_table->ClassStatsTableAddress(), pp); |
| 1339 ldr(temp_reg, Address(temp_reg, 0)); |
| 1340 AddImmediate(temp_reg, temp_reg, class_offset, pp); |
| 1341 } |
| 1342 const uword state_offset = ClassHeapStats::state_offset(); |
| 1343 const Address& state_address = Address(temp_reg, state_offset); |
| 1344 ldr(temp_reg, state_address); |
| 1345 tsti(temp_reg, Immediate(ClassHeapStats::TraceAllocationMask())); |
| 1346 b(trace, NE); |
| 1347 } |
| 1348 |
| 1349 |
1325 void Assembler::TryAllocate(const Class& cls, | 1350 void Assembler::TryAllocate(const Class& cls, |
1326 Label* failure, | 1351 Label* failure, |
1327 Register instance_reg, | 1352 Register instance_reg, |
1328 Register temp_reg, | 1353 Register temp_reg, |
1329 Register pp) { | 1354 Register pp) { |
1330 ASSERT(failure != NULL); | 1355 ASSERT(failure != NULL); |
1331 if (FLAG_inline_alloc) { | 1356 if (FLAG_inline_alloc) { |
| 1357 // If this allocation is traced, program will jump to failure path |
| 1358 // (i.e. the allocation stub) which will allocate the object and trace the |
| 1359 // allocation call site. |
| 1360 MaybeTraceAllocation(cls.id(), temp_reg, pp, failure); |
1332 const intptr_t instance_size = cls.instance_size(); | 1361 const intptr_t instance_size = cls.instance_size(); |
1333 Heap* heap = Isolate::Current()->heap(); | 1362 Heap* heap = Isolate::Current()->heap(); |
1334 Heap::Space space = heap->SpaceForAllocation(cls.id()); | 1363 Heap::Space space = heap->SpaceForAllocation(cls.id()); |
1335 const uword top_address = heap->TopAddress(space); | 1364 const uword top_address = heap->TopAddress(space); |
1336 LoadImmediate(temp_reg, top_address, pp); | 1365 LoadImmediate(temp_reg, top_address, pp); |
1337 ldr(instance_reg, Address(temp_reg)); | 1366 ldr(instance_reg, Address(temp_reg)); |
1338 // TODO(koda): Protect against unsigned overflow here. | 1367 // TODO(koda): Protect against unsigned overflow here. |
1339 AddImmediateSetFlags(instance_reg, instance_reg, instance_size, pp); | 1368 AddImmediateSetFlags(instance_reg, instance_reg, instance_size, pp); |
1340 | 1369 |
1341 // instance_reg: potential next object start. | 1370 // instance_reg: potential next object start. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 add(base, array, Operand(index, LSL, shift)); | 1477 add(base, array, Operand(index, LSL, shift)); |
1449 } | 1478 } |
1450 const OperandSize size = Address::OperandSizeFor(cid); | 1479 const OperandSize size = Address::OperandSizeFor(cid); |
1451 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1480 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
1452 return Address(base, offset, Address::Offset, size); | 1481 return Address(base, offset, Address::Offset, size); |
1453 } | 1482 } |
1454 | 1483 |
1455 } // namespace dart | 1484 } // namespace dart |
1456 | 1485 |
1457 #endif // defined TARGET_ARCH_ARM64 | 1486 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |