Index: runtime/vm/intermediate_language.h |
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
index 69164b03d908061e87dcb6423b4d2594a83c2fc3..8b98ae514f7fa4a36a30bbd8c1a6d64e1d4bddf7 100644 |
--- a/runtime/vm/intermediate_language.h |
+++ b/runtime/vm/intermediate_language.h |
@@ -415,6 +415,7 @@ class EmbeddedArray<T, 0> { |
M(CloneContext) \ |
M(BinarySmiOp) \ |
M(CheckedSmiComparison) \ |
+ M(SmiRangeComparison) \ |
M(CheckedSmiOp) \ |
M(BinaryInt32Op) \ |
M(UnarySmiOp) \ |
@@ -6964,6 +6965,54 @@ class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
}; |
+// Instruction that checks whether a Smi input is in a constant |
+// inclusive range. |
+class SmiRangeComparisonInstr : public TemplateComparison<1, NoThrow, Pure> { |
+ public: |
+ SmiRangeComparisonInstr(TokenPosition token_pos, |
+ Value* input, |
+ intptr_t from, |
+ intptr_t to) |
+ // We use the kIS token here since the base class requires a token |
+ // and this instruction is used for testing the type of an object. |
+ // If the test is negated, we will use Token::kISNOT. |
+ : TemplateComparison(token_pos, Token::kIS, Thread::kNoDeoptId), |
+ from_(from), |
+ to_(to) { |
+ SetInputAt(0, input); |
+ } |
+ |
+ virtual bool ComputeCanDeoptimize() const { return false; } |
+ |
+ Value* input() const { return inputs_[0]; } |
+ |
+ intptr_t from() { return from_; } |
+ intptr_t to() { return to_; } |
+ bool is_negated() const { return kind() == Token::kISNOT; } |
+ |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ |
+ virtual CompileType ComputeType() const; |
+ |
+ virtual bool AttributesEqual(Instruction* other) const; |
+ |
+ PRINT_OPERANDS_TO_SUPPORT |
+ |
+ DECLARE_COMPARISON_INSTRUCTION(SmiRangeComparison) |
+ |
+ virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
+ |
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
+ return kTagged; |
+ } |
+ |
+ private: |
+ const intptr_t from_; |
+ const intptr_t to_; |
+ DISALLOW_COPY_AND_ASSIGN(SmiRangeComparisonInstr); |
+}; |
+ |
+ |
class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
public: |
BinaryIntegerOpInstr(Token::Kind op_kind, |