| Index: runtime/vm/intermediate_language_mips.cc
|
| diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
|
| index 3ea3039db9e9a802252cc27dd53d644e0ff23555..05f8f21416cd41094c088e5635736a86586b9a92 100644
|
| --- a/runtime/vm/intermediate_language_mips.cc
|
| +++ b/runtime/vm/intermediate_language_mips.cc
|
| @@ -5170,7 +5170,9 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone,
|
| const intptr_t kNumTemps = 0;
|
| LocationSummary* summary = new (zone)
|
| LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| - summary->set_in(0, Location::RequiresRegister());
|
| + summary->set_in(0, cids_.IsSingleCid() ? Location::RequiresRegister()
|
| + : Location::WritableRegister());
|
| +
|
| return summary;
|
| }
|
|
|
| @@ -5178,7 +5180,18 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone,
|
| void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| Register value = locs()->in(0).reg();
|
| Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass);
|
| - __ BranchNotEqual(value, Immediate(Smi::RawValue(cid_)), deopt);
|
| + if (cids_.IsSingleCid()) {
|
| + __ BranchNotEqual(value, Immediate(Smi::RawValue(cids_.cid_start)), deopt);
|
| + } else {
|
| + __ AddImmediate(value, value, -Smi::RawValue(cids_.cid_start));
|
| + // TODO(erikcorry): We should use sltiu instead of the temporary TMP if
|
| + // the range is small enough.
|
| + __ LoadImmediate(TMP, cids_.Extent());
|
| + // Reverse comparison so we get 1 if biased_cid > tmp ie cid is out of
|
| + // range.
|
| + __ sltu(TMP, TMP, value);
|
| + __ bne(TMP, ZR, deopt);
|
| + }
|
| }
|
|
|
|
|
|
|