| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 747 } |
| 747 | 748 |
| 748 private: | 749 private: |
| 749 friend class Definition; // Needed for InsertBefore, InsertAfter. | 750 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 750 | 751 |
| 751 // Classes that set deopt_id_. | 752 // Classes that set deopt_id_. |
| 752 friend class UnboxIntegerInstr; | 753 friend class UnboxIntegerInstr; |
| 753 friend class UnboxDoubleInstr; | 754 friend class UnboxDoubleInstr; |
| 754 friend class UnboxFloat32x4Instr; | 755 friend class UnboxFloat32x4Instr; |
| 755 friend class BinaryDoubleOpInstr; | 756 friend class BinaryDoubleOpInstr; |
| 757 friend class BinaryFloat32x4OpInstr; |
| 756 friend class BinaryMintOpInstr; | 758 friend class BinaryMintOpInstr; |
| 757 friend class BinarySmiOpInstr; | 759 friend class BinarySmiOpInstr; |
| 758 friend class UnarySmiOpInstr; | 760 friend class UnarySmiOpInstr; |
| 759 friend class ShiftMintOpInstr; | 761 friend class ShiftMintOpInstr; |
| 760 friend class UnaryMintOpInstr; | 762 friend class UnaryMintOpInstr; |
| 761 friend class MathSqrtInstr; | 763 friend class MathSqrtInstr; |
| 762 friend class CheckClassInstr; | 764 friend class CheckClassInstr; |
| 763 friend class GuardFieldInstr; | 765 friend class GuardFieldInstr; |
| 764 friend class CheckSmiInstr; | 766 friend class CheckSmiInstr; |
| 765 friend class CheckArrayBoundInstr; | 767 friend class CheckArrayBoundInstr; |
| (...skipping 3310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4076 | 4078 |
| 4077 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); | 4079 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 4078 | 4080 |
| 4079 private: | 4081 private: |
| 4080 const Token::Kind op_kind_; | 4082 const Token::Kind op_kind_; |
| 4081 | 4083 |
| 4082 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 4084 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
| 4083 }; | 4085 }; |
| 4084 | 4086 |
| 4085 | 4087 |
| 4088 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { |
| 4089 public: |
| 4090 BinaryFloat32x4OpInstr(Token::Kind op_kind, |
| 4091 Value* left, |
| 4092 Value* right, |
| 4093 InstanceCallInstr* instance_call) |
| 4094 : op_kind_(op_kind) { |
| 4095 SetInputAt(0, left); |
| 4096 SetInputAt(1, right); |
| 4097 deopt_id_ = instance_call->deopt_id(); |
| 4098 } |
| 4099 |
| 4100 Value* left() const { return inputs_[0]; } |
| 4101 Value* right() const { return inputs_[1]; } |
| 4102 |
| 4103 Token::Kind op_kind() const { return op_kind_; } |
| 4104 |
| 4105 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4106 |
| 4107 virtual bool CanDeoptimize() const { return false; } |
| 4108 |
| 4109 virtual bool HasSideEffect() const { return false; } |
| 4110 |
| 4111 virtual bool AffectedBySideEffect() const { return false; } |
| 4112 |
| 4113 virtual bool AttributesEqual(Instruction* other) const { |
| 4114 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); |
| 4115 } |
| 4116 |
| 4117 virtual Representation representation() const { |
| 4118 return kUnboxedFloat32x4; |
| 4119 } |
| 4120 |
| 4121 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4122 ASSERT((idx == 0) || (idx == 1)); |
| 4123 return kUnboxedFloat32x4; |
| 4124 } |
| 4125 |
| 4126 virtual intptr_t DeoptimizationTarget() const { |
| 4127 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 4128 // was inherited from another instruction that could deoptimize. |
| 4129 return deopt_id_; |
| 4130 } |
| 4131 |
| 4132 DECLARE_INSTRUCTION(BinaryFloat32x4Op) |
| 4133 virtual CompileType ComputeType() const; |
| 4134 |
| 4135 private: |
| 4136 const Token::Kind op_kind_; |
| 4137 |
| 4138 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); |
| 4139 }; |
| 4140 |
| 4141 |
| 4086 class BinaryMintOpInstr : public TemplateDefinition<2> { | 4142 class BinaryMintOpInstr : public TemplateDefinition<2> { |
| 4087 public: | 4143 public: |
| 4088 BinaryMintOpInstr(Token::Kind op_kind, | 4144 BinaryMintOpInstr(Token::Kind op_kind, |
| 4089 Value* left, | 4145 Value* left, |
| 4090 Value* right, | 4146 Value* right, |
| 4091 InstanceCallInstr* instance_call) | 4147 InstanceCallInstr* instance_call) |
| 4092 : op_kind_(op_kind), | 4148 : op_kind_(op_kind), |
| 4093 instance_call_(instance_call) { | 4149 instance_call_(instance_call) { |
| 4094 SetInputAt(0, left); | 4150 SetInputAt(0, left); |
| 4095 SetInputAt(1, right); | 4151 SetInputAt(1, right); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4884 ForwardInstructionIterator* current_iterator_; | 4940 ForwardInstructionIterator* current_iterator_; |
| 4885 | 4941 |
| 4886 private: | 4942 private: |
| 4887 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4943 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4888 }; | 4944 }; |
| 4889 | 4945 |
| 4890 | 4946 |
| 4891 } // namespace dart | 4947 } // namespace dart |
| 4892 | 4948 |
| 4893 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4949 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |