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" |
(...skipping 12 matching lines...) Expand all Loading... |
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 second. | 35 kCall, // Call with continuation as first successor, exception |
36 kBranch, // Branch if true to first successor, otherwise second. | 36 // second. |
37 kSwitch, // Table dispatch to one of the successor blocks. | 37 kBranch, // Branch if true to first successor, otherwise second. |
38 kReturn, // Return a value from this method. | 38 kSwitch, // Table dispatch to one of the successor blocks. |
39 kThrow // Throw an exception. | 39 kDeoptimize, // Return a value from this method. |
| 40 kReturn, // Return a value from this method. |
| 41 kThrow // Throw an exception. |
40 }; | 42 }; |
41 | 43 |
42 class Id { | 44 class Id { |
43 public: | 45 public: |
44 int ToInt() const { return static_cast<int>(index_); } | 46 int ToInt() const { return static_cast<int>(index_); } |
45 size_t ToSize() const { return index_; } | 47 size_t ToSize() const { return index_; } |
46 static Id FromSize(size_t index) { return Id(index); } | 48 static Id FromSize(size_t index) { return Id(index); } |
47 static Id FromInt(int index) { return Id(static_cast<size_t>(index)); } | 49 static Id FromInt(int index) { return Id(static_cast<size_t>(index)); } |
48 | 50 |
49 private: | 51 private: |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 BasicBlock* exception_block); | 210 BasicBlock* exception_block); |
209 | 211 |
210 // BasicBlock building: add a branch at the end of {block}. | 212 // BasicBlock building: add a branch at the end of {block}. |
211 void AddBranch(BasicBlock* block, Node* branch, BasicBlock* tblock, | 213 void AddBranch(BasicBlock* block, Node* branch, BasicBlock* tblock, |
212 BasicBlock* fblock); | 214 BasicBlock* fblock); |
213 | 215 |
214 // BasicBlock building: add a switch at the end of {block}. | 216 // BasicBlock building: add a switch at the end of {block}. |
215 void AddSwitch(BasicBlock* block, Node* sw, BasicBlock** succ_blocks, | 217 void AddSwitch(BasicBlock* block, Node* sw, BasicBlock** succ_blocks, |
216 size_t succ_count); | 218 size_t succ_count); |
217 | 219 |
| 220 // BasicBlock building: add a deoptimize at the end of {block}. |
| 221 void AddDeoptimize(BasicBlock* block, Node* input); |
| 222 |
218 // BasicBlock building: add a return at the end of {block}. | 223 // BasicBlock building: add a return at the end of {block}. |
219 void AddReturn(BasicBlock* block, Node* input); | 224 void AddReturn(BasicBlock* block, Node* input); |
220 | 225 |
221 // BasicBlock building: add a throw at the end of {block}. | 226 // BasicBlock building: add a throw at the end of {block}. |
222 void AddThrow(BasicBlock* block, Node* input); | 227 void AddThrow(BasicBlock* block, Node* input); |
223 | 228 |
224 // BasicBlock mutation: insert a branch into the end of {block}. | 229 // BasicBlock mutation: insert a branch into the end of {block}. |
225 void InsertBranch(BasicBlock* block, BasicBlock* end, Node* branch, | 230 void InsertBranch(BasicBlock* block, BasicBlock* end, Node* branch, |
226 BasicBlock* tblock, BasicBlock* fblock); | 231 BasicBlock* tblock, BasicBlock* fblock); |
227 | 232 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 DISALLOW_COPY_AND_ASSIGN(Schedule); | 267 DISALLOW_COPY_AND_ASSIGN(Schedule); |
263 }; | 268 }; |
264 | 269 |
265 std::ostream& operator<<(std::ostream&, const Schedule&); | 270 std::ostream& operator<<(std::ostream&, const Schedule&); |
266 | 271 |
267 } // namespace compiler | 272 } // namespace compiler |
268 } // namespace internal | 273 } // namespace internal |
269 } // namespace v8 | 274 } // namespace v8 |
270 | 275 |
271 #endif // V8_COMPILER_SCHEDULE_H_ | 276 #endif // V8_COMPILER_SCHEDULE_H_ |
OLD | NEW |