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 5051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5062 | 5062 |
5063 virtual bool MayThrow() const { return false; } | 5063 virtual bool MayThrow() const { return false; } |
5064 | 5064 |
5065 private: | 5065 private: |
5066 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); | 5066 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); |
5067 }; | 5067 }; |
5068 | 5068 |
5069 | 5069 |
5070 class MathUnaryInstr : public TemplateDefinition<1> { | 5070 class MathUnaryInstr : public TemplateDefinition<1> { |
5071 public: | 5071 public: |
5072 MathUnaryInstr(MethodRecognizer::Kind kind, Value* value, intptr_t deopt_id) | 5072 enum MathUnaryKind { |
| 5073 kIllegal, |
| 5074 kSin, |
| 5075 kCos, |
| 5076 kSqrt, |
| 5077 kDoubleSquare, |
| 5078 }; |
| 5079 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) |
5073 : kind_(kind) { | 5080 : kind_(kind) { |
5074 SetInputAt(0, value); | 5081 SetInputAt(0, value); |
5075 deopt_id_ = deopt_id; | 5082 deopt_id_ = deopt_id; |
5076 } | 5083 } |
5077 | 5084 |
5078 Value* value() const { return inputs_[0]; } | 5085 Value* value() const { return inputs_[0]; } |
5079 MethodRecognizer::Kind kind() const { return kind_; } | 5086 MathUnaryKind kind() const { return kind_; } |
5080 const RuntimeEntry& TargetFunction() const; | 5087 const RuntimeEntry& TargetFunction() const; |
5081 | 5088 |
5082 virtual void PrintOperandsTo(BufferFormatter* f) const; | 5089 virtual void PrintOperandsTo(BufferFormatter* f) const; |
5083 | 5090 |
5084 virtual bool CanDeoptimize() const { return false; } | 5091 virtual bool CanDeoptimize() const { return false; } |
5085 | 5092 |
5086 virtual Representation representation() const { | 5093 virtual Representation representation() const { |
5087 return kUnboxedDouble; | 5094 return kUnboxedDouble; |
5088 } | 5095 } |
5089 | 5096 |
(...skipping 15 matching lines...) Expand all Loading... |
5105 virtual EffectSet Effects() const { return EffectSet::None(); } | 5112 virtual EffectSet Effects() const { return EffectSet::None(); } |
5106 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 5113 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
5107 virtual bool AttributesEqual(Instruction* other) const { | 5114 virtual bool AttributesEqual(Instruction* other) const { |
5108 return kind() == other->AsMathUnary()->kind(); | 5115 return kind() == other->AsMathUnary()->kind(); |
5109 } | 5116 } |
5110 | 5117 |
5111 virtual bool MayThrow() const { return false; } | 5118 virtual bool MayThrow() const { return false; } |
5112 | 5119 |
5113 Definition* Canonicalize(FlowGraph* flow_graph); | 5120 Definition* Canonicalize(FlowGraph* flow_graph); |
5114 | 5121 |
| 5122 static const char* KindToCString(MathUnaryKind kind); |
| 5123 |
5115 private: | 5124 private: |
5116 const MethodRecognizer::Kind kind_; | 5125 const MathUnaryKind kind_; |
5117 | 5126 |
5118 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); | 5127 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); |
5119 }; | 5128 }; |
5120 | 5129 |
5121 | 5130 |
5122 // Represents Math's static min and max functions. | 5131 // Represents Math's static min and max functions. |
5123 class MathMinMaxInstr : public TemplateDefinition<2> { | 5132 class MathMinMaxInstr : public TemplateDefinition<2> { |
5124 public: | 5133 public: |
5125 MathMinMaxInstr(MethodRecognizer::Kind op_kind, | 5134 MathMinMaxInstr(MethodRecognizer::Kind op_kind, |
5126 Value* left_value, | 5135 Value* left_value, |
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7944 ForwardInstructionIterator* current_iterator_; | 7953 ForwardInstructionIterator* current_iterator_; |
7945 | 7954 |
7946 private: | 7955 private: |
7947 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7956 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
7948 }; | 7957 }; |
7949 | 7958 |
7950 | 7959 |
7951 } // namespace dart | 7960 } // namespace dart |
7952 | 7961 |
7953 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7962 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |