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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/liveness-analyzer.h" | 7 #include "src/compiler/liveness-analyzer.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/state-values-utils.h" | 10 #include "src/compiler/state-values-utils.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 state_values_cache()->GetNodeForValues(&replacement_node_, 1); | 153 state_values_cache()->GetNodeForValues(&replacement_node_, 1); |
154 frame_state->ReplaceInput(2, new_value); | 154 frame_state->ReplaceInput(2, new_value); |
155 } | 155 } |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 Node* NonLiveFrameStateSlotReplacer::ClearNonLiveStateValues( | 160 Node* NonLiveFrameStateSlotReplacer::ClearNonLiveStateValues( |
161 Node* values, BitVector* liveness) { | 161 Node* values, BitVector* liveness) { |
162 DCHECK(inputs_buffer_.empty()); | 162 DCHECK(inputs_buffer_.empty()); |
163 for (StateValuesAccess::TypedNode node : StateValuesAccess(values)) { | 163 |
| 164 int var = 0; |
| 165 for (Node* value_node : values->inputs()) { |
| 166 // Make sure this isn't a state value tree |
| 167 DCHECK(value_node->opcode() != IrOpcode::kStateValues); |
| 168 |
164 // Index of the next variable is its furure index in the inputs buffer, | 169 // Index of the next variable is its furure index in the inputs buffer, |
165 // i.e., the buffer's size. | 170 // i.e., the buffer's size. |
166 int var = static_cast<int>(inputs_buffer_.size()); | |
167 bool live = liveness->Contains(var) || permanently_live_.Contains(var); | 171 bool live = liveness->Contains(var) || permanently_live_.Contains(var); |
168 inputs_buffer_.push_back(live ? node.node : replacement_node_); | 172 inputs_buffer_.push_back(live ? value_node : replacement_node_); |
| 173 |
| 174 var++; |
169 } | 175 } |
| 176 |
170 Node* result = state_values_cache()->GetNodeForValues( | 177 Node* result = state_values_cache()->GetNodeForValues( |
171 inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()), | 178 inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()), |
172 inputs_buffer_.size()); | 179 inputs_buffer_.size()); |
173 inputs_buffer_.clear(); | 180 inputs_buffer_.clear(); |
174 return result; | 181 return result; |
175 } | 182 } |
176 | 183 |
177 | 184 |
178 void LivenessAnalyzerBlock::Print(std::ostream& os) { | 185 void LivenessAnalyzerBlock::Print(std::ostream& os) { |
179 os << "Block " << id(); | 186 os << "Block " << id(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 for (int i = 0; i < live_.length(); i++) { | 224 for (int i = 0; i < live_.length(); i++) { |
218 os << (live_.Contains(i) ? "L" : "."); | 225 os << (live_.Contains(i) ? "L" : "."); |
219 } | 226 } |
220 os << std::endl; | 227 os << std::endl; |
221 } | 228 } |
222 } | 229 } |
223 | 230 |
224 } // namespace compiler | 231 } // namespace compiler |
225 } // namespace internal | 232 } // namespace internal |
226 } // namespace v8 | 233 } // namespace v8 |
OLD | NEW |