Chromium Code Reviews| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 virtual RawAbstractType* StaticType() const; \ | 275 virtual RawAbstractType* StaticType() const; \ |
| 276 virtual LocationSummary* MakeLocationSummary() const; \ | 276 virtual LocationSummary* MakeLocationSummary() const; \ |
| 277 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 277 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 278 | 278 |
| 279 // Functions defined in all concrete value classes. | 279 // Functions defined in all concrete value classes. |
| 280 #define DECLARE_VALUE(ShortName) \ | 280 #define DECLARE_VALUE(ShortName) \ |
| 281 DECLARE_COMPUTATION(ShortName) \ | 281 DECLARE_COMPUTATION(ShortName) \ |
| 282 virtual void PrintTo(BufferFormatter* f) const; | 282 virtual void PrintTo(BufferFormatter* f) const; |
| 283 | 283 |
| 284 | 284 |
| 285 class Definition; | |
| 285 class BindInstr; | 286 class BindInstr; |
| 287 class PhiInstr; | |
| 286 | 288 |
| 287 class UseVal : public Value { | 289 class UseVal : public Value { |
| 288 public: | 290 public: |
| 289 explicit UseVal(BindInstr* definition) : definition_(definition) {} | 291 explicit UseVal(Definition* definition) : definition_(definition) {} |
| 290 | 292 |
| 291 DECLARE_VALUE(Use) | 293 DECLARE_VALUE(Use) |
| 292 | 294 |
| 293 BindInstr* definition() const { return definition_; } | 295 Definition* definition() const { return definition_; } |
| 296 void set_definition(Definition* definition) { | |
| 297 definition_ = definition; | |
| 298 } | |
|
srdjan
2012/06/12 17:34:37
Why do you need set_defintion?
Florian Schneider
2012/06/13 10:53:40
Renaming. I could leave it out for this CL. Left-o
| |
| 294 | 299 |
| 295 private: | 300 private: |
| 296 BindInstr* definition_; | 301 Definition* definition_; |
| 297 | 302 |
| 298 DISALLOW_COPY_AND_ASSIGN(UseVal); | 303 DISALLOW_COPY_AND_ASSIGN(UseVal); |
| 299 }; | 304 }; |
| 300 | 305 |
| 301 | 306 |
| 302 class ConstantVal: public Value { | 307 class ConstantVal: public Value { |
| 303 public: | 308 public: |
| 304 explicit ConstantVal(const Object& value) | 309 explicit ConstantVal(const Object& value) |
| 305 : value_(value) { | 310 : value_(value) { |
| 306 ASSERT(value.IsZoneHandle()); | 311 ASSERT(value.IsZoneHandle()); |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1475 ASSERT(value != NULL); | 1480 ASSERT(value != NULL); |
| 1476 inputs_[0] = value; | 1481 inputs_[0] = value; |
| 1477 } | 1482 } |
| 1478 | 1483 |
| 1479 Value* value() const { return inputs_[0]; } | 1484 Value* value() const { return inputs_[0]; } |
| 1480 | 1485 |
| 1481 InstanceCallComp* instance_call() const { return instance_call_; } | 1486 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1482 | 1487 |
| 1483 DECLARE_COMPUTATION(NumberNegate) | 1488 DECLARE_COMPUTATION(NumberNegate) |
| 1484 | 1489 |
| 1490 void InsertPhi(intptr_t variable_index) { } | |
|
srdjan
2012/06/12 17:34:37
Why is this needed?
Florian Schneider
2012/06/13 10:53:40
Accidental edit.
| |
| 1491 | |
| 1485 private: | 1492 private: |
| 1486 InstanceCallComp* instance_call_; | 1493 InstanceCallComp* instance_call_; |
| 1487 | 1494 |
| 1488 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); | 1495 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); |
| 1489 }; | 1496 }; |
| 1490 | 1497 |
| 1491 | 1498 |
| 1492 class CheckStackOverflowComp : public TemplateComputation<0> { | 1499 class CheckStackOverflowComp : public TemplateComputation<0> { |
| 1493 public: | 1500 public: |
| 1494 CheckStackOverflowComp(intptr_t token_index, intptr_t try_index) | 1501 CheckStackOverflowComp(intptr_t token_index, intptr_t try_index) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1535 | 1542 |
| 1536 // M is a single argument macro. It is applied to each concrete instruction | 1543 // M is a single argument macro. It is applied to each concrete instruction |
| 1537 // type name. The concrete instruction classes are the name with Instr | 1544 // type name. The concrete instruction classes are the name with Instr |
| 1538 // concatenated. | 1545 // concatenated. |
| 1539 #define FOR_EACH_INSTRUCTION(M) \ | 1546 #define FOR_EACH_INSTRUCTION(M) \ |
| 1540 M(GraphEntry) \ | 1547 M(GraphEntry) \ |
| 1541 M(JoinEntry) \ | 1548 M(JoinEntry) \ |
| 1542 M(TargetEntry) \ | 1549 M(TargetEntry) \ |
| 1543 M(Do) \ | 1550 M(Do) \ |
| 1544 M(Bind) \ | 1551 M(Bind) \ |
| 1552 M(Phi) \ | |
| 1545 M(Return) \ | 1553 M(Return) \ |
| 1546 M(Throw) \ | 1554 M(Throw) \ |
| 1547 M(ReThrow) \ | 1555 M(ReThrow) \ |
| 1548 M(Branch) \ | 1556 M(Branch) \ |
| 1549 | 1557 |
| 1550 | 1558 |
| 1551 // Forward declarations for Instruction classes. | 1559 // Forward declarations for Instruction classes. |
| 1552 class BlockEntryInstr; | 1560 class BlockEntryInstr; |
| 1553 class FlowGraphBuilder; | 1561 class FlowGraphBuilder; |
| 1554 | 1562 |
| 1555 #define FORWARD_DECLARATION(type) class type##Instr; | 1563 #define FORWARD_DECLARATION(type) class type##Instr; |
| 1556 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 1564 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 1557 #undef FORWARD_DECLARATION | 1565 #undef FORWARD_DECLARATION |
| 1558 | 1566 |
| 1559 | 1567 |
| 1560 // Functions required in all concrete instruction classes. | 1568 // Functions required in all concrete instruction classes. |
| 1561 #define DECLARE_INSTRUCTION(type) \ | 1569 #define DECLARE_INSTRUCTION(type) \ |
| 1562 virtual Instruction* Accept(FlowGraphVisitor* visitor); \ | 1570 virtual Instruction* Accept(FlowGraphVisitor* visitor); \ |
| 1563 virtual bool Is##type() const { return true; } \ | 1571 virtual bool Is##type() const { return true; } \ |
| 1564 virtual type##Instr* As##type() { return this; } \ | 1572 virtual type##Instr* As##type() { return this; } \ |
| 1565 virtual intptr_t InputCount() const; \ | 1573 virtual intptr_t InputCount() const; \ |
| 1574 virtual Value* InputAt(intptr_t i) const; \ | |
| 1566 virtual const char* DebugName() const { return #type; } \ | 1575 virtual const char* DebugName() const { return #type; } \ |
| 1567 virtual void PrintTo(BufferFormatter* f) const; \ | 1576 virtual void PrintTo(BufferFormatter* f) const; \ |
| 1568 virtual void PrintToVisualizer(BufferFormatter* f) const; | 1577 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 1569 | 1578 |
| 1570 | 1579 |
| 1571 class Instruction : public ZoneAllocated { | 1580 class Instruction : public ZoneAllocated { |
| 1572 public: | 1581 public: |
| 1573 Instruction() : cid_(-1), ic_data_(NULL) { | 1582 Instruction() : cid_(-1), ic_data_(NULL) { |
| 1574 Isolate* isolate = Isolate::Current(); | 1583 Isolate* isolate = Isolate::Current(); |
| 1575 cid_ = Computation::GetNextCid(isolate); | 1584 cid_ = Computation::GetNextCid(isolate); |
| 1576 ic_data_ = Computation::GetICDataForCid(cid_, isolate); | 1585 ic_data_ = Computation::GetICDataForCid(cid_, isolate); |
| 1577 } | 1586 } |
| 1578 | 1587 |
| 1579 // Unique computation/instruction id, used for deoptimization, e.g. for | 1588 // Unique computation/instruction id, used for deoptimization, e.g. for |
| 1580 // ReturnInstr, ThrowInstr and ReThrowInstr. | 1589 // ReturnInstr, ThrowInstr and ReThrowInstr. |
| 1581 intptr_t cid() const { return cid_; } | 1590 intptr_t cid() const { return cid_; } |
| 1582 | 1591 |
| 1583 const ICData* ic_data() const { return ic_data_; } | 1592 const ICData* ic_data() const { return ic_data_; } |
| 1584 | 1593 |
| 1585 virtual bool IsBlockEntry() const { return false; } | 1594 virtual bool IsBlockEntry() const { return false; } |
| 1586 BlockEntryInstr* AsBlockEntry() { | 1595 BlockEntryInstr* AsBlockEntry() { |
| 1587 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; | 1596 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; |
| 1588 } | 1597 } |
| 1589 virtual bool IsBindInstr() const { return false; } | 1598 virtual bool IsDefinition() const { return false; } |
| 1590 virtual BindInstr* AsBindInstr() { | 1599 virtual Definition* AsDefinition() { return NULL; } |
| 1591 return NULL; | |
| 1592 } | |
| 1593 | 1600 |
| 1594 virtual intptr_t InputCount() const = 0; | 1601 virtual intptr_t InputCount() const = 0; |
| 1602 virtual Value* InputAt(intptr_t i) const = 0; | |
| 1595 | 1603 |
| 1596 // Visiting support. | 1604 // Visiting support. |
| 1597 virtual Instruction* Accept(FlowGraphVisitor* visitor) = 0; | 1605 virtual Instruction* Accept(FlowGraphVisitor* visitor) = 0; |
| 1598 | 1606 |
| 1599 virtual Instruction* StraightLineSuccessor() const = 0; | 1607 virtual Instruction* StraightLineSuccessor() const = 0; |
| 1600 virtual void SetSuccessor(Instruction* instr) = 0; | 1608 virtual void SetSuccessor(Instruction* instr) = 0; |
| 1601 | 1609 |
| 1602 // Normal instructions can have 0 (inside a block) or 1 (last instruction in | 1610 // Normal instructions can have 0 (inside a block) or 1 (last instruction in |
| 1603 // a block) successors. Branch instruction with >1 successors override this | 1611 // a block) successors. Branch instruction with >1 successors override this |
| 1604 // function. | 1612 // function. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1711 | 1719 |
| 1712 intptr_t postorder_number() const { return postorder_number_; } | 1720 intptr_t postorder_number() const { return postorder_number_; } |
| 1713 void set_postorder_number(intptr_t number) { postorder_number_ = number; } | 1721 void set_postorder_number(intptr_t number) { postorder_number_ = number; } |
| 1714 | 1722 |
| 1715 intptr_t block_id() const { return block_id_; } | 1723 intptr_t block_id() const { return block_id_; } |
| 1716 void set_block_id(intptr_t value) { block_id_ = value; } | 1724 void set_block_id(intptr_t value) { block_id_ = value; } |
| 1717 | 1725 |
| 1718 BlockEntryInstr* dominator() const { return dominator_; } | 1726 BlockEntryInstr* dominator() const { return dominator_; } |
| 1719 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; } | 1727 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; } |
| 1720 | 1728 |
| 1729 // TODO(fschneider): Optimize the case of one child to save space. | |
| 1730 GrowableArray<BlockEntryInstr*>* dominated_blocks() { | |
| 1731 return &dominated_blocks_; | |
| 1732 } | |
|
srdjan
2012/06/12 17:34:37
Instead of returning a modifieable array, better a
Florian Schneider
2012/06/13 10:53:40
Done.
| |
| 1733 | |
| 1721 Instruction* last_instruction() const { return last_instruction_; } | 1734 Instruction* last_instruction() const { return last_instruction_; } |
| 1722 void set_last_instruction(Instruction* instr) { last_instruction_ = instr; } | 1735 void set_last_instruction(Instruction* instr) { last_instruction_ = instr; } |
| 1723 | 1736 |
| 1724 virtual void DiscoverBlocks( | 1737 virtual void DiscoverBlocks( |
| 1725 BlockEntryInstr* current_block, | 1738 BlockEntryInstr* current_block, |
| 1726 GrowableArray<BlockEntryInstr*>* preorder, | 1739 GrowableArray<BlockEntryInstr*>* preorder, |
| 1727 GrowableArray<BlockEntryInstr*>* postorder, | 1740 GrowableArray<BlockEntryInstr*>* postorder, |
| 1728 GrowableArray<intptr_t>* parent, | 1741 GrowableArray<intptr_t>* parent, |
| 1729 GrowableArray<BitVector*>* assigned_vars, | 1742 GrowableArray<BitVector*>* assigned_vars, |
| 1730 intptr_t variable_count); | 1743 intptr_t variable_count); |
| 1731 | 1744 |
| 1732 protected: | 1745 protected: |
| 1733 BlockEntryInstr() | 1746 BlockEntryInstr() |
| 1734 : preorder_number_(-1), | 1747 : preorder_number_(-1), |
| 1735 postorder_number_(-1), | 1748 postorder_number_(-1), |
| 1736 block_id_(-1), | 1749 block_id_(-1), |
| 1737 dominator_(NULL), | 1750 dominator_(NULL), |
| 1751 dominated_blocks_(1), | |
| 1738 last_instruction_(NULL) { } | 1752 last_instruction_(NULL) { } |
| 1739 | 1753 |
| 1740 private: | 1754 private: |
| 1741 intptr_t preorder_number_; | 1755 intptr_t preorder_number_; |
| 1742 intptr_t postorder_number_; | 1756 intptr_t postorder_number_; |
| 1743 intptr_t block_id_; | 1757 intptr_t block_id_; |
| 1744 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. | 1758 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. |
| 1759 GrowableArray<BlockEntryInstr*> dominated_blocks_; | |
| 1745 Instruction* last_instruction_; | 1760 Instruction* last_instruction_; |
| 1746 | 1761 |
| 1747 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); | 1762 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); |
| 1748 }; | 1763 }; |
| 1749 | 1764 |
| 1750 | 1765 |
| 1751 class GraphEntryInstr : public BlockEntryInstr { | 1766 class GraphEntryInstr : public BlockEntryInstr { |
| 1752 public: | 1767 public: |
| 1753 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) | 1768 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) |
| 1754 : BlockEntryInstr(), normal_entry_(normal_entry), catch_entries_() { } | 1769 : BlockEntryInstr(), normal_entry_(normal_entry), catch_entries_() { } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1786 | 1801 |
| 1787 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); | 1802 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); |
| 1788 }; | 1803 }; |
| 1789 | 1804 |
| 1790 | 1805 |
| 1791 class JoinEntryInstr : public BlockEntryInstr { | 1806 class JoinEntryInstr : public BlockEntryInstr { |
| 1792 public: | 1807 public: |
| 1793 JoinEntryInstr() | 1808 JoinEntryInstr() |
| 1794 : BlockEntryInstr(), | 1809 : BlockEntryInstr(), |
| 1795 predecessors_(2), // Two is the assumed to be the common case. | 1810 predecessors_(2), // Two is the assumed to be the common case. |
| 1796 successor_(NULL) { } | 1811 successor_(NULL), |
| 1812 phis_(NULL), | |
| 1813 phi_count_(0) { } | |
| 1797 | 1814 |
| 1798 DECLARE_INSTRUCTION(JoinEntry) | 1815 DECLARE_INSTRUCTION(JoinEntry) |
| 1799 | 1816 |
| 1800 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } | 1817 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } |
| 1801 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 1818 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 1802 return predecessors_[index]; | 1819 return predecessors_[index]; |
| 1803 } | 1820 } |
| 1804 virtual void AddPredecessor(BlockEntryInstr* predecessor) { | 1821 virtual void AddPredecessor(BlockEntryInstr* predecessor) { |
| 1805 predecessors_.Add(predecessor); | 1822 predecessors_.Add(predecessor); |
| 1806 } | 1823 } |
| 1807 | 1824 |
| 1808 virtual Instruction* StraightLineSuccessor() const { | 1825 virtual Instruction* StraightLineSuccessor() const { |
| 1809 return successor_; | 1826 return successor_; |
| 1810 } | 1827 } |
| 1811 virtual void SetSuccessor(Instruction* instr) { | 1828 virtual void SetSuccessor(Instruction* instr) { |
| 1812 ASSERT(successor_ == NULL); | 1829 ASSERT(successor_ == NULL); |
| 1813 successor_ = instr; | 1830 successor_ = instr; |
| 1814 } | 1831 } |
| 1815 | 1832 |
| 1833 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } | |
|
srdjan
2012/06/12 17:34:37
const ZoneGrowableArray<...>& ?
Florian Schneider
2012/06/13 10:53:40
phis_ can be NULL.
| |
| 1834 | |
| 1816 virtual void PrepareEntry(FlowGraphCompiler* compiler); | 1835 virtual void PrepareEntry(FlowGraphCompiler* compiler); |
| 1817 | 1836 |
| 1837 void InsertPhi(intptr_t var_index, intptr_t var_count); | |
|
srdjan
2012/06/12 17:34:37
Get rid of var_count, it is used only to allocate
Florian Schneider
2012/06/13 10:53:40
Growable arrays incur a high cost when not used wi
srdjan
2012/06/13 18:45:26
Yes, but the 'var_count' looks weird in the API, a
| |
| 1838 | |
| 1839 intptr_t phi_count() const { return phi_count_; } | |
| 1840 | |
| 1818 private: | 1841 private: |
| 1819 ZoneGrowableArray<BlockEntryInstr*> predecessors_; | 1842 ZoneGrowableArray<BlockEntryInstr*> predecessors_; |
| 1820 Instruction* successor_; | 1843 Instruction* successor_; |
| 1844 ZoneGrowableArray<PhiInstr*>* phis_; | |
| 1845 intptr_t phi_count_; | |
| 1821 | 1846 |
| 1822 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 1847 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
| 1823 }; | 1848 }; |
| 1824 | 1849 |
| 1825 | 1850 |
| 1826 class TargetEntryInstr : public BlockEntryInstr { | 1851 class TargetEntryInstr : public BlockEntryInstr { |
| 1827 public: | 1852 public: |
| 1828 TargetEntryInstr() | 1853 TargetEntryInstr() |
| 1829 : BlockEntryInstr(), | 1854 : BlockEntryInstr(), |
| 1830 predecessor_(NULL), | 1855 predecessor_(NULL), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1913 } | 1938 } |
| 1914 | 1939 |
| 1915 private: | 1940 private: |
| 1916 Computation* computation_; | 1941 Computation* computation_; |
| 1917 Instruction* successor_; | 1942 Instruction* successor_; |
| 1918 | 1943 |
| 1919 DISALLOW_COPY_AND_ASSIGN(DoInstr); | 1944 DISALLOW_COPY_AND_ASSIGN(DoInstr); |
| 1920 }; | 1945 }; |
| 1921 | 1946 |
| 1922 | 1947 |
| 1923 class BindInstr : public Instruction { | 1948 class Definition : public Instruction { |
| 1949 public: | |
| 1950 Definition() : temp_index_(-1) { } | |
| 1951 | |
| 1952 virtual bool IsDefinition() const { return true; } | |
| 1953 virtual Definition* AsDefinition() { return this; } | |
| 1954 | |
| 1955 intptr_t temp_index() const { return temp_index_; } | |
| 1956 void set_temp_index(intptr_t index) { temp_index_ = index; } | |
|
srdjan
2012/06/12 17:34:37
Add a comment to something like that this is the c
Florian Schneider
2012/06/13 10:53:40
Done.
| |
| 1957 | |
| 1958 private: | |
| 1959 intptr_t temp_index_; | |
| 1960 | |
| 1961 DISALLOW_COPY_AND_ASSIGN(Definition); | |
| 1962 }; | |
| 1963 | |
| 1964 | |
| 1965 class BindInstr : public Definition { | |
| 1924 public: | 1966 public: |
| 1925 explicit BindInstr(Computation* computation) | 1967 explicit BindInstr(Computation* computation) |
| 1926 : temp_index_(-1), computation_(computation), successor_(NULL) { | 1968 : computation_(computation), successor_(NULL) { |
| 1927 ASSERT(computation != NULL); | 1969 ASSERT(computation != NULL); |
| 1928 computation->set_instr(this); | 1970 computation->set_instr(this); |
| 1929 } | 1971 } |
| 1930 | 1972 |
| 1931 DECLARE_INSTRUCTION(Bind) | 1973 DECLARE_INSTRUCTION(Bind) |
| 1932 | 1974 |
| 1933 virtual bool IsBindInstr() const { return true; } | |
| 1934 virtual BindInstr* AsBindInstr() { return this; } | |
| 1935 | |
| 1936 intptr_t temp_index() const { return temp_index_; } | |
| 1937 void set_temp_index(intptr_t index) { temp_index_ = index; } | |
| 1938 | |
| 1939 Computation* computation() const { return computation_; } | 1975 Computation* computation() const { return computation_; } |
| 1940 virtual void replace_computation(Computation* value) { computation_ = value; } | 1976 virtual void replace_computation(Computation* value) { computation_ = value; } |
| 1941 | 1977 |
| 1942 virtual Instruction* StraightLineSuccessor() const { | 1978 virtual Instruction* StraightLineSuccessor() const { |
| 1943 return successor_; | 1979 return successor_; |
| 1944 } | 1980 } |
| 1945 | 1981 |
| 1946 virtual void SetSuccessor(Instruction* instr) { | 1982 virtual void SetSuccessor(Instruction* instr) { |
| 1947 ASSERT(successor_ == NULL); | 1983 ASSERT(successor_ == NULL); |
| 1948 successor_ = instr; | 1984 successor_ = instr; |
| 1949 } | 1985 } |
| 1950 | 1986 |
| 1951 // Static type of the underlying computation. | 1987 // Static type of the underlying computation. |
| 1952 virtual RawAbstractType* StaticType() const { | 1988 virtual RawAbstractType* StaticType() const { |
| 1953 return computation()->StaticType(); | 1989 return computation()->StaticType(); |
| 1954 } | 1990 } |
| 1955 | 1991 |
| 1956 virtual void RecordAssignedVars(BitVector* assigned_vars); | 1992 virtual void RecordAssignedVars(BitVector* assigned_vars); |
| 1957 | 1993 |
| 1958 virtual LocationSummary* locs() { | 1994 virtual LocationSummary* locs() { |
| 1959 return computation()->locs(); | 1995 return computation()->locs(); |
| 1960 } | 1996 } |
| 1961 | 1997 |
| 1962 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 1998 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 1963 | 1999 |
| 1964 private: | 2000 private: |
| 1965 intptr_t temp_index_; | |
| 1966 Computation* computation_; | 2001 Computation* computation_; |
| 1967 Instruction* successor_; | 2002 Instruction* successor_; |
| 1968 | 2003 |
| 1969 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 2004 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
| 1970 }; | 2005 }; |
| 1971 | 2006 |
| 1972 | 2007 |
| 2008 class PhiInstr: public Definition { | |
| 2009 public: | |
| 2010 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { | |
| 2011 for (intptr_t i = 0; i < num_inputs; ++i) { | |
| 2012 inputs_.Add(NULL); | |
| 2013 } | |
| 2014 } | |
| 2015 | |
| 2016 DECLARE_INSTRUCTION(Phi) | |
| 2017 | |
| 2018 void SetInputAt(intptr_t i, Value* value) { | |
| 2019 inputs_[i] = value; | |
| 2020 } | |
| 2021 | |
| 2022 virtual Instruction* StraightLineSuccessor() const { return NULL; } | |
| 2023 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | |
| 2024 | |
| 2025 private: | |
| 2026 GrowableArray<Value*> inputs_; | |
| 2027 | |
| 2028 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | |
| 2029 }; | |
| 2030 | |
| 2031 | |
| 2032 | |
| 2033 | |
| 1973 class ReturnInstr : public InstructionWithInputs { | 2034 class ReturnInstr : public InstructionWithInputs { |
| 1974 public: | 2035 public: |
| 1975 ReturnInstr(intptr_t token_index, Value* value) | 2036 ReturnInstr(intptr_t token_index, Value* value) |
| 1976 : InstructionWithInputs(), token_index_(token_index), value_(value) { | 2037 : InstructionWithInputs(), token_index_(token_index), value_(value) { |
| 1977 ASSERT(value_ != NULL); | 2038 ASSERT(value_ != NULL); |
| 1978 } | 2039 } |
| 1979 | 2040 |
| 1980 DECLARE_INSTRUCTION(Return) | 2041 DECLARE_INSTRUCTION(Return) |
| 1981 | 2042 |
| 1982 Value* value() const { return value_; } | 2043 Value* value() const { return value_; } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2160 const GrowableArray<BlockEntryInstr*>& block_order_; | 2221 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2161 | 2222 |
| 2162 private: | 2223 private: |
| 2163 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2224 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2164 }; | 2225 }; |
| 2165 | 2226 |
| 2166 | 2227 |
| 2167 } // namespace dart | 2228 } // namespace dart |
| 2168 | 2229 |
| 2169 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2230 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |