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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 ldr(TMP, Address(TMP2, size_field_offset)); | 1369 ldr(TMP, Address(TMP2, size_field_offset)); |
| 1370 add(TMP, TMP, Operand(size_reg)); | 1370 add(TMP, TMP, Operand(size_reg)); |
| 1371 str(TMP, Address(TMP2, size_field_offset)); | 1371 str(TMP, Address(TMP2, size_field_offset)); |
| 1372 } | 1372 } |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 | 1375 |
| 1376 void Assembler::TryAllocate(const Class& cls, | 1376 void Assembler::TryAllocate(const Class& cls, |
| 1377 Label* failure, | 1377 Label* failure, |
| 1378 Register instance_reg, | 1378 Register instance_reg, |
| 1379 Register temp_reg, | |
|
regis
2014/07/23 22:29:33
Use TMP2.
Vyacheslav Egorov (Google)
2014/07/24 11:24:48
AddImmediate is using TMP2 as a scratch register o
regis
2014/07/24 17:06:07
Acknowledged.
| |
| 1379 Register pp) { | 1380 Register pp) { |
| 1380 ASSERT(failure != NULL); | 1381 ASSERT(failure != NULL); |
| 1381 if (FLAG_inline_alloc) { | 1382 if (FLAG_inline_alloc) { |
| 1382 Heap* heap = Isolate::Current()->heap(); | 1383 Heap* heap = Isolate::Current()->heap(); |
| 1383 const intptr_t instance_size = cls.instance_size(); | 1384 const intptr_t instance_size = cls.instance_size(); |
| 1384 LoadImmediate(instance_reg, heap->TopAddress(), pp); | 1385 LoadImmediate(temp_reg, heap->NewSpaceAddress(), pp); |
| 1385 ldr(instance_reg, Address(instance_reg)); | 1386 ldr(instance_reg, Address(temp_reg, Scavenger::top_offset())); |
| 1386 AddImmediate(instance_reg, instance_reg, instance_size, pp); | 1387 AddImmediate(instance_reg, instance_reg, instance_size, pp); |
| 1387 | 1388 |
| 1388 // instance_reg: potential next object start. | 1389 // instance_reg: potential next object start. |
| 1389 LoadImmediate(TMP, heap->EndAddress(), pp); | 1390 ldr(TMP, Address(temp_reg, Scavenger::end_offset())); |
| 1390 ldr(TMP, Address(TMP)); | |
| 1391 CompareRegisters(TMP, instance_reg); | 1391 CompareRegisters(TMP, instance_reg); |
| 1392 // fail if heap end unsigned less than or equal to instance_reg. | 1392 // fail if heap end unsigned less than or equal to instance_reg. |
| 1393 b(failure, LS); | 1393 b(failure, LS); |
| 1394 | 1394 |
| 1395 // Successfully allocated the object, now update top to point to | 1395 // Successfully allocated the object, now update top to point to |
| 1396 // next object start and store the class in the class field of object. | 1396 // next object start and store the class in the class field of object. |
| 1397 LoadImmediate(TMP, heap->TopAddress(), pp); | 1397 str(instance_reg, Address(temp_reg, Scavenger::top_offset())); |
| 1398 str(instance_reg, Address(TMP)); | |
| 1399 | 1398 |
| 1400 ASSERT(instance_size >= kHeapObjectTag); | 1399 ASSERT(instance_size >= kHeapObjectTag); |
| 1401 AddImmediate( | 1400 AddImmediate( |
| 1402 instance_reg, instance_reg, -instance_size + kHeapObjectTag, pp); | 1401 instance_reg, instance_reg, -instance_size + kHeapObjectTag, pp); |
| 1403 UpdateAllocationStats(cls.id(), pp); | 1402 UpdateAllocationStats(cls.id(), pp); |
| 1404 | 1403 |
| 1405 uword tags = 0; | 1404 uword tags = 0; |
| 1406 tags = RawObject::SizeTag::update(instance_size, tags); | 1405 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1407 ASSERT(cls.id() != kIllegalCid); | 1406 ASSERT(cls.id() != kIllegalCid); |
| 1408 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1407 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1450 add(base, array, Operand(index, LSL, shift)); | 1449 add(base, array, Operand(index, LSL, shift)); |
| 1451 } | 1450 } |
| 1452 const OperandSize size = Address::OperandSizeFor(cid); | 1451 const OperandSize size = Address::OperandSizeFor(cid); |
| 1453 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1452 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1454 return Address(base, offset, Address::Offset, size); | 1453 return Address(base, offset, Address::Offset, size); |
| 1455 } | 1454 } |
| 1456 | 1455 |
| 1457 } // namespace dart | 1456 } // namespace dart |
| 1458 | 1457 |
| 1459 #endif // defined TARGET_ARCH_ARM64 | 1458 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |