| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 M(UnarySmiOp) \ | 717 M(UnarySmiOp) \ |
| 718 M(UnaryDoubleOp) \ | 718 M(UnaryDoubleOp) \ |
| 719 M(CheckStackOverflow) \ | 719 M(CheckStackOverflow) \ |
| 720 M(SmiToDouble) \ | 720 M(SmiToDouble) \ |
| 721 M(DoubleToInteger) \ | 721 M(DoubleToInteger) \ |
| 722 M(DoubleToSmi) \ | 722 M(DoubleToSmi) \ |
| 723 M(DoubleToDouble) \ | 723 M(DoubleToDouble) \ |
| 724 M(DoubleToFloat) \ | 724 M(DoubleToFloat) \ |
| 725 M(FloatToDouble) \ | 725 M(FloatToDouble) \ |
| 726 M(CheckClass) \ | 726 M(CheckClass) \ |
| 727 M(CheckClassId) \ |
| 727 M(CheckSmi) \ | 728 M(CheckSmi) \ |
| 728 M(Constant) \ | 729 M(Constant) \ |
| 729 M(UnboxedConstant) \ | 730 M(UnboxedConstant) \ |
| 730 M(CheckEitherNonSmi) \ | 731 M(CheckEitherNonSmi) \ |
| 731 M(BinaryDoubleOp) \ | 732 M(BinaryDoubleOp) \ |
| 732 M(MathUnary) \ | 733 M(MathUnary) \ |
| 733 M(MathMinMax) \ | 734 M(MathMinMax) \ |
| 734 M(UnboxDouble) \ | 735 M(UnboxDouble) \ |
| 735 M(BoxDouble) \ | 736 M(BoxDouble) \ |
| 736 M(BoxFloat32x4) \ | 737 M(BoxFloat32x4) \ |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 friend class BinaryFloat64x2OpInstr; | 1098 friend class BinaryFloat64x2OpInstr; |
| 1098 friend class BinaryMintOpInstr; | 1099 friend class BinaryMintOpInstr; |
| 1099 friend class BinarySmiOpInstr; | 1100 friend class BinarySmiOpInstr; |
| 1100 friend class UnarySmiOpInstr; | 1101 friend class UnarySmiOpInstr; |
| 1101 friend class UnaryDoubleOpInstr; | 1102 friend class UnaryDoubleOpInstr; |
| 1102 friend class ShiftMintOpInstr; | 1103 friend class ShiftMintOpInstr; |
| 1103 friend class UnaryMintOpInstr; | 1104 friend class UnaryMintOpInstr; |
| 1104 friend class MathUnaryInstr; | 1105 friend class MathUnaryInstr; |
| 1105 friend class MathMinMaxInstr; | 1106 friend class MathMinMaxInstr; |
| 1106 friend class CheckClassInstr; | 1107 friend class CheckClassInstr; |
| 1108 friend class CheckClassIdInstr; |
| 1107 friend class GuardFieldInstr; | 1109 friend class GuardFieldInstr; |
| 1108 friend class CheckSmiInstr; | 1110 friend class CheckSmiInstr; |
| 1109 friend class CheckArrayBoundInstr; | 1111 friend class CheckArrayBoundInstr; |
| 1110 friend class CheckEitherNonSmiInstr; | 1112 friend class CheckEitherNonSmiInstr; |
| 1111 friend class LICM; | 1113 friend class LICM; |
| 1112 friend class DoubleToSmiInstr; | 1114 friend class DoubleToSmiInstr; |
| 1113 friend class DoubleToDoubleInstr; | 1115 friend class DoubleToDoubleInstr; |
| 1114 friend class DoubleToFloatInstr; | 1116 friend class DoubleToFloatInstr; |
| 1115 friend class FloatToDoubleInstr; | 1117 friend class FloatToDoubleInstr; |
| 1116 friend class InvokeMathCFunctionInstr; | 1118 friend class InvokeMathCFunctionInstr; |
| (...skipping 6769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7886 virtual intptr_t ArgumentCount() const { return 0; } | 7888 virtual intptr_t ArgumentCount() const { return 0; } |
| 7887 | 7889 |
| 7888 virtual bool CanDeoptimize() const { return true; } | 7890 virtual bool CanDeoptimize() const { return true; } |
| 7889 | 7891 |
| 7890 virtual intptr_t token_pos() const { return token_pos_; } | 7892 virtual intptr_t token_pos() const { return token_pos_; } |
| 7891 | 7893 |
| 7892 Value* value() const { return inputs_[0]; } | 7894 Value* value() const { return inputs_[0]; } |
| 7893 | 7895 |
| 7894 const ICData& unary_checks() const { return unary_checks_; } | 7896 const ICData& unary_checks() const { return unary_checks_; } |
| 7895 | 7897 |
| 7898 const GrowableArray<intptr_t>& cids() const { return cids_; } |
| 7899 |
| 7896 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7900 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7897 | 7901 |
| 7898 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7902 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 7899 | 7903 |
| 7900 bool IsNullCheck() const; | 7904 bool IsNullCheck() const; |
| 7901 | 7905 |
| 7906 bool IsDenseSwitch() const; |
| 7907 intptr_t ComputeCidMask() const; |
| 7908 static bool IsDenseMask(intptr_t mask); |
| 7909 |
| 7902 virtual bool AllowsCSE() const { return true; } | 7910 virtual bool AllowsCSE() const { return true; } |
| 7903 virtual EffectSet Effects() const { return EffectSet::None(); } | 7911 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 7904 virtual EffectSet Dependencies() const; | 7912 virtual EffectSet Dependencies() const; |
| 7905 virtual bool AttributesEqual(Instruction* other) const; | 7913 virtual bool AttributesEqual(Instruction* other) const; |
| 7906 | 7914 |
| 7907 virtual bool MayThrow() const { return false; } | 7915 virtual bool MayThrow() const { return false; } |
| 7908 | 7916 |
| 7909 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7917 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
| 7910 | 7918 |
| 7911 private: | 7919 private: |
| 7912 const ICData& unary_checks_; | 7920 const ICData& unary_checks_; |
| 7921 GrowableArray<intptr_t> cids_; // Sorted, lowest first. |
| 7913 bool licm_hoisted_; | 7922 bool licm_hoisted_; |
| 7914 const intptr_t token_pos_; | 7923 const intptr_t token_pos_; |
| 7915 | 7924 |
| 7916 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); | 7925 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); |
| 7917 }; | 7926 }; |
| 7918 | 7927 |
| 7919 | 7928 |
| 7920 class CheckSmiInstr : public TemplateInstruction<1> { | 7929 class CheckSmiInstr : public TemplateInstruction<1> { |
| 7921 public: | 7930 public: |
| 7922 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos) | 7931 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 7944 | 7953 |
| 7945 virtual bool MayThrow() const { return false; } | 7954 virtual bool MayThrow() const { return false; } |
| 7946 | 7955 |
| 7947 private: | 7956 private: |
| 7948 const intptr_t token_pos_; | 7957 const intptr_t token_pos_; |
| 7949 | 7958 |
| 7950 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7959 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
| 7951 }; | 7960 }; |
| 7952 | 7961 |
| 7953 | 7962 |
| 7963 class CheckClassIdInstr : public TemplateInstruction<1> { |
| 7964 public: |
| 7965 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) : cid_(cid) { |
| 7966 SetInputAt(0, value); |
| 7967 // Override generated deopt-id. |
| 7968 deopt_id_ = deopt_id; |
| 7969 } |
| 7970 |
| 7971 Value* value() const { return inputs_[0]; } |
| 7972 intptr_t cid() const { return cid_; } |
| 7973 |
| 7974 DECLARE_INSTRUCTION(CheckClassId) |
| 7975 |
| 7976 virtual intptr_t ArgumentCount() const { return 0; } |
| 7977 |
| 7978 virtual bool CanDeoptimize() const { return true; } |
| 7979 |
| 7980 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7981 |
| 7982 virtual bool AllowsCSE() const { return true; } |
| 7983 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 7984 virtual EffectSet Dependencies() const; |
| 7985 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 7986 |
| 7987 virtual bool MayThrow() const { return false; } |
| 7988 |
| 7989 private: |
| 7990 intptr_t cid_; |
| 7991 |
| 7992 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); |
| 7993 }; |
| 7994 |
| 7995 |
| 7954 class CheckArrayBoundInstr : public TemplateInstruction<2> { | 7996 class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| 7955 public: | 7997 public: |
| 7956 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) { | 7998 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) { |
| 7957 SetInputAt(kLengthPos, length); | 7999 SetInputAt(kLengthPos, length); |
| 7958 SetInputAt(kIndexPos, index); | 8000 SetInputAt(kIndexPos, index); |
| 7959 // Override generated deopt-id. | 8001 // Override generated deopt-id. |
| 7960 deopt_id_ = deopt_id; | 8002 deopt_id_ = deopt_id; |
| 7961 } | 8003 } |
| 7962 | 8004 |
| 7963 Value* length() const { return inputs_[kLengthPos]; } | 8005 Value* length() const { return inputs_[kLengthPos]; } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8219 ForwardInstructionIterator* current_iterator_; | 8261 ForwardInstructionIterator* current_iterator_; |
| 8220 | 8262 |
| 8221 private: | 8263 private: |
| 8222 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 8264 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 8223 }; | 8265 }; |
| 8224 | 8266 |
| 8225 | 8267 |
| 8226 } // namespace dart | 8268 } // namespace dart |
| 8227 | 8269 |
| 8228 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8270 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |