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

Unified Diff: runtime/vm/assembler_ia32.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_ia32.cc
===================================================================
--- runtime/vm/assembler_ia32.cc (revision 38897)
+++ runtime/vm/assembler_ia32.cc (working copy)
@@ -2443,6 +2443,7 @@
class_heap_stats_table_address + class_offset + size_field_offset);
}
+
void Assembler::UpdateAllocationStats(intptr_t cid,
Register temp_reg,
Heap::Space space) {
@@ -2523,6 +2524,45 @@
}
+void Assembler::TryAllocateArray(intptr_t cid,
+ intptr_t instance_size,
+ Label* failure,
+ bool near_jump,
+ Register instance,
+ Register end_address) {
+ ASSERT(failure != NULL);
+ if (FLAG_inline_alloc) {
+ Isolate* isolate = Isolate::Current();
+ Heap* heap = isolate->heap();
+ movl(instance, Address::Absolute(heap->TopAddress()));
+ movl(end_address, instance);
+
+ addl(end_address, Immediate(instance_size));
+ j(CARRY, failure);
+
+ // Check if the allocation fits into the remaining space.
+ // EAX: potential new object start.
+ // EBX: potential next object start.
+ cmpl(end_address, Address::Absolute(heap->EndAddress()));
+ j(ABOVE_EQUAL, failure);
+
+ // Successfully allocated the object(s), now update top to point to
+ // next object start and initialize the object.
+ movl(Address::Absolute(heap->TopAddress()), end_address);
+ addl(instance, Immediate(kHeapObjectTag));
+ UpdateAllocationStatsWithSize(cid, instance_size, kNoRegister);
+
+ // Initialize the tags.
+ uword tags = 0;
+ tags = RawObject::ClassIdTag::update(cid, tags);
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags));
+ } else {
+ jmp(failure);
+ }
+}
+
+
void Assembler::EnterDartFrame(intptr_t frame_size) {
EnterFrame(0);
Label dart_entry;

Powered by Google App Engine
This is Rietveld 408576698