Chromium Code Reviews| Index: runtime/vm/assembler_arm64.cc |
| =================================================================== |
| --- runtime/vm/assembler_arm64.cc (revision 38897) |
| +++ runtime/vm/assembler_arm64.cc (working copy) |
| @@ -1413,6 +1413,45 @@ |
| } |
| +void Assembler::TryAllocateArray(intptr_t cid, |
| + intptr_t instance_size, |
| + Label* failure, |
| + Register instance, |
| + Register end_address, |
| + Register temp1, |
| + Register temp2) { |
| + 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.
|
| + Heap* heap = isolate->heap(); |
| + LoadImmediate(temp1, heap->TopAddress(), PP); |
| + ldr(instance, Address(temp1, 0)); // Potential new object start. |
| + AddImmediate(end_address, instance, instance_size, PP); |
| + b(failure, VS); |
| + |
| + // Check if the allocation fits into the remaining space. |
| + // instance: potential new object start. |
| + // end_address: potential next object start. |
| + LoadImmediate(temp2, heap->EndAddress(), PP); |
| + ldr(temp2, Address(temp2, 0)); |
| + cmp(end_address, Operand(temp2)); |
| + b(failure, CS); |
| + |
| + // Successfully allocated the object(s), now update top to point to |
| + // next object start and initialize the object. |
| + str(end_address, Address(temp1, 0)); |
| + add(instance, instance, Operand(kHeapObjectTag)); |
| + LoadImmediate(temp2, instance_size, PP); |
| + UpdateAllocationStatsWithSize(cid, temp2, PP); |
| + |
| + // Initialize the tags. |
| + // instance: new object start as a tagged pointer. |
| + uword tags = 0; |
| + tags = RawObject::ClassIdTag::update(cid, tags); |
| + tags = RawObject::SizeTag::update(instance_size, tags); |
| + LoadImmediate(temp2, tags, PP); |
| + str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags. |
| +} |
| + |
| + |
| Address Assembler::ElementAddressForIntIndex(bool is_external, |
| intptr_t cid, |
| intptr_t index_scale, |