| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 M(SmiToDouble) \ | 573 M(SmiToDouble) \ |
| 574 M(DoubleToInteger) \ | 574 M(DoubleToInteger) \ |
| 575 M(DoubleToSmi) \ | 575 M(DoubleToSmi) \ |
| 576 M(DoubleToDouble) \ | 576 M(DoubleToDouble) \ |
| 577 M(CheckClass) \ | 577 M(CheckClass) \ |
| 578 M(CheckSmi) \ | 578 M(CheckSmi) \ |
| 579 M(Constant) \ | 579 M(Constant) \ |
| 580 M(CheckEitherNonSmi) \ | 580 M(CheckEitherNonSmi) \ |
| 581 M(BinaryDoubleOp) \ | 581 M(BinaryDoubleOp) \ |
| 582 M(MathSqrt) \ | 582 M(MathSqrt) \ |
| 583 M(MathMinMax) \ |
| 583 M(UnboxDouble) \ | 584 M(UnboxDouble) \ |
| 584 M(BoxDouble) \ | 585 M(BoxDouble) \ |
| 585 M(BoxFloat32x4) \ | 586 M(BoxFloat32x4) \ |
| 586 M(UnboxFloat32x4) \ | 587 M(UnboxFloat32x4) \ |
| 587 M(BoxUint32x4) \ | 588 M(BoxUint32x4) \ |
| 588 M(UnboxUint32x4) \ | 589 M(UnboxUint32x4) \ |
| 589 M(UnboxInteger) \ | 590 M(UnboxInteger) \ |
| 590 M(BoxInteger) \ | 591 M(BoxInteger) \ |
| 591 M(BinaryMintOp) \ | 592 M(BinaryMintOp) \ |
| 592 M(ShiftMintOp) \ | 593 M(ShiftMintOp) \ |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 friend class Uint32x4SetFlagInstr; | 902 friend class Uint32x4SetFlagInstr; |
| 902 friend class Uint32x4SelectInstr; | 903 friend class Uint32x4SelectInstr; |
| 903 friend class Uint32x4ToFloat32x4Instr; | 904 friend class Uint32x4ToFloat32x4Instr; |
| 904 friend class BinaryUint32x4OpInstr; | 905 friend class BinaryUint32x4OpInstr; |
| 905 friend class BinaryMintOpInstr; | 906 friend class BinaryMintOpInstr; |
| 906 friend class BinarySmiOpInstr; | 907 friend class BinarySmiOpInstr; |
| 907 friend class UnarySmiOpInstr; | 908 friend class UnarySmiOpInstr; |
| 908 friend class ShiftMintOpInstr; | 909 friend class ShiftMintOpInstr; |
| 909 friend class UnaryMintOpInstr; | 910 friend class UnaryMintOpInstr; |
| 910 friend class MathSqrtInstr; | 911 friend class MathSqrtInstr; |
| 912 friend class MathMinMaxInstr; |
| 911 friend class CheckClassInstr; | 913 friend class CheckClassInstr; |
| 912 friend class GuardFieldInstr; | 914 friend class GuardFieldInstr; |
| 913 friend class CheckSmiInstr; | 915 friend class CheckSmiInstr; |
| 914 friend class CheckArrayBoundInstr; | 916 friend class CheckArrayBoundInstr; |
| 915 friend class CheckEitherNonSmiInstr; | 917 friend class CheckEitherNonSmiInstr; |
| 916 friend class LICM; | 918 friend class LICM; |
| 917 friend class DoubleToSmiInstr; | 919 friend class DoubleToSmiInstr; |
| 918 friend class DoubleToDoubleInstr; | 920 friend class DoubleToDoubleInstr; |
| 919 friend class InvokeMathCFunctionInstr; | 921 friend class InvokeMathCFunctionInstr; |
| 920 friend class FlowGraphOptimizer; | 922 friend class FlowGraphOptimizer; |
| (...skipping 3704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4625 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 4627 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 4626 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4628 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 4627 | 4629 |
| 4628 virtual bool MayThrow() const { return false; } | 4630 virtual bool MayThrow() const { return false; } |
| 4629 | 4631 |
| 4630 private: | 4632 private: |
| 4631 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); | 4633 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); |
| 4632 }; | 4634 }; |
| 4633 | 4635 |
| 4634 | 4636 |
| 4637 // Represents Math's static min and max functions. |
| 4638 class MathMinMaxInstr : public TemplateDefinition<2> { |
| 4639 public: |
| 4640 MathMinMaxInstr(MethodRecognizer::Kind op_kind, |
| 4641 Value* left_value, |
| 4642 Value* right_value, |
| 4643 intptr_t deopt_id, |
| 4644 intptr_t result_cid) |
| 4645 : op_kind_(op_kind), result_cid_(result_cid) { |
| 4646 ASSERT((result_cid == kSmiCid) || (result_cid == kDoubleCid)); |
| 4647 SetInputAt(0, left_value); |
| 4648 SetInputAt(1, right_value); |
| 4649 deopt_id_ = deopt_id; |
| 4650 } |
| 4651 |
| 4652 MethodRecognizer::Kind op_kind() const { return op_kind_; } |
| 4653 |
| 4654 Value* left() const { return inputs_[0]; } |
| 4655 Value* right() const { return inputs_[1]; } |
| 4656 |
| 4657 intptr_t result_cid() const { return result_cid_; } |
| 4658 |
| 4659 virtual bool CanDeoptimize() const { return false; } |
| 4660 |
| 4661 virtual Representation representation() const { |
| 4662 if (result_cid() == kSmiCid) { |
| 4663 return kTagged; |
| 4664 } |
| 4665 ASSERT(result_cid() == kDoubleCid); |
| 4666 return kUnboxedDouble; |
| 4667 } |
| 4668 |
| 4669 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4670 if (result_cid() == kSmiCid) { |
| 4671 return kTagged; |
| 4672 } |
| 4673 ASSERT(result_cid() == kDoubleCid); |
| 4674 return kUnboxedDouble; |
| 4675 } |
| 4676 |
| 4677 virtual intptr_t DeoptimizationTarget() const { |
| 4678 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 4679 // was inherited from another instruction that could deoptimize. |
| 4680 return deopt_id_; |
| 4681 } |
| 4682 |
| 4683 DECLARE_INSTRUCTION(MathMinMax) |
| 4684 virtual CompileType ComputeType() const; |
| 4685 virtual bool AllowsCSE() const { return true; } |
| 4686 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4687 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 4688 virtual bool AttributesEqual(Instruction* other) const; |
| 4689 |
| 4690 virtual bool MayThrow() const { return false; } |
| 4691 |
| 4692 private: |
| 4693 const MethodRecognizer::Kind op_kind_; |
| 4694 const intptr_t result_cid_; |
| 4695 |
| 4696 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); |
| 4697 }; |
| 4698 |
| 4699 |
| 4635 class BinaryDoubleOpInstr : public TemplateDefinition<2> { | 4700 class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| 4636 public: | 4701 public: |
| 4637 BinaryDoubleOpInstr(Token::Kind op_kind, | 4702 BinaryDoubleOpInstr(Token::Kind op_kind, |
| 4638 Value* left, | 4703 Value* left, |
| 4639 Value* right, | 4704 Value* right, |
| 4640 intptr_t deopt_id) | 4705 intptr_t deopt_id) |
| 4641 : op_kind_(op_kind) { | 4706 : op_kind_(op_kind) { |
| 4642 SetInputAt(0, left); | 4707 SetInputAt(0, left); |
| 4643 SetInputAt(1, right); | 4708 SetInputAt(1, right); |
| 4644 // Overrided generated deopt_id. | 4709 // Overrided generated deopt_id. |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6496 ForwardInstructionIterator* current_iterator_; | 6561 ForwardInstructionIterator* current_iterator_; |
| 6497 | 6562 |
| 6498 private: | 6563 private: |
| 6499 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6564 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6500 }; | 6565 }; |
| 6501 | 6566 |
| 6502 | 6567 |
| 6503 } // namespace dart | 6568 } // namespace dart |
| 6504 | 6569 |
| 6505 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6570 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |