Index: src/compiler/all-nodes.h |
diff --git a/src/compiler/all-nodes.h b/src/compiler/all-nodes.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2406d27c0b74991dec9f174baeaf44f03e7dddff |
--- /dev/null |
+++ b/src/compiler/all-nodes.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_COMPILER_ALL_NODES_H_ |
+#define V8_COMPILER_ALL_NODES_H_ |
+ |
+#include "src/compiler/graph.h" |
+#include "src/compiler/node.h" |
+#include "src/v8.h" |
+#include "src/zone-containers.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace compiler { |
+ |
+// A helper utility that traverses the graph and gathers all nodes reachable |
+// from end. |
+class AllNodes { |
Michael Starzinger
2015/01/26 17:16:56
I think this class should live in the graph.h file
|
+ public: |
+ // Constructor. Traverses the graph and builds the {live} and {gray} sets. |
+ AllNodes(Zone* local_zone, const Graph* graph); |
+ |
+ bool IsLive(Node* node) { |
+ return node != nullptr && node->id() < static_cast<int>(state.size()) && |
+ state[node->id()] == kLive; |
+ } |
+ |
+ NodeVector live; // Nodes reachable from end. |
+ NodeVector gray; // Nodes themselves not reachable from end, but that |
+ // appear in use lists of live nodes. |
+ |
+ private: |
+ enum State { kDead, kGray, kLive }; |
+ |
+ ZoneVector<State> state; |
+}; |
+} |
+} |
+} // namespace v8::internal::compiler |
+ |
+#endif // V8_COMPILER_ALL_NODES_H_ |