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

Unified Diff: runtime/vm/assembler_mips.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
Index: runtime/vm/assembler_mips.cc
===================================================================
--- runtime/vm/assembler_mips.cc (revision 38897)
+++ runtime/vm/assembler_mips.cc (working copy)
@@ -887,6 +887,47 @@
}
+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:12 Done.
+ Isolate* isolate = Isolate::Current();
+ Heap* heap = isolate->heap();
+
+ LoadImmediate(temp1, heap->TopAddress());
+ lw(instance, Address(temp1, 0)); // Potential new object start.
+ // Potential next object start.
+ AddImmediateDetectOverflow(end_address, instance, instance_size, CMPRES1);
+ bltz(CMPRES1, failure); // CMPRES1 < 0 on overflow.
+
+ // Check if the allocation fits into the remaining space.
+ // instance: potential new object start.
+ // end_address: potential next object start.
+ LoadImmediate(temp2, heap->EndAddress());
+ lw(temp2, Address(temp2, 0));
+ BranchUnsignedGreaterEqual(end_address, temp2, failure);
+
+
+ // Successfully allocated the object(s), now update top to point to
+ // next object start and initialize the object.
+ sw(end_address, Address(temp1, 0));
+ addiu(instance, instance, Immediate(kHeapObjectTag));
+ LoadImmediate(temp1, instance_size);
+ UpdateAllocationStatsWithSize(cid, temp1, temp2);
+
+ // 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(temp1, tags);
+ sw(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags.
+}
+
+
void Assembler::CallRuntime(const RuntimeEntry& entry,
intptr_t argument_count) {
entry.Call(this, argument_count);

Powered by Google App Engine
This is Rietveld 408576698