Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10453098: Move Throw and ReThrow to the location based code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 #undef INSTRUCTION_TYPE_CHECK 1424 #undef INSTRUCTION_TYPE_CHECK
1425 1425
1426 // Static type of the instruction. 1426 // Static type of the instruction.
1427 virtual RawAbstractType* StaticType() const { 1427 virtual RawAbstractType* StaticType() const {
1428 UNREACHABLE(); 1428 UNREACHABLE();
1429 return AbstractType::null(); 1429 return AbstractType::null();
1430 } 1430 }
1431 1431
1432 // Returns structure describing location constraints required 1432 // Returns structure describing location constraints required
1433 // to emit native code for this instruction. 1433 // to emit native code for this instruction.
1434 virtual LocationSummary* locs() const { 1434 virtual LocationSummary* locs() {
1435 // TODO(vegorov): This should be pure virtual method. 1435 // TODO(vegorov): This should be pure virtual method.
1436 // However we are temporary using NULL for instructions that 1436 // However we are temporary using NULL for instructions that
1437 // were not converted to the location based code generation yet. 1437 // were not converted to the location based code generation yet.
1438 return NULL; 1438 return NULL;
1439 } 1439 }
1440 1440
1441 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1441 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1442 UNIMPLEMENTED(); 1442 UNIMPLEMENTED();
1443 } 1443 }
1444 1444
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 return successor_; 1644 return successor_;
1645 } 1645 }
1646 1646
1647 virtual void SetSuccessor(Instruction* instr) { 1647 virtual void SetSuccessor(Instruction* instr) {
1648 ASSERT(successor_ == NULL); 1648 ASSERT(successor_ == NULL);
1649 successor_ = instr; 1649 successor_ = instr;
1650 } 1650 }
1651 1651
1652 virtual void RecordAssignedVars(BitVector* assigned_vars); 1652 virtual void RecordAssignedVars(BitVector* assigned_vars);
1653 1653
1654 virtual LocationSummary* locs() const { 1654 virtual LocationSummary* locs() {
1655 return computation()->locs(); 1655 return computation()->locs();
1656 } 1656 }
1657 1657
1658 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1658 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1659 computation()->EmitNativeCode(compiler); 1659 computation()->EmitNativeCode(compiler);
1660 } 1660 }
1661 1661
1662 private: 1662 private:
1663 Computation* computation_; 1663 Computation* computation_;
1664 Instruction* successor_; 1664 Instruction* successor_;
(...skipping 30 matching lines...) Expand all
1695 successor_ = instr; 1695 successor_ = instr;
1696 } 1696 }
1697 1697
1698 // Static type of the underlying computation. 1698 // Static type of the underlying computation.
1699 virtual RawAbstractType* StaticType() const { 1699 virtual RawAbstractType* StaticType() const {
1700 return computation()->StaticType(); 1700 return computation()->StaticType();
1701 } 1701 }
1702 1702
1703 virtual void RecordAssignedVars(BitVector* assigned_vars); 1703 virtual void RecordAssignedVars(BitVector* assigned_vars);
1704 1704
1705 virtual LocationSummary* locs() const { 1705 virtual LocationSummary* locs() {
1706 return computation()->locs(); 1706 return computation()->locs();
1707 } 1707 }
1708 1708
1709 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 1709 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
1710 1710
1711 private: 1711 private:
1712 intptr_t temp_index_; 1712 intptr_t temp_index_;
1713 Computation* computation_; 1713 Computation* computation_;
1714 Instruction* successor_; 1714 Instruction* successor_;
1715 1715
(...skipping 25 matching lines...) Expand all
1741 1741
1742 1742
1743 class ThrowInstr : public Instruction { 1743 class ThrowInstr : public Instruction {
1744 public: 1744 public:
1745 ThrowInstr(intptr_t token_index, 1745 ThrowInstr(intptr_t token_index,
1746 intptr_t try_index, 1746 intptr_t try_index,
1747 Value* exception) 1747 Value* exception)
1748 : token_index_(token_index), 1748 : token_index_(token_index),
1749 try_index_(try_index), 1749 try_index_(try_index),
1750 exception_(exception), 1750 exception_(exception),
1751 successor_(NULL) { 1751 successor_(NULL),
1752 locs_(NULL) {
1752 ASSERT(exception_ != NULL); 1753 ASSERT(exception_ != NULL);
1753 } 1754 }
1754 1755
1755 DECLARE_INSTRUCTION(Throw) 1756 DECLARE_INSTRUCTION(Throw)
1756 1757
1757 intptr_t token_index() const { return token_index_; } 1758 intptr_t token_index() const { return token_index_; }
1758 intptr_t try_index() const { return try_index_; } 1759 intptr_t try_index() const { return try_index_; }
1759 Value* exception() const { return exception_; } 1760 Value* exception() const { return exception_; }
1760 1761
1761 // Parser can generate a throw within an expression tree. We never 1762 // Parser can generate a throw within an expression tree. We never
1762 // add successor instructions to the graph. 1763 // add successor instructions to the graph.
1763 virtual Instruction* StraightLineSuccessor() const { return NULL; } 1764 virtual Instruction* StraightLineSuccessor() const { return NULL; }
1764 virtual void SetSuccessor(Instruction* instr) { 1765 virtual void SetSuccessor(Instruction* instr) {
1765 ASSERT(successor_ == NULL); 1766 ASSERT(successor_ == NULL);
1766 } 1767 }
1767 1768
1769 LocationSummary* locs() {
1770 if (locs_ == NULL) {
1771 locs_ = MakeLocationSummary();
1772 }
1773 return locs_;
1774 }
1775
1776 static LocationSummary* MakeLocationSummary();
1777
1778 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
1779
1768 private: 1780 private:
1769 const intptr_t token_index_; 1781 const intptr_t token_index_;
1770 const intptr_t try_index_; 1782 const intptr_t try_index_;
1771 Value* exception_; 1783 Value* exception_;
1772 Instruction* successor_; 1784 Instruction* successor_;
1785 LocationSummary* locs_;
1773 1786
1774 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 1787 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
1775 }; 1788 };
1776 1789
1777 1790
1778 class ReThrowInstr : public Instruction { 1791 class ReThrowInstr : public Instruction {
1779 public: 1792 public:
1780 ReThrowInstr(intptr_t token_index, 1793 ReThrowInstr(intptr_t token_index,
1781 intptr_t try_index, 1794 intptr_t try_index,
1782 Value* exception, 1795 Value* exception,
1783 Value* stack_trace) 1796 Value* stack_trace)
1784 : token_index_(token_index), 1797 : token_index_(token_index),
1785 try_index_(try_index), 1798 try_index_(try_index),
1786 exception_(exception), 1799 exception_(exception),
1787 stack_trace_(stack_trace), 1800 stack_trace_(stack_trace),
1788 successor_(NULL) { 1801 successor_(NULL),
1802 locs_(NULL) {
1789 ASSERT(exception_ != NULL); 1803 ASSERT(exception_ != NULL);
1790 ASSERT(stack_trace_ != NULL); 1804 ASSERT(stack_trace_ != NULL);
1791 } 1805 }
1792 1806
1793 DECLARE_INSTRUCTION(ReThrow) 1807 DECLARE_INSTRUCTION(ReThrow)
1794 1808
1795 intptr_t token_index() const { return token_index_; } 1809 intptr_t token_index() const { return token_index_; }
1796 intptr_t try_index() const { return try_index_; } 1810 intptr_t try_index() const { return try_index_; }
1797 Value* exception() const { return exception_; } 1811 Value* exception() const { return exception_; }
1798 Value* stack_trace() const { return stack_trace_; } 1812 Value* stack_trace() const { return stack_trace_; }
1799 1813
1800 // Parser can generate a rethrow within an expression tree. We 1814 // Parser can generate a rethrow within an expression tree. We
1801 // never add successor instructions to the graph. 1815 // never add successor instructions to the graph.
1802 virtual Instruction* StraightLineSuccessor() const { 1816 virtual Instruction* StraightLineSuccessor() const {
1803 return NULL; 1817 return NULL;
1804 } 1818 }
1805 virtual void SetSuccessor(Instruction* instr) { 1819 virtual void SetSuccessor(Instruction* instr) {
1806 ASSERT(successor_ == NULL); 1820 ASSERT(successor_ == NULL);
1807 } 1821 }
1808 1822
1823 LocationSummary* locs() {
1824 if (locs_ == NULL) {
1825 locs_ = MakeLocationSummary();
1826 }
1827 return locs_;
1828 }
1829
1830 static LocationSummary* MakeLocationSummary();
1831
1832 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
1833
1809 private: 1834 private:
1810 const intptr_t token_index_; 1835 const intptr_t token_index_;
1811 const intptr_t try_index_; 1836 const intptr_t try_index_;
1812 Value* exception_; 1837 Value* exception_;
1813 Value* stack_trace_; 1838 Value* stack_trace_;
1814 Instruction* successor_; 1839 Instruction* successor_;
1840 LocationSummary* locs_;
Florian Schneider 2012/05/31 13:32:26 Can this be just a member of Instruction instead o
1815 1841
1816 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 1842 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
1817 }; 1843 };
1818 1844
1819 1845
1820 class BranchInstr : public Instruction { 1846 class BranchInstr : public Instruction {
1821 public: 1847 public:
1822 explicit BranchInstr(Value* value) 1848 explicit BranchInstr(Value* value)
1823 : value_(value), 1849 : value_(value),
1824 true_successor_(NULL), 1850 true_successor_(NULL),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 const GrowableArray<BlockEntryInstr*>& block_order_; 1918 const GrowableArray<BlockEntryInstr*>& block_order_;
1893 1919
1894 private: 1920 private:
1895 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1921 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1896 }; 1922 };
1897 1923
1898 1924
1899 } // namespace dart 1925 } // namespace dart
1900 1926
1901 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1927 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698