Index: runtime/vm/assembler_x64.cc |
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc |
index 3d4e9ff8240c9dbfc15ba15c7ccf2a5e8c30f82c..2c63e6bb2a54d66f3e4138ddb982d4da7194a9b6 100644 |
--- a/runtime/vm/assembler_x64.cc |
+++ b/runtime/vm/assembler_x64.cc |
@@ -3432,6 +3432,25 @@ void Assembler::CompareClassId(Register object, intptr_t class_id) { |
} |
+void Assembler::SmiUntagOrCheckClass(Register object, |
+ intptr_t class_id, |
+ Label* is_smi) { |
+ ASSERT(kSmiTagShift == 1); |
+ ASSERT(RawObject::kClassIdTagPos == 16); |
+ ASSERT(RawObject::kClassIdTagSize == 16); |
+ const intptr_t class_id_offset = Object::tags_offset() + |
+ RawObject::kClassIdTagPos / kBitsPerByte; |
+ |
+ // Untag optimistically. Tag bit is shifted into the CARRY. |
+ SmiUntag(object); |
+ j(NOT_CARRY, is_smi, kNearJump); |
+ // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale |
+ // factor in the addressing mode to compensate for this. |
+ movzxw(TMP, Address(object, TIMES_2, class_id_offset)); |
+ cmpl(TMP, Immediate(class_id)); |
+} |
+ |
+ |
void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
ASSERT(result != object); |