| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 // Requires distinguishing between value, effect and control edges. | 225 // Requires distinguishing between value, effect and control edges. |
| 226 for (Edge edge : node->use_edges()) { | 226 for (Edge edge : node->use_edges()) { |
| 227 Node* user = edge.from(); | 227 Node* user = edge.from(); |
| 228 if (NodeProperties::IsControlEdge(edge)) { | 228 if (NodeProperties::IsControlEdge(edge)) { |
| 229 if (user->opcode() == IrOpcode::kIfSuccess) { | 229 if (user->opcode() == IrOpcode::kIfSuccess) { |
| 230 Replace(user, control); | 230 Replace(user, control); |
| 231 } else if (user->opcode() == IrOpcode::kIfException) { | 231 } else if (user->opcode() == IrOpcode::kIfException) { |
| 232 for (Edge e : user->use_edges()) { | 232 for (Edge e : user->use_edges()) { |
| 233 if (NodeProperties::IsValueEdge(e)) e.UpdateTo(dead_value_); | 233 if (NodeProperties::IsValueEdge(e)) e.UpdateTo(dead_value_); |
| 234 if (NodeProperties::IsEffectEdge(e)) e.UpdateTo(graph()->start()); |
| 234 if (NodeProperties::IsControlEdge(e)) e.UpdateTo(dead_control_); | 235 if (NodeProperties::IsControlEdge(e)) e.UpdateTo(dead_control_); |
| 235 } | 236 } |
| 236 user->Kill(); | 237 edge.UpdateTo(user); |
| 237 } else { | 238 } else { |
| 238 UNREACHABLE(); | 239 UNREACHABLE(); |
| 239 } | 240 } |
| 240 } else if (NodeProperties::IsEffectEdge(edge)) { | 241 } else if (NodeProperties::IsEffectEdge(edge)) { |
| 241 DCHECK_NOT_NULL(effect); | 242 DCHECK_NOT_NULL(effect); |
| 242 edge.UpdateTo(effect); | 243 edge.UpdateTo(effect); |
| 243 Revisit(user); | 244 Revisit(user); |
| 244 } else { | 245 } else { |
| 246 DCHECK_NOT_NULL(value); |
| 245 edge.UpdateTo(value); | 247 edge.UpdateTo(value); |
| 246 Revisit(user); | 248 Revisit(user); |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 } | 251 } |
| 250 | 252 |
| 251 | 253 |
| 252 void GraphReducer::Pop() { | 254 void GraphReducer::Pop() { |
| 253 Node* node = stack_.top().node; | 255 Node* node = stack_.top().node; |
| 254 state_.Set(node, State::kVisited); | 256 state_.Set(node, State::kVisited); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 273 void GraphReducer::Revisit(Node* node) { | 275 void GraphReducer::Revisit(Node* node) { |
| 274 if (state_.Get(node) == State::kVisited) { | 276 if (state_.Get(node) == State::kVisited) { |
| 275 state_.Set(node, State::kRevisit); | 277 state_.Set(node, State::kRevisit); |
| 276 revisit_.push(node); | 278 revisit_.push(node); |
| 277 } | 279 } |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace compiler | 282 } // namespace compiler |
| 281 } // namespace internal | 283 } // namespace internal |
| 282 } // namespace v8 | 284 } // namespace v8 |
| OLD | NEW |