1 // Copyright 2014 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 #include "src/compiler/all-nodes.h"
7 #include "src/compiler/graph.h"
13 AllNodes::AllNodes(Zone* local_zone, const Graph* graph)
14 : live(local_zone), is_live(graph->NodeCount(), false, local_zone) {
15 Node* end = graph->end();
16 is_live[end->id()] = true;
18 // Find all live nodes reachable from end.
19 for (size_t i = 0; i < live.size(); i++) {
20 for (Node* const input : live[i]->inputs()) {
21 if (input == nullptr) {
22 // TODO(titzer): print a warning.
25 if (input->id() >= graph->NodeCount()) {
26 // TODO(titzer): print a warning.
29 if (!is_live[input->id()]) {
30 is_live[input->id()] = true;
31 live.push_back(input);
37 } // namespace compiler
38 } // namespace internal