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 tags = RawObject::SizeTag::update(instance_size, tags); | 1406 tags = RawObject::SizeTag::update(instance_size, tags); |
1407 ASSERT(cls.id() != kIllegalCid); | 1407 ASSERT(cls.id() != kIllegalCid); |
1408 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1408 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1409 LoadImmediate(TMP, tags, pp); | 1409 LoadImmediate(TMP, tags, pp); |
1410 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); | 1410 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); |
1411 } else { | 1411 } else { |
1412 b(failure); | 1412 b(failure); |
1413 } | 1413 } |
1414 } | 1414 } |
1415 | 1415 |
| 1416 |
| 1417 Address Assembler::ElementAddressForIntIndex(bool is_external, |
| 1418 intptr_t cid, |
| 1419 intptr_t index_scale, |
| 1420 Register array, |
| 1421 intptr_t index) const { |
| 1422 const int64_t offset = index * index_scale + |
| 1423 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); |
| 1424 ASSERT(Utils::IsInt(32, offset)); |
| 1425 const OperandSize size = Address::OperandSizeFor(cid); |
| 1426 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1427 return Address(array, static_cast<int32_t>(offset), Address::Offset, size); |
| 1428 } |
| 1429 |
| 1430 |
| 1431 Address Assembler::ElementAddressForRegIndex(bool is_load, |
| 1432 bool is_external, |
| 1433 intptr_t cid, |
| 1434 intptr_t index_scale, |
| 1435 Register array, |
| 1436 Register index) { |
| 1437 // Note that index is expected smi-tagged, (i.e, LSL 1) for all arrays. |
| 1438 const intptr_t shift = Utils::ShiftForPowerOfTwo(index_scale) - kSmiTagShift; |
| 1439 const int32_t offset = |
| 1440 is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag); |
| 1441 ASSERT(array != TMP); |
| 1442 ASSERT(index != TMP); |
| 1443 const Register base = is_load ? TMP : index; |
| 1444 if ((offset == 0) && (shift == 0)) { |
| 1445 return Address(array, index, UXTX, Address::Unscaled); |
| 1446 } else if (shift < 0) { |
| 1447 ASSERT(shift == -1); |
| 1448 add(base, array, Operand(index, ASR, 1)); |
| 1449 } else { |
| 1450 add(base, array, Operand(index, LSL, shift)); |
| 1451 } |
| 1452 const OperandSize size = Address::OperandSizeFor(cid); |
| 1453 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1454 return Address(base, offset, Address::Offset, size); |
| 1455 } |
| 1456 |
1416 } // namespace dart | 1457 } // namespace dart |
1417 | 1458 |
1418 #endif // defined TARGET_ARCH_ARM64 | 1459 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |