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

Unified Diff: runtime/vm/assembler_arm.cc

Issue 410333003: Shorter TryAllocate instruction sequence on ARM/ARM64/MIPS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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_arm.cc
diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc
index 2ddf07cabf435c09e468409aa7f02e2b98a799f2..6ae73b14040933dd1bbf7f00e21bfd922104d0e1 100644
--- a/runtime/vm/assembler_arm.cc
+++ b/runtime/vm/assembler_arm.cc
@@ -3146,23 +3146,24 @@ void Assembler::TryAllocate(const Class& cls,
Register temp_reg) {
ASSERT(failure != NULL);
if (FLAG_inline_alloc) {
- Heap* heap = Isolate::Current()->heap();
+ ASSERT(instance_reg != temp_reg);
+ ASSERT(temp_reg != IP);
const intptr_t instance_size = cls.instance_size();
- LoadImmediate(instance_reg, heap->TopAddress());
- ldr(instance_reg, Address(instance_reg, 0));
+
+ LoadImmediate(temp_reg, Isolate::Current()->heap()->NewSpaceAddress());
+
+ ldr(instance_reg, Address(temp_reg, Scavenger::top_offset()));
AddImmediate(instance_reg, instance_size);
// instance_reg: potential next object start.
- LoadImmediate(IP, heap->EndAddress());
- ldr(IP, Address(IP, 0));
+ ldr(IP, Address(temp_reg, Scavenger::end_offset()));
cmp(IP, Operand(instance_reg));
// fail if heap end unsigned less than or equal to instance_reg.
b(failure, LS);
// Successfully allocated the object, now update top to point to
// next object start and store the class in the class field of object.
- LoadImmediate(IP, heap->TopAddress());
- str(instance_reg, Address(IP, 0));
+ str(instance_reg, Address(temp_reg, Scavenger::top_offset()));
ASSERT(instance_size >= kHeapObjectTag);
AddImmediate(instance_reg, -instance_size + kHeapObjectTag);

Powered by Google App Engine
This is Rietveld 408576698