#ifndef V8_COMPILER_ALL_NODES_H_
#define V8_COMPILER_ALL_NODES_H_
#include "src/compiler/node.h"
#include "src/utils/bit-vector.h"
namespace v8 {
namespace internal {
namespace compiler {
class AllNodes {
public:
AllNodes(Zone* local_zone, Node* end, const TFGraph* graph,
bool only_inputs = true);
AllNodes(Zone* local_zone, const TFGraph* graph, bool only_inputs = true);
bool IsLive(const Node* node) const {
CHECK(only_inputs_);
return IsReachable(node);
}
bool IsReachable(const Node* node) const {
if (!node) return false;
int id = node->id();
return id < is_reachable_.length() && is_reachable_.Contains(id);
}
NodeVector reachable;
private:
void Mark(Zone* local_zone, Node* end, const TFGraph* graph);
BitVector is_reachable_;
const bool only_inputs_;
};
}
}
}
#endif