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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 2955073005: VM-codegen: Add IL instruction to check if a Smi is in a constant range
Patch Set: Created 3 years, 6 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 8484162172dab831b35f0bb28b50362bdf73266e..8ee5b69c33370b49c180dc9bdc6446588e7c4910 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -6580,6 +6580,29 @@ void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* SmiRangeComparisonInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 1;
+ LocationSummary* locs = new (zone)
+ LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ locs->set_in(0, Location::RequiresRegister());
+ locs->set_temp(0, Location::RequiresRegister());
+ return locs;
+}
+
+
+Condition SmiRangeComparisonInstr::EmitComparisonCode(
+ FlowGraphCompiler* compiler,
+ BranchLabels labels) {
+ Register in = locs()->in(0).reg();
+ Register temp = locs()->temp(0).reg();
+ __ leal(temp, Address(in, Smi::RawValue(-from_)));
+ __ cmpl(temp, Immediate(Smi::RawValue(to_ - from_)));
+ return is_negated_ ? ABOVE : BELOW_EQUAL;
+}
+
+
LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 2;

Powered by Google App Engine
This is Rietveld 408576698