| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 M(AllocateObjectWithBoundsCheck, AllocateObjectWithBoundsCheckComp) \ | 87 M(AllocateObjectWithBoundsCheck, AllocateObjectWithBoundsCheckComp) \ |
| 88 M(LoadVMField, LoadVMFieldComp) \ | 88 M(LoadVMField, LoadVMFieldComp) \ |
| 89 M(StoreVMField, StoreVMFieldComp) \ | 89 M(StoreVMField, StoreVMFieldComp) \ |
| 90 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \ | 90 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \ |
| 91 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ | 91 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ |
| 92 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | 92 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ |
| 93 M(AllocateContext, AllocateContextComp) \ | 93 M(AllocateContext, AllocateContextComp) \ |
| 94 M(ChainContext, ChainContextComp) \ | 94 M(ChainContext, ChainContextComp) \ |
| 95 M(CloneContext, CloneContextComp) \ | 95 M(CloneContext, CloneContextComp) \ |
| 96 M(CatchEntry, CatchEntryComp) \ | 96 M(CatchEntry, CatchEntryComp) \ |
| 97 M(BinaryOp, BinaryOpComp) \ | 97 M(BinarySmiOp, BinarySmiOpComp) \ |
| 98 M(DoubleBinaryOp, DoubleBinaryOpComp) \ | 98 M(BinaryMintOp, BinaryMintOpComp) \ |
| 99 M(BinaryDoubleOp, BinaryDoubleOpComp) \ |
| 99 M(UnarySmiOp, UnarySmiOpComp) \ | 100 M(UnarySmiOp, UnarySmiOpComp) \ |
| 100 M(NumberNegate, NumberNegateComp) \ | 101 M(NumberNegate, NumberNegateComp) \ |
| 101 M(CheckStackOverflow, CheckStackOverflowComp) \ | 102 M(CheckStackOverflow, CheckStackOverflowComp) \ |
| 102 M(DoubleToDouble, DoubleToDoubleComp) \ | 103 M(DoubleToDouble, DoubleToDoubleComp) \ |
| 103 M(SmiToDouble, SmiToDoubleComp) \ | 104 M(SmiToDouble, SmiToDoubleComp) \ |
| 104 M(CheckClass, CheckClassComp) \ | 105 M(CheckClass, CheckClassComp) \ |
| 105 M(Materialize, MaterializeComp) | 106 M(Materialize, MaterializeComp) |
| 106 | 107 |
| 107 | 108 |
| 108 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 109 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| (...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 virtual bool CanDeoptimize() const { return false; } | 1643 virtual bool CanDeoptimize() const { return false; } |
| 1643 | 1644 |
| 1644 private: | 1645 private: |
| 1645 const LocalVariable& exception_var_; | 1646 const LocalVariable& exception_var_; |
| 1646 const LocalVariable& stacktrace_var_; | 1647 const LocalVariable& stacktrace_var_; |
| 1647 | 1648 |
| 1648 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp); | 1649 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp); |
| 1649 }; | 1650 }; |
| 1650 | 1651 |
| 1651 | 1652 |
| 1652 class BinaryOpComp : public TemplateComputation<2> { | 1653 class BinarySmiOpComp : public TemplateComputation<2> { |
| 1653 public: | 1654 public: |
| 1654 enum OperandsType { | 1655 BinarySmiOpComp(Token::Kind op_kind, |
| 1655 kDynamicOperands, | 1656 InstanceCallComp* instance_call, |
| 1656 kSmiOperands, | 1657 Value* left, |
| 1657 kMintOperands, | 1658 Value* right) |
| 1658 kDoubleOperands | |
| 1659 }; | |
| 1660 | |
| 1661 BinaryOpComp(Token::Kind op_kind, | |
| 1662 OperandsType operands_type, | |
| 1663 InstanceCallComp* instance_call, | |
| 1664 Value* left, | |
| 1665 Value* right) | |
| 1666 : op_kind_(op_kind), | 1659 : op_kind_(op_kind), |
| 1667 operands_type_(operands_type), | |
| 1668 instance_call_(instance_call) { | 1660 instance_call_(instance_call) { |
| 1669 ASSERT(left != NULL); | 1661 ASSERT(left != NULL); |
| 1670 ASSERT(right != NULL); | 1662 ASSERT(right != NULL); |
| 1663 inputs_[0] = left; |
| 1664 inputs_[1] = right; |
| 1665 } |
| 1666 |
| 1667 Value* left() const { return inputs_[0]; } |
| 1668 Value* right() const { return inputs_[1]; } |
| 1669 |
| 1670 Token::Kind op_kind() const { return op_kind_; } |
| 1671 |
| 1672 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1673 |
| 1674 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1675 |
| 1676 DECLARE_COMPUTATION(BinarySmiOp) |
| 1677 |
| 1678 virtual bool CanDeoptimize() const { return true; } |
| 1679 virtual intptr_t ResultCid() const; |
| 1680 |
| 1681 private: |
| 1682 const Token::Kind op_kind_; |
| 1683 InstanceCallComp* instance_call_; |
| 1684 |
| 1685 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpComp); |
| 1686 }; |
| 1687 |
| 1688 |
| 1689 class BinaryMintOpComp : public TemplateComputation<2> { |
| 1690 public: |
| 1691 BinaryMintOpComp(Token::Kind op_kind, |
| 1692 InstanceCallComp* instance_call, |
| 1693 Value* left, |
| 1694 Value* right) |
| 1695 : op_kind_(op_kind), |
| 1696 instance_call_(instance_call) { |
| 1697 ASSERT(left != NULL); |
| 1698 ASSERT(right != NULL); |
| 1671 inputs_[0] = left; | 1699 inputs_[0] = left; |
| 1672 inputs_[1] = right; | 1700 inputs_[1] = right; |
| 1673 } | 1701 } |
| 1674 | 1702 |
| 1675 Value* left() const { return inputs_[0]; } | 1703 Value* left() const { return inputs_[0]; } |
| 1676 Value* right() const { return inputs_[1]; } | 1704 Value* right() const { return inputs_[1]; } |
| 1677 | 1705 |
| 1678 Token::Kind op_kind() const { return op_kind_; } | 1706 Token::Kind op_kind() const { return op_kind_; } |
| 1679 | 1707 |
| 1680 OperandsType operands_type() const { return operands_type_; } | |
| 1681 | |
| 1682 InstanceCallComp* instance_call() const { return instance_call_; } | 1708 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1683 | 1709 |
| 1684 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1710 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1685 | 1711 |
| 1686 DECLARE_COMPUTATION(BinaryOp) | 1712 DECLARE_COMPUTATION(BinaryMintOp) |
| 1687 | 1713 |
| 1688 virtual bool CanDeoptimize() const { return true; } | 1714 virtual bool CanDeoptimize() const { return true; } |
| 1689 virtual intptr_t ResultCid() const; | 1715 virtual intptr_t ResultCid() const; |
| 1690 | 1716 |
| 1691 private: | 1717 private: |
| 1692 const Token::Kind op_kind_; | 1718 const Token::Kind op_kind_; |
| 1693 const OperandsType operands_type_; | |
| 1694 InstanceCallComp* instance_call_; | 1719 InstanceCallComp* instance_call_; |
| 1695 | 1720 |
| 1696 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); | 1721 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpComp); |
| 1697 }; | 1722 }; |
| 1698 | 1723 |
| 1699 | 1724 |
| 1700 class DoubleBinaryOpComp : public TemplateComputation<0> { | 1725 class BinaryDoubleOpComp : public TemplateComputation<0> { |
| 1701 public: | 1726 public: |
| 1702 DoubleBinaryOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) | 1727 BinaryDoubleOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) |
| 1703 : op_kind_(op_kind), instance_call_(instance_call) { } | 1728 : op_kind_(op_kind), instance_call_(instance_call) { } |
| 1704 | 1729 |
| 1705 Token::Kind op_kind() const { return op_kind_; } | 1730 Token::Kind op_kind() const { return op_kind_; } |
| 1706 | 1731 |
| 1707 InstanceCallComp* instance_call() const { return instance_call_; } | 1732 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1708 | 1733 |
| 1709 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1734 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1710 | 1735 |
| 1711 DECLARE_CALL_COMPUTATION(DoubleBinaryOp) | 1736 DECLARE_CALL_COMPUTATION(BinaryDoubleOp) |
| 1712 | 1737 |
| 1713 virtual intptr_t ArgumentCount() const { return 2; } | 1738 virtual intptr_t ArgumentCount() const { return 2; } |
| 1714 | 1739 |
| 1715 virtual bool CanDeoptimize() const { return true; } | 1740 virtual bool CanDeoptimize() const { return true; } |
| 1716 virtual intptr_t ResultCid() const; | 1741 virtual intptr_t ResultCid() const; |
| 1717 | 1742 |
| 1718 private: | 1743 private: |
| 1719 const Token::Kind op_kind_; | 1744 const Token::Kind op_kind_; |
| 1720 InstanceCallComp* instance_call_; | 1745 InstanceCallComp* instance_call_; |
| 1721 | 1746 |
| 1722 DISALLOW_COPY_AND_ASSIGN(DoubleBinaryOpComp); | 1747 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpComp); |
| 1723 }; | 1748 }; |
| 1724 | 1749 |
| 1725 | 1750 |
| 1726 // Handles both Smi operations: BIT_OR and NEGATE. | 1751 // Handles both Smi operations: BIT_OR and NEGATE. |
| 1727 class UnarySmiOpComp : public TemplateComputation<1> { | 1752 class UnarySmiOpComp : public TemplateComputation<1> { |
| 1728 public: | 1753 public: |
| 1729 UnarySmiOpComp(Token::Kind op_kind, | 1754 UnarySmiOpComp(Token::Kind op_kind, |
| 1730 InstanceCallComp* instance_call, | 1755 InstanceCallComp* instance_call, |
| 1731 Value* value) | 1756 Value* value) |
| 1732 : op_kind_(op_kind), instance_call_(instance_call) { | 1757 : op_kind_(op_kind), instance_call_(instance_call) { |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 ForwardInstructionIterator* current_iterator_; | 3109 ForwardInstructionIterator* current_iterator_; |
| 3085 | 3110 |
| 3086 private: | 3111 private: |
| 3087 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3112 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3088 }; | 3113 }; |
| 3089 | 3114 |
| 3090 | 3115 |
| 3091 } // namespace dart | 3116 } // namespace dart |
| 3092 | 3117 |
| 3093 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3118 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |