Index: runtime/vm/assembler_ia32.cc |
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc |
index 04d8aeaeb19f4562b7bd14cbcb37afc6552fd74f..713365db6367d1067a1442869329a423cb0f3bee 100644 |
--- a/runtime/vm/assembler_ia32.cc |
+++ b/runtime/vm/assembler_ia32.cc |
@@ -2903,54 +2903,26 @@ void Assembler::SmiUntagOrCheckClass(Register object, |
void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { |
- if (result == object) { |
- Label smi, join; |
+ ASSERT(result != object); |
+ static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; |
- testl(object, Immediate(kSmiTagMask)); |
- j(EQUAL, &smi, Assembler::kNearJump); |
- LoadClassId(result, object); |
- jmp(&join, Assembler::kNearJump); |
+ // Make a dummy "Object" whose cid is kSmiCid. |
+ movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); |
- Bind(&smi); |
- movl(result, Immediate(kSmiCid)); |
+ // Check if object (in tmp) is a Smi. |
+ testl(object, Immediate(kSmiTagMask)); |
- Bind(&join); |
- } else { |
- ASSERT(result != object); |
- static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; |
- |
- // Make a dummy "Object" whose cid is kSmiCid. |
- movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1)); |
- |
- // Check if object (in tmp) is a Smi. |
- testl(object, Immediate(kSmiTagMask)); |
- |
- // If the object is not a Smi, use the original object to load the cid. |
- // Otherwise, the dummy object is used, and the result is kSmiCid. |
- cmovne(result, object); |
- LoadClassId(result, result); |
- } |
+ // If the object is not a Smi, use the original object to load the cid. |
+ // Otherwise, the dummy object is used, and the result is kSmiCid. |
+ cmovne(result, object); |
+ LoadClassId(result, result); |
} |
void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
- if (result == object) { |
- Label smi, join; |
- |
- testl(object, Immediate(kSmiTagMask)); |
- j(EQUAL, &smi, Assembler::kNearJump); |
- LoadClassId(result, object); |
- SmiTag(result); |
- jmp(&join, Assembler::kNearJump); |
- |
- Bind(&smi); |
- movl(result, Immediate(Smi::RawValue(kSmiCid))); |
- |
- Bind(&join); |
- } else { |
- LoadClassIdMayBeSmi(result, object); |
- SmiTag(result); |
- } |
+ LoadClassIdMayBeSmi(result, object); |
+ // Tag the result. |
+ SmiTag(result); |
} |