Index: runtime/vm/constant_propagator.cc |
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc |
index dec674c2c1171f78b4ea6b7407af9d611738bdf8..9a5be2a76ee621860ffc042344ab1f990fc0d870 100644 |
--- a/runtime/vm/constant_propagator.cc |
+++ b/runtime/vm/constant_propagator.cc |
@@ -431,6 +431,24 @@ 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(); |
+ if (number < instr->from() || instr->to() < number) { |
Vyacheslav Egorov (Google)
2017/06/28 13:53:47
maybe better:
bool result = instr->from() <= numb
erikcorry
2017/07/03 08:59:55
Done, but with <= because to() is inclusive.
|
+ SetValue(instr, Bool::Get(instr->is_negated())); |
+ } else { |
+ SetValue(instr, Bool::Get(!instr->is_negated())); |
+ } |
+ } 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(); |