OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_SCHEDULE_H_ | 5 #ifndef V8_COMPILER_SCHEDULE_H_ |
6 #define V8_COMPILER_SCHEDULE_H_ | 6 #define V8_COMPILER_SCHEDULE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
16 // Forward declarations. | 16 // Forward declarations. |
17 class BasicBlock; | 17 class BasicBlock; |
18 class BasicBlockInstrumentor; | 18 class BasicBlockInstrumentor; |
19 class Node; | 19 class Node; |
20 | 20 |
21 | 21 |
22 typedef ZoneVector<BasicBlock*> BasicBlockVector; | 22 typedef ZoneVector<BasicBlock*> BasicBlockVector; |
23 typedef ZoneVector<Node*> NodeVector; | 23 typedef ZoneVector<Node*> NodeVector; |
24 | 24 |
25 | 25 |
26 // A basic block contains an ordered list of nodes and ends with a control | 26 // A basic block contains an ordered list of nodes and ends with a control |
27 // node. Note that if a basic block has phis, then all phis must appear as the | 27 // node. Note that if a basic block has phis, then all phis must appear as the |
28 // first nodes in the block. | 28 // first nodes in the block. |
29 class BasicBlock FINAL : public ZoneObject { | 29 class BasicBlock final : public ZoneObject { |
30 public: | 30 public: |
31 // Possible control nodes that can end a block. | 31 // Possible control nodes that can end a block. |
32 enum Control { | 32 enum Control { |
33 kNone, // Control not initialized yet. | 33 kNone, // Control not initialized yet. |
34 kGoto, // Goto a single successor block. | 34 kGoto, // Goto a single successor block. |
35 kCall, // Call with continuation as first successor, exception | 35 kCall, // Call with continuation as first successor, exception |
36 // second. | 36 // second. |
37 kBranch, // Branch if true to first successor, otherwise second. | 37 kBranch, // Branch if true to first successor, otherwise second. |
38 kSwitch, // Table dispatch to one of the successor blocks. | 38 kSwitch, // Table dispatch to one of the successor blocks. |
39 kDeoptimize, // Return a value from this method. | 39 kDeoptimize, // Return a value from this method. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 }; | 169 }; |
170 | 170 |
171 std::ostream& operator<<(std::ostream&, const BasicBlock::Control&); | 171 std::ostream& operator<<(std::ostream&, const BasicBlock::Control&); |
172 std::ostream& operator<<(std::ostream&, const BasicBlock::Id&); | 172 std::ostream& operator<<(std::ostream&, const BasicBlock::Id&); |
173 | 173 |
174 | 174 |
175 // A schedule represents the result of assigning nodes to basic blocks | 175 // A schedule represents the result of assigning nodes to basic blocks |
176 // and ordering them within basic blocks. Prior to computing a schedule, | 176 // and ordering them within basic blocks. Prior to computing a schedule, |
177 // a graph has no notion of control flow ordering other than that induced | 177 // a graph has no notion of control flow ordering other than that induced |
178 // by the graph's dependencies. A schedule is required to generate code. | 178 // by the graph's dependencies. A schedule is required to generate code. |
179 class Schedule FINAL : public ZoneObject { | 179 class Schedule final : public ZoneObject { |
180 public: | 180 public: |
181 explicit Schedule(Zone* zone, size_t node_count_hint = 0); | 181 explicit Schedule(Zone* zone, size_t node_count_hint = 0); |
182 | 182 |
183 // Return the block which contains {node}, if any. | 183 // Return the block which contains {node}, if any. |
184 BasicBlock* block(Node* node) const; | 184 BasicBlock* block(Node* node) const; |
185 | 185 |
186 bool IsScheduled(Node* node); | 186 bool IsScheduled(Node* node); |
187 BasicBlock* GetBlockById(BasicBlock::Id block_id); | 187 BasicBlock* GetBlockById(BasicBlock::Id block_id); |
188 | 188 |
189 size_t BasicBlockCount() const { return all_blocks_.size(); } | 189 size_t BasicBlockCount() const { return all_blocks_.size(); } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 DISALLOW_COPY_AND_ASSIGN(Schedule); | 267 DISALLOW_COPY_AND_ASSIGN(Schedule); |
268 }; | 268 }; |
269 | 269 |
270 std::ostream& operator<<(std::ostream&, const Schedule&); | 270 std::ostream& operator<<(std::ostream&, const Schedule&); |
271 | 271 |
272 } // namespace compiler | 272 } // namespace compiler |
273 } // namespace internal | 273 } // namespace internal |
274 } // namespace v8 | 274 } // namespace v8 |
275 | 275 |
276 #endif // V8_COMPILER_SCHEDULE_H_ | 276 #endif // V8_COMPILER_SCHEDULE_H_ |
OLD | NEW |