Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
| index 457dd7c4c298dc533c152517ed8193c1e5b10725..ed044a568c2dcd2ac762b348720f4ebeaf2e0b6e 100644 |
| --- a/runtime/vm/intermediate_language.h |
| +++ b/runtime/vm/intermediate_language.h |
| @@ -477,6 +477,7 @@ class EmbeddedArray<T, 0> { |
| M(AllocateUninitializedContext) \ |
| M(CloneContext) \ |
| M(BinarySmiOp) \ |
| + M(CheckedSmiComparison) \ |
| M(CheckedSmiOp) \ |
| M(BinaryInt32Op) \ |
| M(UnarySmiOp) \ |
| @@ -2381,7 +2382,7 @@ class ComparisonInstr : public Definition { |
| void set_operation_cid(intptr_t value) { operation_cid_ = value; } |
| intptr_t operation_cid() const { return operation_cid_; } |
| - void NegateComparison() { |
| + virtual void NegateComparison() { |
| kind_ = Token::NegateComparison(kind_); |
| } |
| @@ -6997,7 +6998,7 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
| Value* left() const { return inputs_[0]; } |
| Value* right() const { return inputs_[1]; } |
| - virtual bool CanDeoptimize() const { return true; } |
| + virtual bool CanDeoptimize() const { return false; } |
| virtual EffectSet Effects() const { return EffectSet::All(); } |
| @@ -7014,6 +7015,53 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
| }; |
| +class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
| + public: |
| + CheckedSmiComparisonInstr(Token::Kind op_kind, |
| + Value* left, |
| + Value* right, |
| + InstanceCallInstr* call) |
| + : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), |
| + call_(call), |
| + is_negated_(false) { |
| + SetInputAt(0, left); |
| + SetInputAt(1, right); |
| + } |
| + |
| + InstanceCallInstr* call() const { return call_; } |
| + |
| + virtual bool CanDeoptimize() const { return false; } |
| + |
| + virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| + |
| + virtual void NegateComparison() { |
| + ComparisonInstr::NegateComparison(); |
| + is_negated_ = true; |
| + } |
|
Vyacheslav Egorov (Google)
2016/11/01 13:19:07
If this function is called twice then is_negated_
Florian Schneider
2016/11/01 15:26:25
Yes, thanks.
Done.
|
| + |
| + bool is_negated() const { return is_negated_; } |
| + |
| + virtual EffectSet Effects() const { return EffectSet::All(); } |
| + |
| + PRINT_OPERANDS_TO_SUPPORT |
| + |
| + DECLARE_INSTRUCTION(CheckedSmiComparison) |
| + |
| + virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| + BranchInstr* branch); |
| + |
| + virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| + BranchLabels labels); |
| + |
| + virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
| + |
| + private: |
| + InstanceCallInstr* call_; |
| + bool is_negated_; |
| + DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); |
| +}; |
| + |
| + |
| class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
| public: |
| BinaryIntegerOpInstr(Token::Kind op_kind, |