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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 node->ReplaceInput(1, velse); | 56 node->ReplaceInput(1, velse); |
57 node->ReplaceInput(2, merge); | 57 node->ReplaceInput(2, merge); |
58 NodeProperties::ChangeOp(node, common()->Phi(p.representation(), 2)); | 58 NodeProperties::ChangeOp(node, common()->Phi(p.representation(), 2)); |
59 return Changed(node); | 59 return Changed(node); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { | 63 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { |
64 // TODO(turbofan): This is probably horribly expensive, and it should be moved | 64 // TODO(turbofan): This is probably horribly expensive, and it should be moved |
65 // into node.h or somewhere else?! | 65 // into node.h or somewhere else?! |
66 Zone zone; | 66 Zone zone(graph()->zone()->allocator()); |
67 std::queue<Node*, NodeDeque> queue((NodeDeque(&zone))); | 67 std::queue<Node*, NodeDeque> queue((NodeDeque(&zone))); |
68 BoolVector visited(graph()->NodeCount(), false, &zone); | 68 BoolVector visited(graph()->NodeCount(), false, &zone); |
69 queue.push(source); | 69 queue.push(source); |
70 visited[source->id()] = true; | 70 visited[source->id()] = true; |
71 while (!queue.empty()) { | 71 while (!queue.empty()) { |
72 Node* current = queue.front(); | 72 Node* current = queue.front(); |
73 if (current == sink) return true; | 73 if (current == sink) return true; |
74 queue.pop(); | 74 queue.pop(); |
75 for (auto input : current->inputs()) { | 75 for (auto input : current->inputs()) { |
76 if (!visited[input->id()]) { | 76 if (!visited[input->id()]) { |
77 queue.push(input); | 77 queue.push(input); |
78 visited[input->id()] = true; | 78 visited[input->id()] = true; |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
85 } // namespace compiler | 85 } // namespace compiler |
86 } // namespace internal | 86 } // namespace internal |
87 } // namespace v8 | 87 } // namespace v8 |
OLD | NEW |