Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 2891713002: Cleanup: Make CheckClassId instruction more general so it (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 967fb56d95a4b85d5e2db722ff141b9e0e2d0c5d..76543629a20ab14a15e4429b53227e6adcd7620c 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -5927,7 +5927,8 @@ 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;
}
@@ -5935,8 +5936,14 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone,
void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register value = locs()->in(0).reg();
Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass);
- __ cmpl(value, Immediate(Smi::RawValue(cid_)));
- __ j(NOT_ZERO, deopt);
+ if (cids_.IsSingleCid()) {
+ __ cmpl(value, Immediate(Smi::RawValue(cids_.cid_start)));
+ __ j(NOT_ZERO, deopt);
+ } else {
+ __ AddImmediate(value, Immediate(-Smi::RawValue(cids_.cid_start)));
+ __ cmpl(value, Immediate(Smi::RawValue(cids_.cid_end - cids_.cid_start)));
+ __ j(ABOVE, deopt);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698