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

Unified Diff: runtime/vm/intermediate_language.h

Issue 2955073005: VM-codegen: Add IL instruction to check if a Smi is in a constant range
Patch Set: Remove unrelated change and other Slava feedback Created 3 years, 5 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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698