Index: runtime/vm/constant_propagator.cc |
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc |
index dec674c2c1171f78b4ea6b7407af9d611738bdf8..f3dd267d1c8443cabae9771b8d902c3ef4f61080 100644 |
--- a/runtime/vm/constant_propagator.cc |
+++ b/runtime/vm/constant_propagator.cc |
@@ -431,6 +431,22 @@ void ConstantPropagator::VisitIfThenElse(IfThenElseInstr* instr) { |
} |
+void ConstantPropagator::VisitSmiRangeComparison( |
+ SmiRangeComparisonInstr* instr) { |
+ Definition* defn = instr->input()->definition(); |
+ const Object& value = defn->constant_value(); |
+ if (IsConstant(value)) { |
+ ASSERT(value.IsSmi()); |
+ intptr_t number = Smi::Cast(value).Value(); |
+ bool result = instr->to() <= number && number <= instr->from(); |
+ if (instr->is_negated()) result = !result; |
+ SetValue(instr, Bool::Get(result)); |
+ } else if (IsNonConstant(value)) { |
+ SetValue(instr, non_constant_); |
+ } |
+} |
+ |
+ |
void ConstantPropagator::VisitStrictCompare(StrictCompareInstr* instr) { |
Definition* left_defn = instr->left()->definition(); |
Definition* right_defn = instr->right()->definition(); |