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

Unified Diff: runtime/vm/intermediate_language_dbc.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_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index 4e675296f48f63250bde9a11d461470d701a4e60..c79517e5b644099043413e62bfc9df0a430ef7c2 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -482,6 +482,26 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler,
}
+Condition SmiRangeComparisonInstr::GetNextInstructionCondition(
+ FlowGraphCompiler* compiler,
+ BranchLabels labels) {
+ return is_negated_ ? NEXT_IS_TRUE : NEXT_IS_FALSE;
+}
+
+
+Condition SmiRangeComparisonInstr::EmitComparisonCode(
+ FlowGraphCompiler* compiler,
+ BranchLabels labels) {
+ __ CheckClassIdRange(locs()->in(0).reg(),
+ compiler->ToEmbeddableCid(from_, this));
+ __ Nop(__ AddConstant(Smi::Handle(Smi::New(to_ - from_))));
+ return is_negated_ ? NEXT_IS_TRUE : NEXT_IS_FALSE;
+}
+
+
+DEFINE_MAKE_LOCATION_SUMMARY(SmiRangeComparison, 1)
+
+
Condition StrictCompareInstr::GetNextInstructionCondition(
FlowGraphCompiler* compiler,
BranchLabels labels) {

Powered by Google App Engine
This is Rietveld 408576698