| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/node.h" | 5 #include "src/compiler/node.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 to->AppendUse(use); | 33 to->AppendUse(use); |
| 34 ++use; | 34 ++use; |
| 35 ++input; | 35 ++input; |
| 36 } | 36 } |
| 37 return result; | 37 return result; |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 void Node::Kill() { | 41 void Node::Kill() { |
| 42 DCHECK_NOT_NULL(op()); | 42 DCHECK_NOT_NULL(op()); |
| 43 RemoveAllInputs(); | 43 NullAllInputs(); |
| 44 DCHECK(uses().empty()); | 44 DCHECK(uses().empty()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 void Node::AppendInput(Zone* zone, Node* new_to) { | 48 void Node::AppendInput(Zone* zone, Node* new_to) { |
| 49 DCHECK_NOT_NULL(zone); | 49 DCHECK_NOT_NULL(zone); |
| 50 DCHECK_NOT_NULL(new_to); | 50 DCHECK_NOT_NULL(new_to); |
| 51 Use* new_use = new (zone) Use; | 51 Use* new_use = new (zone) Use; |
| 52 Input new_input; | 52 Input new_input; |
| 53 new_input.to = new_to; | 53 new_input.to = new_to; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 void Node::RemoveInput(int index) { | 82 void Node::RemoveInput(int index) { |
| 83 DCHECK_LE(0, index); | 83 DCHECK_LE(0, index); |
| 84 DCHECK_LT(index, InputCount()); | 84 DCHECK_LT(index, InputCount()); |
| 85 for (; index < InputCount() - 1; ++index) { | 85 for (; index < InputCount() - 1; ++index) { |
| 86 ReplaceInput(index, InputAt(index + 1)); | 86 ReplaceInput(index, InputAt(index + 1)); |
| 87 } | 87 } |
| 88 TrimInputCount(InputCount() - 1); | 88 TrimInputCount(InputCount() - 1); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 void Node::RemoveAllInputs() { | 92 void Node::NullAllInputs() { |
| 93 for (Edge edge : input_edges()) edge.UpdateTo(nullptr); | 93 for (Edge edge : input_edges()) edge.UpdateTo(nullptr); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 void Node::TrimInputCount(int new_input_count) { | 97 void Node::TrimInputCount(int new_input_count) { |
| 98 DCHECK_LE(new_input_count, input_count()); | 98 DCHECK_LE(new_input_count, input_count()); |
| 99 if (new_input_count == input_count()) return; // Nothing to do. | 99 if (new_input_count == input_count()) return; // Nothing to do. |
| 100 for (int index = new_input_count; index < input_count(); ++index) { | 100 for (int index = new_input_count; index < input_count(); ++index) { |
| 101 ReplaceInput(index, nullptr); | 101 ReplaceInput(index, nullptr); |
| 102 } | 102 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 ++(*this); | 253 ++(*this); |
| 254 return result; | 254 return result; |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 bool Node::Uses::empty() const { return begin() == end(); } | 258 bool Node::Uses::empty() const { return begin() == end(); } |
| 259 | 259 |
| 260 } // namespace compiler | 260 } // namespace compiler |
| 261 } // namespace internal | 261 } // namespace internal |
| 262 } // namespace v8 | 262 } // namespace v8 |
| OLD | NEW |