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 <functional> | 5 #include <functional> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 void GraphReducer::Replace(Node* node, Node* replacement) { | 165 void GraphReducer::Replace(Node* node, Node* replacement) { |
166 Replace(node, replacement, std::numeric_limits<NodeId>::max()); | 166 Replace(node, replacement, std::numeric_limits<NodeId>::max()); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 void GraphReducer::Replace(Node* node, Node* replacement, NodeId max_id) { | 170 void GraphReducer::Replace(Node* node, Node* replacement, NodeId max_id) { |
171 if (FLAG_trace_turbo_reduction) { | |
Benedikt Meurer
2016/07/09 17:45:23
Can you use the streams instead? I.e. sth along th
| |
172 PrintF("- Replacing "); | |
173 node->Print(); | |
174 PrintF("+ with "); | |
175 replacement->Print(); | |
176 } | |
171 if (node == graph()->start()) graph()->SetStart(replacement); | 177 if (node == graph()->start()) graph()->SetStart(replacement); |
172 if (node == graph()->end()) graph()->SetEnd(replacement); | 178 if (node == graph()->end()) graph()->SetEnd(replacement); |
173 if (replacement->id() <= max_id) { | 179 if (replacement->id() <= max_id) { |
174 // {replacement} is an old node, so unlink {node} and assume that | 180 // {replacement} is an old node, so unlink {node} and assume that |
175 // {replacement} was already reduced and finish. | 181 // {replacement} was already reduced and finish. |
176 for (Edge edge : node->use_edges()) { | 182 for (Edge edge : node->use_edges()) { |
177 Node* const user = edge.from(); | 183 Node* const user = edge.from(); |
178 Verifier::VerifyEdgeInputReplacement(edge, replacement); | 184 Verifier::VerifyEdgeInputReplacement(edge, replacement); |
179 edge.UpdateTo(replacement); | 185 edge.UpdateTo(replacement); |
180 // Don't revisit this node if it refers to itself. | 186 // Don't revisit this node if it refers to itself. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 void GraphReducer::Revisit(Node* node) { | 271 void GraphReducer::Revisit(Node* node) { |
266 if (state_.Get(node) == State::kVisited) { | 272 if (state_.Get(node) == State::kVisited) { |
267 state_.Set(node, State::kRevisit); | 273 state_.Set(node, State::kRevisit); |
268 revisit_.push(node); | 274 revisit_.push(node); |
269 } | 275 } |
270 } | 276 } |
271 | 277 |
272 } // namespace compiler | 278 } // namespace compiler |
273 } // namespace internal | 279 } // namespace internal |
274 } // namespace v8 | 280 } // namespace v8 |
OLD | NEW |