| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 ASSERT(cls.id() != kIllegalCid); | 1406 ASSERT(cls.id() != kIllegalCid); |
| 1407 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1407 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1408 LoadImmediate(TMP, tags, pp); | 1408 LoadImmediate(TMP, tags, pp); |
| 1409 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); | 1409 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); |
| 1410 } else { | 1410 } else { |
| 1411 b(failure); | 1411 b(failure); |
| 1412 } | 1412 } |
| 1413 } | 1413 } |
| 1414 | 1414 |
| 1415 | 1415 |
| 1416 void Assembler::TryAllocateArray(intptr_t cid, |
| 1417 intptr_t instance_size, |
| 1418 Label* failure, |
| 1419 Register instance, |
| 1420 Register end_address, |
| 1421 Register temp1, |
| 1422 Register temp2) { |
| 1423 if (FLAG_inline_alloc) { |
| 1424 Isolate* isolate = Isolate::Current(); |
| 1425 Heap* heap = isolate->heap(); |
| 1426 LoadImmediate(temp1, heap->TopAddress(), PP); |
| 1427 ldr(instance, Address(temp1, 0)); // Potential new object start. |
| 1428 AddImmediate(end_address, instance, instance_size, PP); |
| 1429 b(failure, VS); |
| 1430 |
| 1431 // Check if the allocation fits into the remaining space. |
| 1432 // instance: potential new object start. |
| 1433 // end_address: potential next object start. |
| 1434 LoadImmediate(temp2, heap->EndAddress(), PP); |
| 1435 ldr(temp2, Address(temp2, 0)); |
| 1436 cmp(end_address, Operand(temp2)); |
| 1437 b(failure, CS); |
| 1438 |
| 1439 // Successfully allocated the object(s), now update top to point to |
| 1440 // next object start and initialize the object. |
| 1441 str(end_address, Address(temp1, 0)); |
| 1442 add(instance, instance, Operand(kHeapObjectTag)); |
| 1443 LoadImmediate(temp2, instance_size, PP); |
| 1444 UpdateAllocationStatsWithSize(cid, temp2, PP); |
| 1445 |
| 1446 // Initialize the tags. |
| 1447 // instance: new object start as a tagged pointer. |
| 1448 uword tags = 0; |
| 1449 tags = RawObject::ClassIdTag::update(cid, tags); |
| 1450 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1451 LoadImmediate(temp2, tags, PP); |
| 1452 str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags. |
| 1453 } else { |
| 1454 b(failure); |
| 1455 } |
| 1456 } |
| 1457 |
| 1458 |
| 1416 Address Assembler::ElementAddressForIntIndex(bool is_external, | 1459 Address Assembler::ElementAddressForIntIndex(bool is_external, |
| 1417 intptr_t cid, | 1460 intptr_t cid, |
| 1418 intptr_t index_scale, | 1461 intptr_t index_scale, |
| 1419 Register array, | 1462 Register array, |
| 1420 intptr_t index) const { | 1463 intptr_t index) const { |
| 1421 const int64_t offset = index * index_scale + | 1464 const int64_t offset = index * index_scale + |
| 1422 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); | 1465 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); |
| 1423 ASSERT(Utils::IsInt(32, offset)); | 1466 ASSERT(Utils::IsInt(32, offset)); |
| 1424 const OperandSize size = Address::OperandSizeFor(cid); | 1467 const OperandSize size = Address::OperandSizeFor(cid); |
| 1425 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1468 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1449 add(base, array, Operand(index, LSL, shift)); | 1492 add(base, array, Operand(index, LSL, shift)); |
| 1450 } | 1493 } |
| 1451 const OperandSize size = Address::OperandSizeFor(cid); | 1494 const OperandSize size = Address::OperandSizeFor(cid); |
| 1452 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1495 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1453 return Address(base, offset, Address::Offset, size); | 1496 return Address(base, offset, Address::Offset, size); |
| 1454 } | 1497 } |
| 1455 | 1498 |
| 1456 } // namespace dart | 1499 } // namespace dart |
| 1457 | 1500 |
| 1458 #endif // defined TARGET_ARCH_ARM64 | 1501 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |