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

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

Issue 10808008: Revert "Introduce Goto instructions to the flow graph." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/il_printer.cc ('k') | runtime/vm/intermediate_language.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 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 1681
1682 // Instructions. 1682 // Instructions.
1683 1683
1684 // M is a single argument macro. It is applied to each concrete instruction 1684 // M is a single argument macro. It is applied to each concrete instruction
1685 // type name. The concrete instruction classes are the name with Instr 1685 // type name. The concrete instruction classes are the name with Instr
1686 // concatenated. 1686 // concatenated.
1687 #define FOR_EACH_INSTRUCTION(M) \ 1687 #define FOR_EACH_INSTRUCTION(M) \
1688 M(GraphEntry) \ 1688 M(GraphEntry) \
1689 M(JoinEntry) \ 1689 M(JoinEntry) \
1690 M(TargetEntry) \ 1690 M(TargetEntry) \
1691 M(Bind) \
1691 M(Phi) \ 1692 M(Phi) \
1692 M(Bind) \
1693 M(Parameter) \
1694 M(ParallelMove) \
1695 M(Return) \ 1693 M(Return) \
1696 M(Throw) \ 1694 M(Throw) \
1697 M(ReThrow) \ 1695 M(ReThrow) \
1698 M(Goto) \
1699 M(Branch) \ 1696 M(Branch) \
1697 M(ParallelMove) \
1698 M(Parameter)
1700 1699
1701 1700
1702 // Forward declarations for Instruction classes. 1701 // Forward declarations for Instruction classes.
1703 class BlockEntryInstr; 1702 class BlockEntryInstr;
1704 class FlowGraphBuilder; 1703 class FlowGraphBuilder;
1705 class Environment; 1704 class Environment;
1706 1705
1707 #define FORWARD_DECLARATION(type) class type##Instr; 1706 #define FORWARD_DECLARATION(type) class type##Instr;
1708 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 1707 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
1709 #undef FORWARD_DECLARATION 1708 #undef FORWARD_DECLARATION
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 ASSERT(!IsBlockEntry()); 1760 ASSERT(!IsBlockEntry());
1762 previous_ = instr; 1761 previous_ = instr;
1763 } 1762 }
1764 1763
1765 Instruction* next() const { return next_; } 1764 Instruction* next() const { return next_; }
1766 void set_next(Instruction* instr) { 1765 void set_next(Instruction* instr) {
1767 ASSERT(!IsGraphEntry()); 1766 ASSERT(!IsGraphEntry());
1768 ASSERT(!IsReturn()); 1767 ASSERT(!IsReturn());
1769 ASSERT(!IsBranch()); 1768 ASSERT(!IsBranch());
1770 ASSERT(!IsPhi()); 1769 ASSERT(!IsPhi());
1771 ASSERT(instr == NULL || !instr->IsBlockEntry());
1772 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions 1770 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions
1773 // that do not have a successor. Currently, the graph builder will continue 1771 // that do not have a successor. Currently, the graph builder will continue
1774 // to append instruction in case of a Throw inside an expression. This 1772 // to append instruction in case of a Throw inside an expression. This
1775 // condition should be handled in the graph builder 1773 // condition should be handled in the graph builder
1776 next_ = instr; 1774 next_ = instr;
1777 } 1775 }
1778 1776
1779 // Normal instructions can have 0 (inside a block) or 1 (last instruction in 1777 // Normal instructions can have 0 (inside a block) or 1 (last instruction in
1780 // a block) successors. Branch instruction with >1 successors override this 1778 // a block) successors. Branch instruction with >1 successors override this
1781 // function. 1779 // function.
1782 virtual intptr_t SuccessorCount() const; 1780 virtual intptr_t SuccessorCount() const;
1783 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 1781 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
1784 1782
1785 void Goto(JoinEntryInstr* entry);
1786
1787 // Discover basic-block structure by performing a recursive depth first 1783 // Discover basic-block structure by performing a recursive depth first
1788 // traversal of the instruction graph reachable from this instruction. As 1784 // traversal of the instruction graph reachable from this instruction. As
1789 // a side effect, the block entry instructions in the graph are assigned 1785 // a side effect, the block entry instructions in the graph are assigned
1790 // numbers in both preorder and postorder. The array 'preorder' maps 1786 // numbers in both preorder and postorder. The array 'preorder' maps
1791 // preorder block numbers to the block entry instruction with that number 1787 // preorder block numbers to the block entry instruction with that number
1792 // and analogously for the array 'postorder'. The depth first spanning 1788 // and analogously for the array 'postorder'. The depth first spanning
1793 // tree is recorded in the array 'parent', which maps preorder block 1789 // tree is recorded in the array 'parent', which maps preorder block
1794 // numbers to the preorder number of the block's spanning-tree parent. 1790 // numbers to the preorder number of the block's spanning-tree parent.
1795 // The array 'assigned_vars' maps preorder block numbers to the set of 1791 // The array 'assigned_vars' maps preorder block numbers to the set of
1796 // assigned frame-allocated local variables in the block. As a side 1792 // assigned frame-allocated local variables in the block. As a side
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 ICData* ic_data_; 1851 ICData* ic_data_;
1856 Instruction* previous_; 1852 Instruction* previous_;
1857 Instruction* next_; 1853 Instruction* next_;
1858 Environment* env_; 1854 Environment* env_;
1859 DISALLOW_COPY_AND_ASSIGN(Instruction); 1855 DISALLOW_COPY_AND_ASSIGN(Instruction);
1860 }; 1856 };
1861 1857
1862 1858
1863 class InstructionWithInputs : public Instruction { 1859 class InstructionWithInputs : public Instruction {
1864 public: 1860 public:
1865 InstructionWithInputs() : locs_(NULL) { } 1861 InstructionWithInputs() : locs_(NULL) {
1862 }
1866 1863
1867 virtual LocationSummary* locs() { 1864 virtual LocationSummary* locs() {
1868 if (locs_ == NULL) { 1865 if (locs_ == NULL) {
1869 locs_ = MakeLocationSummary(); 1866 locs_ = MakeLocationSummary();
1870 } 1867 }
1871 return locs_; 1868 return locs_;
1872 } 1869 }
1873 1870
1874 virtual LocationSummary* MakeLocationSummary() const = 0; 1871 virtual LocationSummary* MakeLocationSummary() const = 0;
1875 1872
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 private: 2285 private:
2289 const intptr_t token_pos_; 2286 const intptr_t token_pos_;
2290 const intptr_t try_index_; 2287 const intptr_t try_index_;
2291 Value* exception_; 2288 Value* exception_;
2292 Value* stack_trace_; 2289 Value* stack_trace_;
2293 2290
2294 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 2291 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
2295 }; 2292 };
2296 2293
2297 2294
2298 class GotoInstr : public InstructionWithInputs {
2299 public:
2300 explicit GotoInstr(JoinEntryInstr* entry) : successor_(entry) { }
2301
2302 DECLARE_INSTRUCTION(Goto)
2303
2304 JoinEntryInstr* successor() const { return successor_; }
2305 void set_successor(JoinEntryInstr* successor) { successor_ = successor; }
2306 virtual intptr_t SuccessorCount() const;
2307 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
2308
2309 virtual LocationSummary* MakeLocationSummary() const;
2310
2311 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2312
2313 private:
2314 JoinEntryInstr* successor_;
2315 };
2316
2317
2318 class BranchInstr : public InstructionWithInputs { 2295 class BranchInstr : public InstructionWithInputs {
2319 public: 2296 public:
2320 explicit BranchInstr(Value* value) 2297 explicit BranchInstr(Value* value)
2321 : InstructionWithInputs(), 2298 : InstructionWithInputs(),
2322 value_(value), 2299 value_(value),
2323 true_successor_(NULL), 2300 true_successor_(NULL),
2324 false_successor_(NULL), 2301 false_successor_(NULL),
2325 fused_with_comparison_(NULL), 2302 fused_with_comparison_(NULL),
2326 is_negated_(false) { } 2303 is_negated_(false) { }
2327 2304
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 const GrowableArray<BlockEntryInstr*>& block_order_; 2490 const GrowableArray<BlockEntryInstr*>& block_order_;
2514 2491
2515 private: 2492 private:
2516 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2493 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2517 }; 2494 };
2518 2495
2519 2496
2520 } // namespace dart 2497 } // namespace dart
2521 2498
2522 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2499 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698