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 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 #undef INSTRUCTION_TYPE_CHECK | 1423 #undef INSTRUCTION_TYPE_CHECK |
1424 | 1424 |
1425 // Static type of the instruction. | 1425 // Static type of the instruction. |
1426 virtual RawAbstractType* StaticType() const { | 1426 virtual RawAbstractType* StaticType() const { |
1427 UNREACHABLE(); | 1427 UNREACHABLE(); |
1428 return AbstractType::null(); | 1428 return AbstractType::null(); |
1429 } | 1429 } |
1430 | 1430 |
1431 // Returns structure describing location constraints required | 1431 // Returns structure describing location constraints required |
1432 // to emit native code for this instruction. | 1432 // to emit native code for this instruction. |
1433 virtual LocationSummary* locs() const { | 1433 virtual LocationSummary* locs() { |
1434 // TODO(vegorov): This should be pure virtual method. | 1434 // TODO(vegorov): This should be pure virtual method. |
1435 // However we are temporary using NULL for instructions that | 1435 // However we are temporary using NULL for instructions that |
1436 // were not converted to the location based code generation yet. | 1436 // were not converted to the location based code generation yet. |
1437 return NULL; | 1437 return NULL; |
1438 } | 1438 } |
1439 | 1439 |
1440 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1440 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1441 UNIMPLEMENTED(); | 1441 UNIMPLEMENTED(); |
1442 } | 1442 } |
1443 | 1443 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 return successor_; | 1643 return successor_; |
1644 } | 1644 } |
1645 | 1645 |
1646 virtual void SetSuccessor(Instruction* instr) { | 1646 virtual void SetSuccessor(Instruction* instr) { |
1647 ASSERT(successor_ == NULL); | 1647 ASSERT(successor_ == NULL); |
1648 successor_ = instr; | 1648 successor_ = instr; |
1649 } | 1649 } |
1650 | 1650 |
1651 virtual void RecordAssignedVars(BitVector* assigned_vars); | 1651 virtual void RecordAssignedVars(BitVector* assigned_vars); |
1652 | 1652 |
1653 virtual LocationSummary* locs() const { | 1653 virtual LocationSummary* locs() { |
1654 return computation()->locs(); | 1654 return computation()->locs(); |
1655 } | 1655 } |
1656 | 1656 |
1657 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1657 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1658 computation()->EmitNativeCode(compiler); | 1658 computation()->EmitNativeCode(compiler); |
1659 } | 1659 } |
1660 | 1660 |
1661 private: | 1661 private: |
1662 Computation* computation_; | 1662 Computation* computation_; |
1663 Instruction* successor_; | 1663 Instruction* successor_; |
(...skipping 30 matching lines...) Expand all Loading... |
1694 successor_ = instr; | 1694 successor_ = instr; |
1695 } | 1695 } |
1696 | 1696 |
1697 // Static type of the underlying computation. | 1697 // Static type of the underlying computation. |
1698 virtual RawAbstractType* StaticType() const { | 1698 virtual RawAbstractType* StaticType() const { |
1699 return computation()->StaticType(); | 1699 return computation()->StaticType(); |
1700 } | 1700 } |
1701 | 1701 |
1702 virtual void RecordAssignedVars(BitVector* assigned_vars); | 1702 virtual void RecordAssignedVars(BitVector* assigned_vars); |
1703 | 1703 |
1704 virtual LocationSummary* locs() const { | 1704 virtual LocationSummary* locs() { |
1705 return computation()->locs(); | 1705 return computation()->locs(); |
1706 } | 1706 } |
1707 | 1707 |
1708 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 1708 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
1709 | 1709 |
1710 private: | 1710 private: |
1711 intptr_t temp_index_; | 1711 intptr_t temp_index_; |
1712 Computation* computation_; | 1712 Computation* computation_; |
1713 Instruction* successor_; | 1713 Instruction* successor_; |
1714 | 1714 |
1715 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 1715 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
1716 }; | 1716 }; |
1717 | 1717 |
1718 | 1718 |
1719 class ReturnInstr : public Instruction { | 1719 class ReturnInstr : public Instruction { |
1720 public: | 1720 public: |
1721 ReturnInstr(intptr_t token_index, Value* value) | 1721 ReturnInstr(intptr_t token_index, Value* value) |
1722 : token_index_(token_index), value_(value) { | 1722 : token_index_(token_index), value_(value), locs_(NULL) { |
1723 ASSERT(value_ != NULL); | 1723 ASSERT(value_ != NULL); |
1724 } | 1724 } |
1725 | 1725 |
1726 DECLARE_INSTRUCTION(Return) | 1726 DECLARE_INSTRUCTION(Return) |
1727 | 1727 |
1728 Value* value() const { return value_; } | 1728 Value* value() const { return value_; } |
1729 intptr_t token_index() const { return token_index_; } | 1729 intptr_t token_index() const { return token_index_; } |
1730 | 1730 |
1731 virtual Instruction* StraightLineSuccessor() const { return NULL; } | 1731 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
1732 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1732 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
1733 | 1733 |
| 1734 virtual LocationSummary* locs(); |
| 1735 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 1736 |
1734 private: | 1737 private: |
1735 const intptr_t token_index_; | 1738 const intptr_t token_index_; |
1736 Value* value_; | 1739 Value* value_; |
| 1740 LocationSummary* locs_; |
1737 | 1741 |
1738 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 1742 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
1739 }; | 1743 }; |
1740 | 1744 |
1741 | 1745 |
1742 class ThrowInstr : public Instruction { | 1746 class ThrowInstr : public Instruction { |
1743 public: | 1747 public: |
1744 ThrowInstr(intptr_t token_index, | 1748 ThrowInstr(intptr_t token_index, |
1745 intptr_t try_index, | 1749 intptr_t try_index, |
1746 Value* exception) | 1750 Value* exception) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 const GrowableArray<BlockEntryInstr*>& block_order_; | 1895 const GrowableArray<BlockEntryInstr*>& block_order_; |
1892 | 1896 |
1893 private: | 1897 private: |
1894 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1898 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
1895 }; | 1899 }; |
1896 | 1900 |
1897 | 1901 |
1898 } // namespace dart | 1902 } // namespace dart |
1899 | 1903 |
1900 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1904 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |