| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 M(LoadUntagged) \ | 574 M(LoadUntagged) \ |
| 575 M(LoadClassId) \ | 575 M(LoadClassId) \ |
| 576 M(InstantiateType) \ | 576 M(InstantiateType) \ |
| 577 M(InstantiateTypeArguments) \ | 577 M(InstantiateTypeArguments) \ |
| 578 M(ExtractConstructorTypeArguments) \ | 578 M(ExtractConstructorTypeArguments) \ |
| 579 M(ExtractConstructorInstantiator) \ | 579 M(ExtractConstructorInstantiator) \ |
| 580 M(AllocateContext) \ | 580 M(AllocateContext) \ |
| 581 M(CloneContext) \ | 581 M(CloneContext) \ |
| 582 M(BinarySmiOp) \ | 582 M(BinarySmiOp) \ |
| 583 M(UnarySmiOp) \ | 583 M(UnarySmiOp) \ |
| 584 M(UnaryDoubleOp) \ |
| 584 M(CheckStackOverflow) \ | 585 M(CheckStackOverflow) \ |
| 585 M(SmiToDouble) \ | 586 M(SmiToDouble) \ |
| 586 M(DoubleToInteger) \ | 587 M(DoubleToInteger) \ |
| 587 M(DoubleToSmi) \ | 588 M(DoubleToSmi) \ |
| 588 M(DoubleToDouble) \ | 589 M(DoubleToDouble) \ |
| 589 M(CheckClass) \ | 590 M(CheckClass) \ |
| 590 M(CheckSmi) \ | 591 M(CheckSmi) \ |
| 591 M(Constant) \ | 592 M(Constant) \ |
| 592 M(CheckEitherNonSmi) \ | 593 M(CheckEitherNonSmi) \ |
| 593 M(BinaryDoubleOp) \ | 594 M(BinaryDoubleOp) \ |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 friend class Float32x4TwoArgShuffleInstr; | 914 friend class Float32x4TwoArgShuffleInstr; |
| 914 friend class Uint32x4BoolConstructorInstr; | 915 friend class Uint32x4BoolConstructorInstr; |
| 915 friend class Uint32x4GetFlagInstr; | 916 friend class Uint32x4GetFlagInstr; |
| 916 friend class Uint32x4SetFlagInstr; | 917 friend class Uint32x4SetFlagInstr; |
| 917 friend class Uint32x4SelectInstr; | 918 friend class Uint32x4SelectInstr; |
| 918 friend class Uint32x4ToFloat32x4Instr; | 919 friend class Uint32x4ToFloat32x4Instr; |
| 919 friend class BinaryUint32x4OpInstr; | 920 friend class BinaryUint32x4OpInstr; |
| 920 friend class BinaryMintOpInstr; | 921 friend class BinaryMintOpInstr; |
| 921 friend class BinarySmiOpInstr; | 922 friend class BinarySmiOpInstr; |
| 922 friend class UnarySmiOpInstr; | 923 friend class UnarySmiOpInstr; |
| 924 friend class UnaryDoubleOpInstr; |
| 923 friend class ShiftMintOpInstr; | 925 friend class ShiftMintOpInstr; |
| 924 friend class UnaryMintOpInstr; | 926 friend class UnaryMintOpInstr; |
| 925 friend class MathUnaryInstr; | 927 friend class MathUnaryInstr; |
| 926 friend class MathMinMaxInstr; | 928 friend class MathMinMaxInstr; |
| 927 friend class CheckClassInstr; | 929 friend class CheckClassInstr; |
| 928 friend class GuardFieldInstr; | 930 friend class GuardFieldInstr; |
| 929 friend class CheckSmiInstr; | 931 friend class CheckSmiInstr; |
| 930 friend class CheckArrayBoundInstr; | 932 friend class CheckArrayBoundInstr; |
| 931 friend class CheckEitherNonSmiInstr; | 933 friend class CheckEitherNonSmiInstr; |
| 932 friend class LICM; | 934 friend class LICM; |
| (...skipping 3774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4707 | 4709 |
| 4708 class BinaryDoubleOpInstr : public TemplateDefinition<2> { | 4710 class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| 4709 public: | 4711 public: |
| 4710 BinaryDoubleOpInstr(Token::Kind op_kind, | 4712 BinaryDoubleOpInstr(Token::Kind op_kind, |
| 4711 Value* left, | 4713 Value* left, |
| 4712 Value* right, | 4714 Value* right, |
| 4713 intptr_t deopt_id) | 4715 intptr_t deopt_id) |
| 4714 : op_kind_(op_kind) { | 4716 : op_kind_(op_kind) { |
| 4715 SetInputAt(0, left); | 4717 SetInputAt(0, left); |
| 4716 SetInputAt(1, right); | 4718 SetInputAt(1, right); |
| 4717 // Overrided generated deopt_id. | 4719 // Overriden generated deopt_id. |
| 4718 deopt_id_ = deopt_id; | 4720 deopt_id_ = deopt_id; |
| 4719 } | 4721 } |
| 4720 | 4722 |
| 4721 Value* left() const { return inputs_[0]; } | 4723 Value* left() const { return inputs_[0]; } |
| 4722 Value* right() const { return inputs_[1]; } | 4724 Value* right() const { return inputs_[1]; } |
| 4723 | 4725 |
| 4724 Token::Kind op_kind() const { return op_kind_; } | 4726 Token::Kind op_kind() const { return op_kind_; } |
| 4725 | 4727 |
| 4726 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4728 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4727 | 4729 |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6046 | 6048 |
| 6047 virtual bool MayThrow() const { return false; } | 6049 virtual bool MayThrow() const { return false; } |
| 6048 | 6050 |
| 6049 private: | 6051 private: |
| 6050 const Token::Kind op_kind_; | 6052 const Token::Kind op_kind_; |
| 6051 | 6053 |
| 6052 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); | 6054 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); |
| 6053 }; | 6055 }; |
| 6054 | 6056 |
| 6055 | 6057 |
| 6058 // Handles only NEGATE. |
| 6059 class UnaryDoubleOpInstr : public TemplateDefinition<1> { |
| 6060 public: |
| 6061 UnaryDoubleOpInstr(Token::Kind op_kind, |
| 6062 Value* value, |
| 6063 intptr_t deopt_id) |
| 6064 : op_kind_(op_kind) { |
| 6065 ASSERT(op_kind == Token::kNEGATE); |
| 6066 SetInputAt(0, value); |
| 6067 // Overriden generated deopt_id. |
| 6068 deopt_id_ = deopt_id; |
| 6069 } |
| 6070 |
| 6071 Value* value() const { return inputs_[0]; } |
| 6072 Token::Kind op_kind() const { return op_kind_; } |
| 6073 |
| 6074 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 6075 |
| 6076 DECLARE_INSTRUCTION(UnaryDoubleOp) |
| 6077 virtual CompileType ComputeType() const; |
| 6078 |
| 6079 virtual bool CanDeoptimize() const { return false; } |
| 6080 |
| 6081 virtual intptr_t DeoptimizationTarget() const { |
| 6082 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 6083 // was inherited from another instruction that could deoptimize. |
| 6084 return deopt_id_; |
| 6085 } |
| 6086 |
| 6087 virtual Representation representation() const { |
| 6088 return kUnboxedDouble; |
| 6089 } |
| 6090 |
| 6091 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 6092 ASSERT(idx == 0); |
| 6093 return kUnboxedDouble; |
| 6094 } |
| 6095 |
| 6096 virtual bool AllowsCSE() const { return true; } |
| 6097 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 6098 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 6099 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 6100 |
| 6101 virtual bool MayThrow() const { return false; } |
| 6102 |
| 6103 private: |
| 6104 const Token::Kind op_kind_; |
| 6105 |
| 6106 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); |
| 6107 }; |
| 6108 |
| 6109 |
| 6056 class CheckStackOverflowInstr : public TemplateInstruction<0> { | 6110 class CheckStackOverflowInstr : public TemplateInstruction<0> { |
| 6057 public: | 6111 public: |
| 6058 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) | 6112 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) |
| 6059 : token_pos_(token_pos), loop_depth_(loop_depth) {} | 6113 : token_pos_(token_pos), loop_depth_(loop_depth) {} |
| 6060 | 6114 |
| 6061 intptr_t token_pos() const { return token_pos_; } | 6115 intptr_t token_pos() const { return token_pos_; } |
| 6062 bool in_loop() const { return loop_depth_ > 0; } | 6116 bool in_loop() const { return loop_depth_ > 0; } |
| 6063 intptr_t loop_depth() const { return loop_depth_; } | 6117 intptr_t loop_depth() const { return loop_depth_; } |
| 6064 | 6118 |
| 6065 DECLARE_INSTRUCTION(CheckStackOverflow) | 6119 DECLARE_INSTRUCTION(CheckStackOverflow) |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6621 ForwardInstructionIterator* current_iterator_; | 6675 ForwardInstructionIterator* current_iterator_; |
| 6622 | 6676 |
| 6623 private: | 6677 private: |
| 6624 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6678 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6625 }; | 6679 }; |
| 6626 | 6680 |
| 6627 | 6681 |
| 6628 } // namespace dart | 6682 } // namespace dart |
| 6629 | 6683 |
| 6630 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6684 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |