Merge V8 5.4.500.40
Test: Manual - built & ran d8
Change-Id: I4edfa2853d3e565b729723645395688ece3193f4
diff --git a/src/compiler/all-nodes.cc b/src/compiler/all-nodes.cc
index ed4a218..8040897 100644
--- a/src/compiler/all-nodes.cc
+++ b/src/compiler/all-nodes.cc
@@ -10,25 +10,33 @@
namespace internal {
namespace compiler {
-AllNodes::AllNodes(Zone* local_zone, const Graph* graph)
- : live(local_zone), is_live(graph->NodeCount(), false, local_zone) {
+AllNodes::AllNodes(Zone* local_zone, const Graph* graph, bool only_inputs)
+ : reachable(local_zone),
+ is_reachable_(graph->NodeCount(), false, local_zone),
+ only_inputs_(only_inputs) {
Node* end = graph->end();
- is_live[end->id()] = true;
- live.push_back(end);
- // Find all live nodes reachable from end.
- for (size_t i = 0; i < live.size(); i++) {
- for (Node* const input : live[i]->inputs()) {
- if (input == nullptr) {
- // TODO(titzer): print a warning.
+ is_reachable_[end->id()] = true;
+ reachable.push_back(end);
+ // Find all nodes reachable from end.
+ for (size_t i = 0; i < reachable.size(); i++) {
+ for (Node* input : reachable[i]->inputs()) {
+ if (input == nullptr || input->id() >= graph->NodeCount()) {
continue;
}
- if (input->id() >= graph->NodeCount()) {
- // TODO(titzer): print a warning.
- continue;
+ if (!is_reachable_[input->id()]) {
+ is_reachable_[input->id()] = true;
+ reachable.push_back(input);
}
- if (!is_live[input->id()]) {
- is_live[input->id()] = true;
- live.push_back(input);
+ }
+ if (!only_inputs) {
+ for (Node* use : reachable[i]->uses()) {
+ if (use == nullptr || use->id() >= graph->NodeCount()) {
+ continue;
+ }
+ if (!is_reachable_[use->id()]) {
+ is_reachable_[use->id()] = true;
+ reachable.push_back(use);
+ }
}
}
}