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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 10458031: In generated code for x64 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Eliminate CoreClass helpers on ia32/x64 and use class ids for array classes. 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
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64.cc
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index d7e8aac433060be3d82abea01de8859063d74a56..06e7d367fa052ef005e3504bfb708a126b9c7ecf 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -1540,6 +1540,37 @@ void Assembler::EmitGenericShift(bool wide,
}
+void Assembler::LoadClassId(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::LoadClassById(Register result, Register class_id) {
+ ASSERT(result != class_id);
+ movq(result, FieldAddress(CTX, Context::isolate_offset()));
+ const intptr_t table_offset_in_isolate =
+ Isolate::class_table_offset() + ClassTable::table_offset();
+ movq(result, Address(result, table_offset_in_isolate));
+ movq(result, Address(result, class_id, TIMES_8, 0));
+}
+
+
+void Assembler::LoadClass(Register result, Register object) {
+ LoadClassId(TMP, object);
+ LoadClassById(result, TMP);
+}
+
+
+void Assembler::CompareClassId(Register object, intptr_t class_id) {
+ LoadClassId(TMP, object);
+ cmpl(TMP, Immediate(class_id));
+}
+
+
void Assembler::Comment(const char* format, ...) {
if (FLAG_code_comments) {
char buffer[1024];
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698