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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
103 if (!has_appendable_inputs()) { | 103 if (has_appendable_inputs()) { |
| 104 inputs_.appendable_->resize(new_input_count); |
| 105 } else { |
104 set_reserved_input_count(std::min<int>( | 106 set_reserved_input_count(std::min<int>( |
105 ReservedInputCountField::kMax, | 107 ReservedInputCountField::kMax, |
106 reserved_input_count() + (input_count() - new_input_count))); | 108 reserved_input_count() + (input_count() - new_input_count))); |
107 } | 109 } |
108 set_input_count(new_input_count); | 110 set_input_count(new_input_count); |
109 } | 111 } |
110 | 112 |
111 | 113 |
112 int Node::UseCount() const { | 114 int Node::UseCount() const { |
113 int use_count = 0; | 115 int use_count = 0; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 ++(*this); | 270 ++(*this); |
269 return result; | 271 return result; |
270 } | 272 } |
271 | 273 |
272 | 274 |
273 bool Node::Uses::empty() const { return begin() == end(); } | 275 bool Node::Uses::empty() const { return begin() == end(); } |
274 | 276 |
275 } // namespace compiler | 277 } // namespace compiler |
276 } // namespace internal | 278 } // namespace internal |
277 } // namespace v8 | 279 } // namespace v8 |
OLD | NEW |