| Index: runtime/vm/assembler_mips.cc
|
| ===================================================================
|
| --- runtime/vm/assembler_mips.cc (revision 38317)
|
| +++ runtime/vm/assembler_mips.cc (working copy)
|
| @@ -692,26 +692,15 @@
|
|
|
|
|
| void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
|
| - ASSERT(object != TMP);
|
| - ASSERT(result != TMP);
|
| + static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos;
|
|
|
| - // Make a copy of object since result and object can be the same register.
|
| - mov(TMP, object);
|
| - // Load up a null object. We only need it so we can use LoadClassId on it in
|
| - // the case that object is a Smi.
|
| - LoadImmediate(result, reinterpret_cast<intptr_t>(Object::null()));
|
| - // Check if the object is a Smi.
|
| - andi(CMPRES1, TMP, Immediate(kSmiTagMask));
|
| - // If the object *is* a Smi, load the null object into tmp. o/w leave alone.
|
| - movz(TMP, result, CMPRES1);
|
| - // Loads either the cid of the object if it isn't a Smi, or the cid of null
|
| - // if it is a Smi, which will be ignored.
|
| - LoadClassId(result, TMP);
|
| -
|
| - LoadImmediate(TMP, kSmiCid);
|
| - // If object is a Smi, move the Smi cid into result. o/w leave alone.
|
| + LoadImmediate(TMP, reinterpret_cast<int32_t>(&kSmiCidSource) + 1);
|
| + andi(CMPRES1, object, Immediate(kSmiTagMask));
|
| + if (result != object) {
|
| + mov(result, object);
|
| + }
|
| movz(result, TMP, CMPRES1);
|
| - // Finally, tag the result.
|
| + LoadClassId(result, result);
|
| SmiTag(result);
|
| }
|
|
|
|
|