Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: runtime/vm/assembler_arm64.cc

Issue 346823003: VM: Optimized context allocation on all platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_arm64.cc
===================================================================
--- runtime/vm/assembler_arm64.cc (revision 38897)
+++ runtime/vm/assembler_arm64.cc (working copy)
@@ -1413,6 +1413,49 @@
}
+void Assembler::TryAllocateArray(intptr_t cid,
+ intptr_t instance_size,
+ Label* failure,
+ Register instance,
+ Register end_address,
+ Register temp1,
+ Register temp2) {
+ if (FLAG_inline_alloc) {
+ Isolate* isolate = Isolate::Current();
+ 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.
+ } else {
+ b(failure);
+ }
+}
+
+
Address Assembler::ElementAddressForIntIndex(bool is_external,
intptr_t cid,
intptr_t index_scale,
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698