| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 M(BoxInteger) \ | 497 M(BoxInteger) \ |
| 498 M(BinaryMintOp) \ | 498 M(BinaryMintOp) \ |
| 499 M(ShiftMintOp) \ | 499 M(ShiftMintOp) \ |
| 500 M(UnaryMintOp) \ | 500 M(UnaryMintOp) \ |
| 501 M(CheckArrayBound) \ | 501 M(CheckArrayBound) \ |
| 502 M(Constraint) \ | 502 M(Constraint) \ |
| 503 M(StringFromCharCode) \ | 503 M(StringFromCharCode) \ |
| 504 M(InvokeMathCFunction) \ | 504 M(InvokeMathCFunction) \ |
| 505 M(GuardField) \ | 505 M(GuardField) \ |
| 506 M(IfThenElse) \ | 506 M(IfThenElse) \ |
| 507 M(BinaryFloat32x4Op) \ |
| 507 | 508 |
| 508 #define FORWARD_DECLARATION(type) class type##Instr; | 509 #define FORWARD_DECLARATION(type) class type##Instr; |
| 509 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 510 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 510 #undef FORWARD_DECLARATION | 511 #undef FORWARD_DECLARATION |
| 511 | 512 |
| 512 | 513 |
| 513 // Functions required in all concrete instruction classes. | 514 // Functions required in all concrete instruction classes. |
| 514 #define DECLARE_INSTRUCTION(type) \ | 515 #define DECLARE_INSTRUCTION(type) \ |
| 515 virtual Tag tag() const { return k##type; } \ | 516 virtual Tag tag() const { return k##type; } \ |
| 516 virtual void Accept(FlowGraphVisitor* visitor); \ | 517 virtual void Accept(FlowGraphVisitor* visitor); \ |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 } | 752 } |
| 752 | 753 |
| 753 private: | 754 private: |
| 754 friend class Definition; // Needed for InsertBefore, InsertAfter. | 755 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 755 | 756 |
| 756 // Classes that set deopt_id_. | 757 // Classes that set deopt_id_. |
| 757 friend class UnboxIntegerInstr; | 758 friend class UnboxIntegerInstr; |
| 758 friend class UnboxDoubleInstr; | 759 friend class UnboxDoubleInstr; |
| 759 friend class UnboxFloat32x4Instr; | 760 friend class UnboxFloat32x4Instr; |
| 760 friend class BinaryDoubleOpInstr; | 761 friend class BinaryDoubleOpInstr; |
| 762 friend class BinaryFloat32x4OpInstr; |
| 761 friend class BinaryMintOpInstr; | 763 friend class BinaryMintOpInstr; |
| 762 friend class BinarySmiOpInstr; | 764 friend class BinarySmiOpInstr; |
| 763 friend class UnarySmiOpInstr; | 765 friend class UnarySmiOpInstr; |
| 764 friend class ShiftMintOpInstr; | 766 friend class ShiftMintOpInstr; |
| 765 friend class UnaryMintOpInstr; | 767 friend class UnaryMintOpInstr; |
| 766 friend class MathSqrtInstr; | 768 friend class MathSqrtInstr; |
| 767 friend class CheckClassInstr; | 769 friend class CheckClassInstr; |
| 768 friend class GuardFieldInstr; | 770 friend class GuardFieldInstr; |
| 769 friend class CheckSmiInstr; | 771 friend class CheckSmiInstr; |
| 770 friend class CheckArrayBoundInstr; | 772 friend class CheckArrayBoundInstr; |
| (...skipping 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4074 | 4076 |
| 4075 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); | 4077 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 4076 | 4078 |
| 4077 private: | 4079 private: |
| 4078 const Token::Kind op_kind_; | 4080 const Token::Kind op_kind_; |
| 4079 | 4081 |
| 4080 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 4082 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
| 4081 }; | 4083 }; |
| 4082 | 4084 |
| 4083 | 4085 |
| 4086 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { |
| 4087 public: |
| 4088 BinaryFloat32x4OpInstr(Token::Kind op_kind, |
| 4089 Value* left, |
| 4090 Value* right, |
| 4091 InstanceCallInstr* instance_call) |
| 4092 : op_kind_(op_kind) { |
| 4093 SetInputAt(0, left); |
| 4094 SetInputAt(1, right); |
| 4095 deopt_id_ = instance_call->deopt_id(); |
| 4096 } |
| 4097 |
| 4098 Value* left() const { return inputs_[0]; } |
| 4099 Value* right() const { return inputs_[1]; } |
| 4100 |
| 4101 Token::Kind op_kind() const { return op_kind_; } |
| 4102 |
| 4103 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4104 |
| 4105 virtual bool CanDeoptimize() const { return false; } |
| 4106 |
| 4107 virtual bool HasSideEffect() const { return false; } |
| 4108 |
| 4109 virtual bool AffectedBySideEffect() const { return false; } |
| 4110 |
| 4111 virtual bool AttributesEqual(Instruction* other) const { |
| 4112 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); |
| 4113 } |
| 4114 |
| 4115 virtual Representation representation() const { |
| 4116 return kUnboxedFloat32x4; |
| 4117 } |
| 4118 |
| 4119 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4120 ASSERT((idx == 0) || (idx == 1)); |
| 4121 return kUnboxedFloat32x4; |
| 4122 } |
| 4123 |
| 4124 virtual intptr_t DeoptimizationTarget() const { |
| 4125 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 4126 // was inherited from another instruction that could deoptimize. |
| 4127 return deopt_id_; |
| 4128 } |
| 4129 |
| 4130 DECLARE_INSTRUCTION(BinaryFloat32x4Op) |
| 4131 virtual CompileType ComputeType() const; |
| 4132 |
| 4133 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 4134 |
| 4135 private: |
| 4136 const Token::Kind op_kind_; |
| 4137 |
| 4138 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); |
| 4139 }; |
| 4140 |
| 4141 |
| 4084 class BinaryMintOpInstr : public TemplateDefinition<2> { | 4142 class BinaryMintOpInstr : public TemplateDefinition<2> { |
| 4085 public: | 4143 public: |
| 4086 BinaryMintOpInstr(Token::Kind op_kind, | 4144 BinaryMintOpInstr(Token::Kind op_kind, |
| 4087 Value* left, | 4145 Value* left, |
| 4088 Value* right, | 4146 Value* right, |
| 4089 InstanceCallInstr* instance_call) | 4147 InstanceCallInstr* instance_call) |
| 4090 : op_kind_(op_kind), | 4148 : op_kind_(op_kind), |
| 4091 instance_call_(instance_call) { | 4149 instance_call_(instance_call) { |
| 4092 SetInputAt(0, left); | 4150 SetInputAt(0, left); |
| 4093 SetInputAt(1, right); | 4151 SetInputAt(1, right); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4882 ForwardInstructionIterator* current_iterator_; | 4940 ForwardInstructionIterator* current_iterator_; |
| 4883 | 4941 |
| 4884 private: | 4942 private: |
| 4885 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4943 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4886 }; | 4944 }; |
| 4887 | 4945 |
| 4888 | 4946 |
| 4889 } // namespace dart | 4947 } // namespace dart |
| 4890 | 4948 |
| 4891 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4949 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |