| 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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 Label* failure, | 1349 Label* failure, |
| 1350 Register instance_reg, | 1350 Register instance_reg, |
| 1351 Register temp_reg) { | 1351 Register temp_reg) { |
| 1352 ASSERT(failure != NULL); | 1352 ASSERT(failure != NULL); |
| 1353 if (FLAG_inline_alloc) { | 1353 if (FLAG_inline_alloc) { |
| 1354 // If this allocation is traced, program will jump to failure path | 1354 // If this allocation is traced, program will jump to failure path |
| 1355 // (i.e. the allocation stub) which will allocate the object and trace the | 1355 // (i.e. the allocation stub) which will allocate the object and trace the |
| 1356 // allocation call site. | 1356 // allocation call site. |
| 1357 MaybeTraceAllocation(cls.id(), temp_reg, failure); | 1357 MaybeTraceAllocation(cls.id(), temp_reg, failure); |
| 1358 const intptr_t instance_size = cls.instance_size(); | 1358 const intptr_t instance_size = cls.instance_size(); |
| 1359 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1359 Heap::Space space = Heap::kNew; |
| 1360 ldr(temp_reg, Address(THR, Thread::heap_offset())); | 1360 ldr(temp_reg, Address(THR, Thread::heap_offset())); |
| 1361 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space))); | 1361 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space))); |
| 1362 // TODO(koda): Protect against unsigned overflow here. | 1362 // TODO(koda): Protect against unsigned overflow here. |
| 1363 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); | 1363 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); |
| 1364 | 1364 |
| 1365 // instance_reg: potential next object start. | 1365 // instance_reg: potential next object start. |
| 1366 ldr(TMP, Address(temp_reg, Heap::EndOffset(space))); | 1366 ldr(TMP, Address(temp_reg, Heap::EndOffset(space))); |
| 1367 CompareRegisters(TMP, instance_reg); | 1367 CompareRegisters(TMP, instance_reg); |
| 1368 // fail if heap end unsigned less than or equal to instance_reg. | 1368 // fail if heap end unsigned less than or equal to instance_reg. |
| 1369 b(failure, LS); | 1369 b(failure, LS); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1394 Label* failure, | 1394 Label* failure, |
| 1395 Register instance, | 1395 Register instance, |
| 1396 Register end_address, | 1396 Register end_address, |
| 1397 Register temp1, | 1397 Register temp1, |
| 1398 Register temp2) { | 1398 Register temp2) { |
| 1399 if (FLAG_inline_alloc) { | 1399 if (FLAG_inline_alloc) { |
| 1400 // If this allocation is traced, program will jump to failure path | 1400 // If this allocation is traced, program will jump to failure path |
| 1401 // (i.e. the allocation stub) which will allocate the object and trace the | 1401 // (i.e. the allocation stub) which will allocate the object and trace the |
| 1402 // allocation call site. | 1402 // allocation call site. |
| 1403 MaybeTraceAllocation(cid, temp1, failure); | 1403 MaybeTraceAllocation(cid, temp1, failure); |
| 1404 Heap::Space space = Heap::SpaceForAllocation(cid); | 1404 Heap::Space space = Heap::kNew; |
| 1405 ldr(temp1, Address(THR, Thread::heap_offset())); | 1405 ldr(temp1, Address(THR, Thread::heap_offset())); |
| 1406 // Potential new object start. | 1406 // Potential new object start. |
| 1407 ldr(instance, Address(temp1, Heap::TopOffset(space))); | 1407 ldr(instance, Address(temp1, Heap::TopOffset(space))); |
| 1408 AddImmediateSetFlags(end_address, instance, instance_size); | 1408 AddImmediateSetFlags(end_address, instance, instance_size); |
| 1409 b(failure, CS); // Fail on unsigned overflow. | 1409 b(failure, CS); // Fail on unsigned overflow. |
| 1410 | 1410 |
| 1411 // Check if the allocation fits into the remaining space. | 1411 // Check if the allocation fits into the remaining space. |
| 1412 // instance: potential new object start. | 1412 // instance: potential new object start. |
| 1413 // end_address: potential next object start. | 1413 // end_address: potential next object start. |
| 1414 ldr(temp2, Address(temp1, Heap::EndOffset(space))); | 1414 ldr(temp2, Address(temp1, Heap::EndOffset(space))); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 add(base, array, Operand(index, LSL, shift)); | 1471 add(base, array, Operand(index, LSL, shift)); |
| 1472 } | 1472 } |
| 1473 const OperandSize size = Address::OperandSizeFor(cid); | 1473 const OperandSize size = Address::OperandSizeFor(cid); |
| 1474 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1474 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1475 return Address(base, offset, Address::Offset, size); | 1475 return Address(base, offset, Address::Offset, size); |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 } // namespace dart | 1478 } // namespace dart |
| 1479 | 1479 |
| 1480 #endif // defined TARGET_ARCH_ARM64 | 1480 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |