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

Unified Diff: runtime/vm/assembler_mips.cc

Issue 16272004: Implements intrinsics for MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips.cc
===================================================================
--- runtime/vm/assembler_mips.cc (revision 23484)
+++ runtime/vm/assembler_mips.cc (working copy)
@@ -16,8 +16,8 @@
DECLARE_FLAG(bool, trace_sim);
#endif
DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
+DECLARE_FLAG(bool, inline_alloc);
-
void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
ASSERT(Utils::IsAligned(data, 4));
ASSERT(Utils::IsAligned(length, 4));
@@ -397,6 +397,43 @@
}
+void Assembler::TryAllocate(const Class& cls,
+ Label* failure,
+ Register instance_reg) {
+ ASSERT(failure != NULL);
+ if (FLAG_inline_alloc) {
+ Heap* heap = Isolate::Current()->heap();
+ const intptr_t instance_size = cls.instance_size();
+ LoadImmediate(instance_reg, heap->TopAddress());
+ lw(instance_reg, Address(instance_reg, 0));
+ AddImmediate(instance_reg, instance_size);
+
+ // instance_reg: potential next object start.
+ LoadImmediate(TMP, heap->EndAddress());
+ lw(TMP, Address(TMP, 0));
+ // Fail if heap end unsigned less than or equal to instance_reg.
+ BranchUnsignedLessEqual(TMP, instance_reg, failure);
+
+ // Successfully allocated the object, now update top to point to
+ // next object start and store the class in the class field of object.
+ LoadImmediate(TMP, heap->TopAddress());
+ sw(instance_reg, Address(TMP, 0));
+
+ ASSERT(instance_size >= kHeapObjectTag);
+ AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
+
+ uword tags = 0;
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ ASSERT(cls.id() != kIllegalCid);
+ tags = RawObject::ClassIdTag::update(cls.id(), tags);
+ LoadImmediate(TMP, tags);
+ sw(TMP, FieldAddress(instance_reg, Object::tags_offset()));
+ } else {
+ b(failure);
+ }
+}
+
+
void Assembler::CallRuntime(const RuntimeEntry& entry) {
entry.Call(this);
}
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698