| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/select-lowering.h" | 5 #include "src/compiler/select-lowering.h" |
| 6 | 6 |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/diamond.h" | 8 #include "src/compiler/diamond.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 node->ReplaceInput(0, vthen); | 55 node->ReplaceInput(0, vthen); |
| 56 node->ReplaceInput(1, velse); | 56 node->ReplaceInput(1, velse); |
| 57 node->ReplaceInput(2, merge); | 57 node->ReplaceInput(2, merge); |
| 58 return Changed(node); | 58 return Changed(node); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { | 62 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { |
| 63 // TODO(turbofan): This is probably horribly expensive, and it should be moved | 63 // TODO(turbofan): This is probably horribly expensive, and it should be moved |
| 64 // into node.h or somewhere else?! | 64 // into node.h or somewhere else?! |
| 65 Zone zone(graph()->zone()->isolate()); | 65 Zone zone; |
| 66 std::queue<Node*, NodeDeque> queue((NodeDeque(&zone))); | 66 std::queue<Node*, NodeDeque> queue((NodeDeque(&zone))); |
| 67 BoolVector visited(graph()->NodeCount(), false, &zone); | 67 BoolVector visited(graph()->NodeCount(), false, &zone); |
| 68 queue.push(source); | 68 queue.push(source); |
| 69 visited[source->id()] = true; | 69 visited[source->id()] = true; |
| 70 while (!queue.empty()) { | 70 while (!queue.empty()) { |
| 71 Node* current = queue.front(); | 71 Node* current = queue.front(); |
| 72 if (current == sink) return true; | 72 if (current == sink) return true; |
| 73 queue.pop(); | 73 queue.pop(); |
| 74 for (auto input : current->inputs()) { | 74 for (auto input : current->inputs()) { |
| 75 if (!visited[input->id()]) { | 75 if (!visited[input->id()]) { |
| 76 queue.push(input); | 76 queue.push(input); |
| 77 visited[input->id()] = true; | 77 visited[input->id()] = true; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace compiler | 84 } // namespace compiler |
| 85 } // namespace internal | 85 } // namespace internal |
| 86 } // namespace v8 | 86 } // namespace v8 |
| OLD | NEW |