Chromium Code Reviews| 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 Isolate* isolate = Isolate::Current(); | |
|
srdjan
2014/08/11 21:42:34
Guard this with FLAG_inline_alloc.
Florian Schneider
2014/08/13 14:56:12
Done.
| |
| 1424 Heap* heap = isolate->heap(); | |
| 1425 LoadImmediate(temp1, heap->TopAddress(), PP); | |
| 1426 ldr(instance, Address(temp1, 0)); // Potential new object start. | |
| 1427 AddImmediate(end_address, instance, instance_size, PP); | |
| 1428 b(failure, VS); | |
| 1429 | |
| 1430 // Check if the allocation fits into the remaining space. | |
| 1431 // instance: potential new object start. | |
| 1432 // end_address: potential next object start. | |
| 1433 LoadImmediate(temp2, heap->EndAddress(), PP); | |
| 1434 ldr(temp2, Address(temp2, 0)); | |
| 1435 cmp(end_address, Operand(temp2)); | |
| 1436 b(failure, CS); | |
| 1437 | |
| 1438 // Successfully allocated the object(s), now update top to point to | |
| 1439 // next object start and initialize the object. | |
| 1440 str(end_address, Address(temp1, 0)); | |
| 1441 add(instance, instance, Operand(kHeapObjectTag)); | |
| 1442 LoadImmediate(temp2, instance_size, PP); | |
| 1443 UpdateAllocationStatsWithSize(cid, temp2, PP); | |
| 1444 | |
| 1445 // Initialize the tags. | |
| 1446 // instance: new object start as a tagged pointer. | |
| 1447 uword tags = 0; | |
| 1448 tags = RawObject::ClassIdTag::update(cid, tags); | |
| 1449 tags = RawObject::SizeTag::update(instance_size, tags); | |
| 1450 LoadImmediate(temp2, tags, PP); | |
| 1451 str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags. | |
| 1452 } | |
| 1453 | |
| 1454 | |
| 1416 Address Assembler::ElementAddressForIntIndex(bool is_external, | 1455 Address Assembler::ElementAddressForIntIndex(bool is_external, |
| 1417 intptr_t cid, | 1456 intptr_t cid, |
| 1418 intptr_t index_scale, | 1457 intptr_t index_scale, |
| 1419 Register array, | 1458 Register array, |
| 1420 intptr_t index) const { | 1459 intptr_t index) const { |
| 1421 const int64_t offset = index * index_scale + | 1460 const int64_t offset = index * index_scale + |
| 1422 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); | 1461 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); |
| 1423 ASSERT(Utils::IsInt(32, offset)); | 1462 ASSERT(Utils::IsInt(32, offset)); |
| 1424 const OperandSize size = Address::OperandSizeFor(cid); | 1463 const OperandSize size = Address::OperandSizeFor(cid); |
| 1425 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1464 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1449 add(base, array, Operand(index, LSL, shift)); | 1488 add(base, array, Operand(index, LSL, shift)); |
| 1450 } | 1489 } |
| 1451 const OperandSize size = Address::OperandSizeFor(cid); | 1490 const OperandSize size = Address::OperandSizeFor(cid); |
| 1452 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1491 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1453 return Address(base, offset, Address::Offset, size); | 1492 return Address(base, offset, Address::Offset, size); |
| 1454 } | 1493 } |
| 1455 | 1494 |
| 1456 } // namespace dart | 1495 } // namespace dart |
| 1457 | 1496 |
| 1458 #endif // defined TARGET_ARCH_ARM64 | 1497 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |