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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 475763002: VM: Small cleanup in optimizer and intrinsics code. (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
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intrinsifier_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_x64.cc
===================================================================
--- runtime/vm/intrinsifier_x64.cc (revision 39244)
+++ runtime/vm/intrinsifier_x64.cc (working copy)
@@ -98,40 +98,10 @@
const intptr_t kArrayOffset = 1 * kWordSize;
Label fall_through;
- // Compute the size to be allocated, it is based on the array length
- // and is computed as:
- // RoundedAllocationSize(sizeof(RawGrowableObjectArray)) +
- intptr_t fixed_size = GrowableObjectArray::InstanceSize();
-
- Isolate* isolate = Isolate::Current();
- Heap* heap = isolate->heap();
-
- __ movq(RAX, Immediate(heap->TopAddress()));
- __ movq(RAX, Address(RAX, 0));
- __ leaq(RCX, Address(RAX, fixed_size));
-
- // Check if the allocation fits into the remaining space.
- // RAX: potential new backing array object start.
- // RCX: potential next object start.
- __ movq(R13, Immediate(heap->EndAddress()));
- __ cmpq(RCX, Address(R13, 0));
- __ j(ABOVE_EQUAL, &fall_through);
-
- // Successfully allocated the object(s), now update top to point to
- // next object start and initialize the object.
- __ movq(R13, Immediate(heap->TopAddress()));
- __ movq(Address(R13, 0), RCX);
- __ addq(RAX, Immediate(kHeapObjectTag));
-
- // Initialize the tags.
- // EAX: new growable array object start as a tagged pointer.
+ // Try allocating in new space.
const Class& cls = Class::Handle(
- isolate->object_store()->growable_object_array_class());
- uword tags = 0;
- tags = RawObject::SizeTag::update(fixed_size, tags);
- tags = RawObject::ClassIdTag::update(cls.id(), tags);
- __ movq(FieldAddress(RAX, GrowableObjectArray::tags_offset()),
- Immediate(tags));
+ Isolate::Current()->object_store()->growable_object_array_class());
+ __ TryAllocate(cls, &fall_through, Assembler::kNearJump, RAX, PP);
// Store backing array object in growable array object.
__ movq(RCX, Address(RSP, kArrayOffset)); // data argument.
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intrinsifier_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698