Chromium Code Reviews| Index: runtime/vm/assembler_x64.cc |
| diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc |
| index d7e8aac433060be3d82abea01de8859063d74a56..eb47498980675467607d18959c5fa8fa3349c38f 100644 |
| --- a/runtime/vm/assembler_x64.cc |
| +++ b/runtime/vm/assembler_x64.cc |
| @@ -1540,6 +1540,41 @@ void Assembler::EmitGenericShift(bool wide, |
| } |
| +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::LoadClassByIndex(Register result, Register class_index) { |
| + ASSERT(result != class_index); |
| + 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_index, TIMES_8, 0)); |
| +} |
| + |
| + |
| +void Assembler::LoadClassOfObject(Register result, |
| + Register object, |
| + Register scratch) { |
|
srdjan
2012/05/30 16:44:00
You do not need to pass scratch, use TMP register
|
| + LoadClassIndexOfObject(scratch, object); |
| + LoadClassByIndex(result, scratch); |
| +} |
| + |
| + |
| +void Assembler::CompareClassOfObject(Register object, |
| + const Class& clazz, |
| + Register scratch) { |
|
srdjan
2012/05/30 16:44:00
ditto
|
| + LoadClassIndexOfObject(scratch, object); |
| + cmpl(scratch, Immediate(clazz.index())); |
| +} |
| + |
| + |
| void Assembler::Comment(const char* format, ...) { |
| if (FLAG_code_comments) { |
| char buffer[1024]; |