OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_ALL_NODES_H_ | |
6 #define V8_COMPILER_ALL_NODES_H_ | |
7 | |
8 #include "src/compiler/graph.h" | |
9 #include "src/compiler/node.h" | |
10 #include "src/v8.h" | |
11 #include "src/zone-containers.h" | |
12 | |
13 namespace v8 { | |
14 namespace internal { | |
15 namespace compiler { | |
16 | |
17 // A helper utility that traverses the graph and gathers all nodes reachable | |
18 // from end. | |
19 class AllNodes { | |
Michael Starzinger
2015/01/26 17:16:56
I think this class should live in the graph.h file
| |
20 public: | |
21 // Constructor. Traverses the graph and builds the {live} and {gray} sets. | |
22 AllNodes(Zone* local_zone, const Graph* graph); | |
23 | |
24 bool IsLive(Node* node) { | |
25 return node != nullptr && node->id() < static_cast<int>(state.size()) && | |
26 state[node->id()] == kLive; | |
27 } | |
28 | |
29 NodeVector live; // Nodes reachable from end. | |
30 NodeVector gray; // Nodes themselves not reachable from end, but that | |
31 // appear in use lists of live nodes. | |
32 | |
33 private: | |
34 enum State { kDead, kGray, kLive }; | |
35 | |
36 ZoneVector<State> state; | |
37 }; | |
38 } | |
39 } | |
40 } // namespace v8::internal::compiler | |
41 | |
42 #endif // V8_COMPILER_ALL_NODES_H_ | |
OLD | NEW |