Chromium Code Reviews| Index: runtime/vm/assembler_arm.cc |
| =================================================================== |
| --- runtime/vm/assembler_arm.cc (revision 38897) |
| +++ runtime/vm/assembler_arm.cc (working copy) |
| @@ -3181,6 +3181,45 @@ |
| } |
| +void Assembler::TryAllocateArray(intptr_t cid, |
| + intptr_t instance_size, |
| + Label* failure, |
| + Register instance, |
| + Register end_address, |
| + Register temp1, |
| + Register temp2) { |
|
srdjan
2014/08/11 21:42:34
Guard with FLAG_inline_alloc
Florian Schneider
2014/08/13 14:56:11
Done.
|
| + Isolate* isolate = Isolate::Current(); |
| + Heap* heap = isolate->heap(); |
| + LoadImmediate(temp1, heap->TopAddress()); |
| + ldr(instance, Address(temp1, 0)); // Potential new object start. |
| + AddImmediate(end_address, instance, instance_size); |
| + 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()); |
| + 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); |
| + UpdateAllocationStatsWithSize(cid, temp2, temp1); |
| + |
| + // 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); |
| + str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags. |
| +} |
| + |
| + |
| void Assembler::Stop(const char* message) { |
| if (FLAG_print_stop_message) { |
| StubCode* stub_code = Isolate::Current()->stub_code(); |