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

Unified Diff: runtime/vm/assembler_ia32.cc

Issue 10447064: In generated code for ia32 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: runtime/vm/assembler_ia32.cc
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc
index a62ce8114255ea45efa66d726cbc84bf47408c1b..7bd7d49e553ee56214ee3f3a71a2082a5c2c8d5a 100644
--- a/runtime/vm/assembler_ia32.cc
+++ b/runtime/vm/assembler_ia32.cc
@@ -1562,6 +1562,37 @@ void Assembler::EmitGenericShift(int rm,
}
+void Assembler::LoadClassOfObject(Register result,
+ Register object,
+ Register scratch) {
+ ASSERT(scratch != result);
+ LoadClassIndexOfObject(scratch, object);
+
+ movl(result, FieldAddress(CTX, Context::isolate_offset()));
+ const intptr_t table_offset_in_isolate =
+ Isolate::class_table_offset() + ClassTable::table_offset();
+ movl(result, Address(result, table_offset_in_isolate));
+ movl(result, Address(result, scratch, TIMES_4, 0));
+}
+
+
+void Assembler::LoadClassIndexOfObject(Register result, Register object) {
+ ASSERT(RawObject::kClassTagBit == 16);
+ ASSERT(RawObject::kClassTagSize == 16);
+ const intptr_t class_id_offset = Object::tags_offset() +
+ RawObject::kClassTagBit / kBitsPerByte;
+ movzxw(result, FieldAddress(object, class_id_offset));
+}
+
+
+void Assembler::CompareClassOfObject(Register object,
+ const Class& clazz,
+ Register scratch) {
+ LoadClassIndexOfObject(scratch, object);
+ cmpl(scratch, Immediate(clazz.index()));
+}
+
+
void Assembler::Comment(const char* comment) {
if (FLAG_code_comments) {
comments_.Add(new CodeComment(buffer_.GetPosition(),

Powered by Google App Engine
This is Rietveld 408576698