Index: runtime/vm/intermediate_language.h |
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
index 362e76bf7e9f3ef19aa57cea0035667acf362e31..8c8ca31c10565a90d69bbe9adb745966e688804a 100644 |
--- a/runtime/vm/intermediate_language.h |
+++ b/runtime/vm/intermediate_language.h |
@@ -281,6 +281,39 @@ class NotNullConstrainedCompileType : public ConstrainedCompileType { |
}; |
+class EffectSet : public ValueObject { |
+ public: |
+ enum Effects { |
+ kNoEffects = 0, |
+ kExternalization = 1, |
+ kLastEffect = kExternalization |
+ }; |
+ |
+ EffectSet(const EffectSet& other) |
+ : ValueObject(), effects_(other.effects_) { |
+ } |
+ |
+ bool IsNone() const { return effects_ == kNoEffects; } |
+ |
+ static EffectSet None() { return EffectSet(kNoEffects); } |
+ static EffectSet All() { |
+ ASSERT(EffectSet::kLastEffect == 1); |
+ return EffectSet(kExternalization); |
+ } |
+ |
+ static EffectSet Externalization() { |
+ return EffectSet(kExternalization); |
+ } |
+ |
+ bool ToInt() { return effects_; } |
+ |
+ private: |
+ explicit EffectSet(intptr_t effects) : effects_(effects) { } |
+ |
+ intptr_t effects_; |
+}; |
+ |
+ |
class Value : public ZoneAllocated { |
public: |
// A forward iterator that allows removing the current value from the |
@@ -594,9 +627,6 @@ class Instruction : public ZoneAllocated { |
// Returns true, if this instruction can deoptimize. |
virtual bool CanDeoptimize() const = 0; |
- // Returns true if the instruction may have side effects. |
- virtual bool HasSideEffect() const = 0; |
- |
// Visiting support. |
virtual void Accept(FlowGraphVisitor* visitor) = 0; |
@@ -713,12 +743,19 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
// Insert this instruction after 'prev' after use lists are computed. |
void InsertAfter(Instruction* prev); |
- // Returns true if the instruction is affected by side effects. |
- // Only instructions that are not affected by side effects can participate |
- // in redundancy elimination or loop invariant code motion. |
- // TODO(fschneider): Make this abstract and implement for all instructions |
- // instead of returning the safe default (true). |
- virtual bool AffectedBySideEffect() const { return true; } |
+ // Returns true if CSE and LICM are allowed for this instruction. |
+ virtual bool AllowsCSE() const { |
+ return false; |
+ } |
+ |
+ // Returns set of effects created by this instruction. |
+ virtual EffectSet Effects() const = 0; |
+ |
+ // Returns set of effects that affect this instruction. |
+ virtual EffectSet Dependencies() const { |
+ UNREACHABLE(); |
+ return EffectSet::All(); |
+ } |
// Get the block entry for this instruction. |
virtual BlockEntryInstr* GetBlock() const; |
@@ -908,7 +945,15 @@ class ParallelMoveInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { |
+ UNREACHABLE(); // This instruction never visited by optimization passes. |
+ return EffectSet::None(); |
+ } |
+ |
+ virtual EffectSet Dependencies() const { |
+ UNREACHABLE(); // This instruction never visited by optimization passes. |
+ return EffectSet::None(); |
+ } |
MoveOperands* AddMove(Location dest, Location src) { |
MoveOperands* move = new MoveOperands(dest, src); |
@@ -1027,7 +1072,8 @@ class BlockEntryInstr : public Instruction { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
intptr_t try_index() const { return try_index_; } |
@@ -1216,6 +1262,9 @@ class JoinEntryInstr : public BlockEntryInstr { |
virtual void PrintTo(BufferFormatter* f) const; |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ |
private: |
// Classes that have access to predecessors_ when inlining. |
friend class BlockEntryInstr; |
@@ -1526,7 +1575,7 @@ class PhiInstr : public Definition { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
// Phi is alive if it reaches a non-environment use. |
bool is_alive() const { return is_alive_; } |
@@ -1603,7 +1652,8 @@ class ParameterInstr : public Definition { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual intptr_t Hashcode() const { |
UNREACHABLE(); |
@@ -1659,7 +1709,7 @@ class PushArgumentInstr : public Definition { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
virtual void PrintOperandsTo(BufferFormatter* f) const; |
@@ -1703,7 +1753,7 @@ class ReturnInstr : public TemplateInstruction<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -1724,7 +1774,7 @@ class ThrowInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -1745,7 +1795,7 @@ class ReThrowInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -1777,7 +1827,7 @@ class GotoInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
ParallelMoveInstr* parallel_move() const { |
return parallel_move_; |
@@ -1845,7 +1895,7 @@ class BranchInstr : public ControlInstruction { |
virtual bool CanDeoptimize() const; |
virtual bool CanBeDeoptimizationTarget() const; |
- virtual bool HasSideEffect() const; |
+ virtual EffectSet Effects() const; |
ComparisonInstr* comparison() const { return comparison_; } |
void SetComparison(ComparisonInstr* comp); |
@@ -1918,7 +1968,7 @@ class StoreContextInstr : public TemplateInstruction<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); |
@@ -2135,7 +2185,7 @@ class ConstraintInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const { |
UNREACHABLE(); |
@@ -2193,12 +2243,12 @@ class ConstantInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual void InferRange(); |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const; |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual void InferRange(); |
private: |
const Object& value_; |
@@ -2244,13 +2294,13 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
- virtual bool AffectedBySideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const; |
- virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
- |
private: |
const intptr_t token_pos_; |
AbstractType& dst_type_; |
@@ -2277,13 +2327,13 @@ class AssertBooleanInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
- virtual bool AffectedBySideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const { return true; } |
- virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
- |
private: |
const intptr_t token_pos_; |
@@ -2316,7 +2366,7 @@ class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const ArgumentDefinitionTestNode& ast_node_; |
@@ -2336,8 +2386,8 @@ class CurrentContextInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
@@ -2366,7 +2416,7 @@ class ClosureCallInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
private: |
const ClosureCallNode& ast_node_; |
@@ -2428,7 +2478,7 @@ class InstanceCallInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
protected: |
friend class FlowGraphOptimizer; |
@@ -2474,7 +2524,7 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
virtual void PrintOperandsTo(BufferFormatter* f) const; |
@@ -2542,8 +2592,8 @@ inline bool BranchInstr::CanBeDeoptimizationTarget() const { |
} |
-inline bool BranchInstr::HasSideEffect() const { |
- return comparison()->HasSideEffect(); |
+inline EffectSet BranchInstr::Effects() const { |
+ return comparison()->Effects(); |
} |
@@ -2585,11 +2635,6 @@ class StrictCompareInstr : public ComparisonInstr { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const; |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
@@ -2599,6 +2644,11 @@ class StrictCompareInstr : public ComparisonInstr { |
void set_needs_number_check(bool value) { needs_number_check_ = value; } |
void set_kind(Token::Kind value) { kind_ = value; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const; |
+ |
private: |
// True if the comparison must check for double, Mint or Bigint and |
// use value comparison instead. |
@@ -2650,10 +2700,6 @@ class EqualityCompareInstr : public ComparisonInstr { |
return !IsInlinedNumericComparison(); |
} |
- virtual bool HasSideEffect() const { |
- return !IsInlinedNumericComparison(); |
- } |
- |
virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
BranchInstr* branch); |
@@ -2670,6 +2716,10 @@ class EqualityCompareInstr : public ComparisonInstr { |
bool IsPolymorphic() const; |
+ virtual EffectSet Effects() const { |
+ return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); |
+ } |
+ |
private: |
const ICData* ic_data_; |
const intptr_t token_pos_; |
@@ -2724,9 +2774,6 @@ class RelationalOpInstr : public ComparisonInstr { |
virtual bool CanDeoptimize() const { |
return !IsInlinedNumericComparison(); |
} |
- virtual bool HasSideEffect() const { |
- return !IsInlinedNumericComparison(); |
- } |
virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
BranchInstr* branch); |
@@ -2743,6 +2790,10 @@ class RelationalOpInstr : public ComparisonInstr { |
return kTagged; |
} |
+ virtual EffectSet Effects() const { |
+ return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); |
+ } |
+ |
private: |
const ICData* ic_data_; |
const intptr_t token_pos_; |
@@ -2785,18 +2836,6 @@ class IfThenElseInstr : public TemplateDefinition<2> { |
virtual void InferRange(); |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- IfThenElseInstr* other_if_then_else = other->AsIfThenElse(); |
- return (kind_ == other_if_then_else->kind_) && |
- (if_true_ == other_if_then_else->if_true_) && |
- (if_false_ == other_if_then_else->if_false_); |
- } |
- |
- virtual bool AffectedBySideEffect() const { |
- return false; |
- } |
Value* left() const { return inputs_[0]; } |
Value* right() const { return inputs_[1]; } |
@@ -2805,6 +2844,16 @@ class IfThenElseInstr : public TemplateDefinition<2> { |
Token::Kind kind() const { return kind_; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ IfThenElseInstr* other_if_then_else = other->AsIfThenElse(); |
+ return (kind_ == other_if_then_else->kind_) && |
+ (if_true_ == other_if_then_else->if_true_) && |
+ (if_false_ == other_if_then_else->if_false_); |
+ } |
+ |
private: |
const Token::Kind kind_; |
const intptr_t if_true_; |
@@ -2847,7 +2896,7 @@ class StaticCallInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
void set_result_cid(intptr_t value) { result_cid_ = value; } |
@@ -2884,9 +2933,9 @@ class LoadLocalInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { |
- UNREACHABLE(); |
- return false; |
+ virtual EffectSet Effects() const { |
+ UNREACHABLE(); // Eliminated by SSA construction. |
+ return EffectSet::None(); |
} |
void mark_last() { is_last_ = true; } |
@@ -2917,17 +2966,17 @@ class StoreLocalInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { |
- UNREACHABLE(); |
- return false; |
- } |
- |
void mark_dead() { is_dead_ = true; } |
bool is_dead() const { return is_dead_; } |
void mark_last() { is_last_ = true; } |
bool is_last() const { return is_last_; } |
+ virtual EffectSet Effects() const { |
+ UNREACHABLE(); // Eliminated by SSA construction. |
+ return EffectSet::None(); |
+ } |
+ |
private: |
const LocalVariable& local_; |
bool is_dead_; |
@@ -2960,7 +3009,7 @@ class NativeCallInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
private: |
const NativeBodyNode& ast_node_; |
@@ -3003,7 +3052,10 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ // Currently CSE/LICM don't operate on any instructions that can be affected |
+ // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
+ // are marked as having no side-effects. |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
bool CanValueBeSmi() const { |
@@ -3030,25 +3082,24 @@ class GuardFieldInstr : public TemplateInstruction<1> { |
SetInputAt(0, value); |
} |
+ Value* value() const { return inputs_[0]; } |
+ |
+ const Field& field() const { return field_; } |
+ |
DECLARE_INSTRUCTION(GuardField) |
virtual intptr_t ArgumentCount() const { return 0; } |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const; |
- |
- virtual bool AffectedBySideEffect() const; |
- |
- Value* value() const { return inputs_[0]; } |
- |
virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
virtual void PrintOperandsTo(BufferFormatter* f) const; |
- const Field& field() const { return field_; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const; |
private: |
const Field& field_; |
@@ -3070,9 +3121,9 @@ class LoadStaticFieldInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return !field().is_final(); } |
+ virtual bool AllowsCSE() const { return field_.is_final(); } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const; |
virtual bool AttributesEqual(Instruction* other) const; |
private: |
@@ -3100,7 +3151,10 @@ class StoreStaticFieldInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ // Currently CSE/LICM don't operate on any instructions that can be affected |
+ // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
+ // are marked as having no side-effects. |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
bool CanValueBeSmi() const { |
@@ -3152,16 +3206,15 @@ class LoadIndexedInstr : public TemplateDefinition<2> { |
return deopt_id_ != Isolate::kNoDeoptId; |
} |
- virtual bool HasSideEffect() const { return false; } |
virtual Representation representation() const; |
+ virtual void InferRange(); |
+ virtual bool AllowsCSE() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const; |
virtual bool AttributesEqual(Instruction* other) const; |
- virtual bool AffectedBySideEffect() const { return true; } |
- |
- virtual void InferRange(); |
- |
private: |
const intptr_t index_scale_; |
const intptr_t class_id_; |
@@ -3187,11 +3240,12 @@ class StringFromCharCodeInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return other->AsStringFromCharCode()->cid_ == cid_; |
+ } |
private: |
const intptr_t cid_; |
@@ -3233,8 +3287,6 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
- |
virtual Representation RequiredInputRepresentation(intptr_t idx) const; |
bool IsExternal() const { |
@@ -3247,6 +3299,8 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
return deopt_id_; |
} |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ |
private: |
const StoreBarrierType emit_store_barrier_; |
const intptr_t index_scale_; |
@@ -3270,7 +3324,7 @@ class BooleanNegateInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
@@ -3311,7 +3365,7 @@ class InstanceOfInstr : public TemplateDefinition<3> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3351,7 +3405,7 @@ class AllocateObjectInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const ConstructorCallNode& ast_node_; |
@@ -3381,7 +3435,7 @@ class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const ConstructorCallNode& ast_node_; |
@@ -3418,7 +3472,7 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3453,7 +3507,7 @@ class CreateClosureInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const Function& function_; |
@@ -3481,14 +3535,13 @@ class LoadUntaggedInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
// This instruction must not be moved without the indexed access that |
// depends on it (e.g. out of loops). GC may cause collect |
// the array while the external data-array is still accessed. |
- virtual bool AffectedBySideEffect() const { return true; } |
+ virtual bool AllowsCSE() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
intptr_t offset_; |
@@ -3514,26 +3567,17 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
SetInputAt(0, value); |
} |
- DECLARE_INSTRUCTION(LoadField) |
- virtual CompileType ComputeType() const; |
- |
Value* value() const { return inputs_[0]; } |
intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
const AbstractType& type() const { return type_; } |
void set_result_cid(intptr_t value) { result_cid_ = value; } |
intptr_t result_cid() const { return result_cid_; } |
- virtual void PrintOperandsTo(BufferFormatter* f) const; |
- |
- virtual bool CanDeoptimize() const { return false; } |
- |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const; |
- |
- virtual bool AffectedBySideEffect() const { return !immutable_; } |
+ void set_field_name(const char* name) { field_name_ = name; } |
+ const char* field_name() const { return field_name_; } |
- virtual void InferRange(); |
+ Field* field() const { return field_; } |
+ void set_field(Field* field) { field_ = field; } |
void set_recognized_kind(MethodRecognizer::Kind kind) { |
recognized_kind_ = kind; |
@@ -3543,6 +3587,15 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
return recognized_kind_; |
} |
+ DECLARE_INSTRUCTION(LoadField) |
+ virtual CompileType ComputeType() const; |
+ |
+ virtual void PrintOperandsTo(BufferFormatter* f) const; |
+ |
+ virtual bool CanDeoptimize() const { return false; } |
+ |
+ virtual void InferRange(); |
+ |
bool IsImmutableLengthLoad() const; |
virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
@@ -3551,11 +3604,10 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
static bool IsFixedLengthArrayCid(intptr_t cid); |
- void set_field_name(const char* name) { field_name_ = name; } |
- const char* field_name() const { return field_name_; } |
- |
- Field* field() const { return field_; } |
- void set_field(Field* field) { field_ = field; } |
+ virtual bool AllowsCSE() const { return immutable_; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const; |
+ virtual bool AttributesEqual(Instruction* other) const; |
private: |
const intptr_t offset_in_bytes_; |
@@ -3596,7 +3648,7 @@ class StoreVMFieldInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t offset_in_bytes_; |
@@ -3629,7 +3681,7 @@ class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3662,7 +3714,7 @@ class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3691,7 +3743,7 @@ class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const ConstructorCallNode& ast_node_; |
@@ -3717,7 +3769,7 @@ class AllocateContextInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3741,7 +3793,7 @@ class ChainContextInstr : public TemplateInstruction<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); |
@@ -3763,7 +3815,7 @@ class CloneContextInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -3789,7 +3841,7 @@ class CatchEntryInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::All(); } |
private: |
const LocalVariable& exception_var_; |
@@ -3809,24 +3861,22 @@ class CheckEitherNonSmiInstr : public TemplateInstruction<2> { |
deopt_id_ = instance_call->deopt_id(); |
} |
+ Value* left() const { return inputs_[0]; } |
+ Value* right() const { return inputs_[1]; } |
+ |
DECLARE_INSTRUCTION(CheckEitherNonSmi) |
virtual intptr_t ArgumentCount() const { return 0; } |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const { return true; } |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- Value* left() const { return inputs_[0]; } |
- |
- Value* right() const { return inputs_[1]; } |
- |
- virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); |
}; |
@@ -3840,20 +3890,20 @@ class BoxDoubleInstr : public TemplateDefinition<1> { |
Value* value() const { return inputs_[0]; } |
- virtual bool CanDeoptimize() const { return false; } |
- |
- virtual bool HasSideEffect() const { return false; } |
+ DECLARE_INSTRUCTION(BoxDouble) |
+ virtual CompileType ComputeType() const; |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ virtual bool CanDeoptimize() const { return false; } |
virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
ASSERT(idx == 0); |
return kUnboxedDouble; |
} |
- DECLARE_INSTRUCTION(BoxDouble) |
- virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); |
@@ -3870,11 +3920,6 @@ class BoxFloat32x4Instr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
ASSERT(idx == 0); |
return kUnboxedFloat32x4; |
@@ -3883,6 +3928,11 @@ class BoxFloat32x4Instr : public TemplateDefinition<1> { |
DECLARE_INSTRUCTION(BoxFloat32x4) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); |
}; |
@@ -3898,11 +3948,6 @@ class BoxIntegerInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
ASSERT(idx == 0); |
return kUnboxedMint; |
@@ -3911,6 +3956,11 @@ class BoxIntegerInstr : public TemplateDefinition<1> { |
DECLARE_INSTRUCTION(BoxInteger) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); |
}; |
@@ -3930,18 +3980,18 @@ class UnboxDoubleInstr : public TemplateDefinition<1> { |
&& (value()->Type()->ToCid() != kSmiCid); |
} |
- virtual bool HasSideEffect() const { return false; } |
- |
virtual Representation representation() const { |
return kUnboxedDouble; |
} |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
DECLARE_INSTRUCTION(UnboxDouble) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
}; |
@@ -3960,18 +4010,18 @@ class UnboxFloat32x4Instr : public TemplateDefinition<1> { |
return (value()->Type()->ToCid() != kFloat32x4Cid); |
} |
- virtual bool HasSideEffect() const { return false; } |
- |
virtual Representation representation() const { |
return kUnboxedFloat32x4; |
} |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
DECLARE_INSTRUCTION(UnboxFloat32x4) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); |
}; |
@@ -3991,19 +4041,18 @@ class UnboxIntegerInstr : public TemplateDefinition<1> { |
&& (value()->Type()->ToCid() != kMintCid); |
} |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual CompileType ComputeType() const; |
- |
virtual Representation representation() const { |
return kUnboxedMint; |
} |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
DECLARE_INSTRUCTION(UnboxInteger) |
+ virtual CompileType ComputeType() const; |
+ |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); |
@@ -4021,12 +4070,6 @@ class MathSqrtInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return true; |
- } |
- |
virtual Representation representation() const { |
return kUnboxedDouble; |
} |
@@ -4045,6 +4088,11 @@ class MathSqrtInstr : public TemplateDefinition<1> { |
DECLARE_INSTRUCTION(MathSqrt) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); |
}; |
@@ -4071,14 +4119,6 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return op_kind() == other->AsBinaryDoubleOp()->op_kind(); |
- } |
- |
virtual Representation representation() const { |
return kUnboxedDouble; |
} |
@@ -4099,6 +4139,13 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return op_kind() == other->AsBinaryDoubleOp()->op_kind(); |
+ } |
+ |
private: |
const Token::Kind op_kind_; |
@@ -4127,14 +4174,6 @@ class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); |
- } |
- |
virtual Representation representation() const { |
return kUnboxedFloat32x4; |
} |
@@ -4153,6 +4192,13 @@ class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { |
DECLARE_INSTRUCTION(BinaryFloat32x4Op) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); |
+ } |
+ |
private: |
const Token::Kind op_kind_; |
@@ -4177,14 +4223,6 @@ class Float32x4ShuffleInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return op_kind() == other->AsFloat32x4Shuffle()->op_kind(); |
- } |
- |
virtual Representation representation() const { |
if ((op_kind_ == MethodRecognizer::kFloat32x4ShuffleX) || |
(op_kind_ == MethodRecognizer::kFloat32x4ShuffleY) || |
@@ -4209,6 +4247,13 @@ class Float32x4ShuffleInstr : public TemplateDefinition<1> { |
DECLARE_INSTRUCTION(Float32x4Shuffle) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return op_kind() == other->AsFloat32x4Shuffle()->op_kind(); |
+ } |
+ |
private: |
const MethodRecognizer::Kind op_kind_; |
@@ -4236,12 +4281,6 @@ class Float32x4ConstructorInstr : public TemplateDefinition<4> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
virtual Representation representation() const { |
return kUnboxedFloat32x4; |
} |
@@ -4260,6 +4299,11 @@ class Float32x4ConstructorInstr : public TemplateDefinition<4> { |
DECLARE_INSTRUCTION(Float32x4Constructor) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); |
}; |
@@ -4278,12 +4322,6 @@ class Float32x4SplatInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
virtual Representation representation() const { |
return kUnboxedFloat32x4; |
} |
@@ -4302,6 +4340,11 @@ class Float32x4SplatInstr : public TemplateDefinition<1> { |
DECLARE_INSTRUCTION(Float32x4Splat) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); |
}; |
@@ -4319,12 +4362,6 @@ class Float32x4ZeroInstr : public TemplateDefinition<0> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
virtual Representation representation() const { |
return kUnboxedFloat32x4; |
} |
@@ -4343,6 +4380,11 @@ class Float32x4ZeroInstr : public TemplateDefinition<0> { |
DECLARE_INSTRUCTION(Float32x4Zero) |
virtual CompileType ComputeType() const; |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); |
}; |
@@ -4374,17 +4416,6 @@ class BinaryMintOpInstr : public TemplateDefinition<2> { |
return (op_kind() == Token::kADD) || (op_kind() == Token::kSUB); |
} |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- ASSERT(other->IsBinaryMintOp()); |
- return op_kind() == other->AsBinaryMintOp()->op_kind(); |
- } |
- |
- virtual CompileType ComputeType() const; |
- |
virtual Representation representation() const { |
return kUnboxedMint; |
} |
@@ -4403,6 +4434,15 @@ class BinaryMintOpInstr : public TemplateDefinition<2> { |
virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
DECLARE_INSTRUCTION(BinaryMintOp) |
+ virtual CompileType ComputeType() const; |
+ |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ ASSERT(other->IsBinaryMintOp()); |
+ return op_kind() == other->AsBinaryMintOp()->op_kind(); |
+ } |
private: |
const Token::Kind op_kind_; |
@@ -4434,14 +4474,6 @@ class ShiftMintOpInstr : public TemplateDefinition<2> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return op_kind() == other->AsShiftMintOp()->op_kind(); |
- } |
- |
virtual CompileType ComputeType() const; |
virtual Representation representation() const { |
@@ -4461,6 +4493,13 @@ class ShiftMintOpInstr : public TemplateDefinition<2> { |
DECLARE_INSTRUCTION(ShiftMintOp) |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return op_kind() == other->AsShiftMintOp()->op_kind(); |
+ } |
+ |
private: |
const Token::Kind op_kind_; |
@@ -4487,16 +4526,6 @@ class UnaryMintOpInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { |
- return op_kind() == other->AsUnaryMintOp()->op_kind(); |
- } |
- |
- virtual CompileType ComputeType() const; |
- |
virtual Representation representation() const { |
return kUnboxedMint; |
} |
@@ -4513,6 +4542,14 @@ class UnaryMintOpInstr : public TemplateDefinition<1> { |
} |
DECLARE_INSTRUCTION(UnaryMintOp) |
+ virtual CompileType ComputeType() const; |
+ |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return op_kind() == other->AsUnaryMintOp()->op_kind(); |
+ } |
private: |
const Token::Kind op_kind_; |
@@ -4545,28 +4582,23 @@ class BinarySmiOpInstr : public TemplateDefinition<2> { |
const ICData* ic_data() const { return instance_call()->ic_data(); } |
+ void set_overflow(bool overflow) { overflow_ = overflow; } |
+ |
+ void set_is_truncating(bool value) { is_truncating_ = value; } |
+ bool is_truncating() const { return is_truncating_; } |
+ |
virtual void PrintOperandsTo(BufferFormatter* f) const; |
DECLARE_INSTRUCTION(BinarySmiOp) |
- |
virtual CompileType ComputeType() const; |
virtual bool CanDeoptimize() const; |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const; |
- void set_overflow(bool overflow) { |
- overflow_ = overflow; |
- } |
- |
- void set_is_truncating(bool value) { |
- is_truncating_ = value; |
- } |
- bool is_truncating() const { return is_truncating_; } |
- |
void PrintTo(BufferFormatter* f) const; |
virtual void InferRange(); |
@@ -4609,7 +4641,12 @@ class UnarySmiOpInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return other->AsUnarySmiOp()->op_kind() == op_kind(); |
+ } |
private: |
const Token::Kind op_kind_; |
@@ -4631,7 +4668,7 @@ class CheckStackOverflowInstr : public TemplateInstruction<0> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
const intptr_t token_pos_; |
@@ -4659,8 +4696,9 @@ class SmiToDoubleInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- virtual bool AffectedBySideEffect() const { return false; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
@@ -4685,7 +4723,7 @@ class DoubleToIntegerInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
private: |
InstanceCallInstr* instance_call_; |
@@ -4710,8 +4748,6 @@ class DoubleToSmiInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
ASSERT(idx == 0); |
return kUnboxedDouble; |
@@ -4719,6 +4755,8 @@ class DoubleToSmiInstr : public TemplateDefinition<1> { |
virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); |
}; |
@@ -4743,12 +4781,6 @@ class DoubleToDoubleInstr : public TemplateDefinition<1> { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { |
- return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); |
- } |
- |
virtual Representation representation() const { |
return kUnboxedDouble; |
} |
@@ -4760,6 +4792,13 @@ class DoubleToDoubleInstr : public TemplateDefinition<1> { |
virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { |
+ return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); |
+ } |
+ |
private: |
const MethodRecognizer::Kind recognized_kind_; |
@@ -4785,12 +4824,6 @@ class InvokeMathCFunctionInstr : public Definition { |
virtual bool CanDeoptimize() const { return false; } |
- virtual bool HasSideEffect() const { return false; } |
- virtual bool AffectedBySideEffect() const { return false; } |
- virtual bool AttributesEqual(Instruction* other) const { |
- return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); |
- } |
- |
virtual Representation representation() const { |
return kUnboxedDouble; |
} |
@@ -4819,6 +4852,14 @@ class InvokeMathCFunctionInstr : public Definition { |
return locs_; |
} |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) { |
+ return other->AsInvokeMathCFunction()->recognized_kind() == |
+ recognized_kind(); |
+ } |
+ |
private: |
virtual void RawSetInputAt(intptr_t i, Value* value) { |
(*inputs_)[i] = value; |
@@ -4846,12 +4887,6 @@ class CheckClassInstr : public TemplateInstruction<1> { |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const; |
- |
- virtual bool AffectedBySideEffect() const; |
- |
Value* value() const { return inputs_[0]; } |
const ICData& unary_checks() const { return unary_checks_; } |
@@ -4864,6 +4899,11 @@ class CheckClassInstr : public TemplateInstruction<1> { |
bool null_check() const { return null_check_; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const; |
+ virtual bool AttributesEqual(Instruction* other) const; |
+ |
private: |
const ICData& unary_checks_; |
@@ -4881,21 +4921,20 @@ class CheckSmiInstr : public TemplateInstruction<1> { |
deopt_id_ = original_deopt_id; |
} |
+ Value* value() const { return inputs_[0]; } |
+ |
DECLARE_INSTRUCTION(CheckSmi) |
virtual intptr_t ArgumentCount() const { return 0; } |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const { return true; } |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
- Value* value() const { return inputs_[0]; } |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const { return true; } |
private: |
DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
@@ -4914,23 +4953,17 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> { |
deopt_id_ = instance_call->deopt_id(); |
} |
+ Value* length() const { return inputs_[0]; } |
+ Value* index() const { return inputs_[1]; } |
+ |
+ intptr_t array_type() const { return array_type_; } |
+ |
DECLARE_INSTRUCTION(CheckArrayBound) |
virtual intptr_t ArgumentCount() const { return 0; } |
virtual bool CanDeoptimize() const { return true; } |
- virtual bool HasSideEffect() const { return false; } |
- |
- virtual bool AttributesEqual(Instruction* other) const; |
- |
- virtual bool AffectedBySideEffect() const { return false; } |
- |
- Value* length() const { return inputs_[0]; } |
- Value* index() const { return inputs_[1]; } |
- |
- intptr_t array_type() const { return array_type_; } |
- |
bool IsRedundant(RangeBoundary length); |
// Returns the length offset for array and string types. |
@@ -4938,6 +4971,11 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> { |
static bool IsFixedLengthArrayType(intptr_t class_id); |
+ virtual bool AllowsCSE() const { return true; } |
+ virtual EffectSet Effects() const { return EffectSet::None(); } |
+ virtual EffectSet Dependencies() const { return EffectSet::None(); } |
+ virtual bool AttributesEqual(Instruction* other) const; |
+ |
private: |
intptr_t array_type_; |