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.
5 #ifndef V8_COMPILER_ALL_NODES_H_
6 #define V8_COMPILER_ALL_NODES_H_
8 #include "src/compiler/graph.h"
9 #include "src/compiler/node.h"
10 #include "src/zone-containers.h"
16 // A helper utility that traverses the graph and gathers all nodes reachable
20 // Constructor. Traverses the graph and builds the {live} and {gray} sets.
21 AllNodes(Zone* local_zone, const Graph* graph);
23 bool IsLive(Node* node) {
24 return node != nullptr && node->id() < static_cast<int>(state.size()) &&
25 state[node->id()] == kLive;
28 NodeVector live; // Nodes reachable from end.
29 NodeVector gray; // Nodes themselves not reachable from end, but that
30 // appear in use lists of live nodes.
33 enum State { kDead, kGray, kLive };
35 ZoneVector<State> state;
39 } // namespace v8::internal::compiler
41 #endif // V8_COMPILER_ALL_NODES_H_