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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 break; | 142 break; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 if (has_accumulator_) { | 146 if (has_accumulator_) { |
147 DCHECK_EQ(frame_state->InputAt(2)->opcode(), IrOpcode::kStateValues); | 147 DCHECK_EQ(frame_state->InputAt(2)->opcode(), IrOpcode::kStateValues); |
148 DCHECK_EQ( | 148 DCHECK_EQ( |
149 static_cast<int>(StateValuesAccess(frame_state->InputAt(2)).size()), 1); | 149 static_cast<int>(StateValuesAccess(frame_state->InputAt(2)).size()), 1); |
150 int index = liveness->length() - 1; | 150 int index = liveness->length() - 1; |
151 if (!liveness->Contains(index) && !permanently_live_.Contains(index)) { | 151 if (!liveness->Contains(index) && !permanently_live_.Contains(index)) { |
152 Node* new_value = | 152 Node* new_value = state_values_cache()->GetNodeForValues( |
153 state_values_cache()->GetNodeForValues(&replacement_node_, 1); | 153 &replacement_node_, 1, nullptr); |
Jarin
2016/12/07 08:56:20
How about adding a default value (nullptr) for the
Leszek Swirski
2016/12/08 15:44:30
Ah, I had that originally but forgot to add it bac
| |
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 | 163 |
164 int var = 0; | 164 int var = 0; |
165 for (Node* value_node : values->inputs()) { | 165 for (Node* value_node : values->inputs()) { |
166 // Make sure this isn't a state value tree | 166 // Make sure this isn't a state value tree |
167 DCHECK(value_node->opcode() != IrOpcode::kStateValues); | 167 DCHECK(value_node->opcode() != IrOpcode::kStateValues); |
168 | 168 |
169 // 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, |
170 // i.e., the buffer's size. | 170 // i.e., the buffer's size. |
171 bool live = liveness->Contains(var) || permanently_live_.Contains(var); | 171 bool live = liveness->Contains(var) || permanently_live_.Contains(var); |
172 inputs_buffer_.push_back(live ? value_node : replacement_node_); | 172 inputs_buffer_.push_back(live ? value_node : replacement_node_); |
173 | 173 |
174 var++; | 174 var++; |
175 } | 175 } |
176 | 176 |
177 Node* result = state_values_cache()->GetNodeForValues( | 177 Node* result = state_values_cache()->GetNodeForValues( |
178 inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()), | 178 inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()), |
179 inputs_buffer_.size()); | 179 inputs_buffer_.size(), nullptr); |
180 inputs_buffer_.clear(); | 180 inputs_buffer_.clear(); |
181 return result; | 181 return result; |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 void LivenessAnalyzerBlock::Print(std::ostream& os) { | 185 void LivenessAnalyzerBlock::Print(std::ostream& os) { |
186 os << "Block " << id(); | 186 os << "Block " << id(); |
187 bool first = true; | 187 bool first = true; |
188 for (LivenessAnalyzerBlock* pred : predecessors_) { | 188 for (LivenessAnalyzerBlock* pred : predecessors_) { |
189 if (!first) { | 189 if (!first) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 for (int i = 0; i < live_.length(); i++) { | 224 for (int i = 0; i < live_.length(); i++) { |
225 os << (live_.Contains(i) ? "L" : "."); | 225 os << (live_.Contains(i) ? "L" : "."); |
226 } | 226 } |
227 os << std::endl; | 227 os << std::endl; |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 } // namespace compiler | 231 } // namespace compiler |
232 } // namespace internal | 232 } // namespace internal |
233 } // namespace v8 | 233 } // namespace v8 |
OLD | NEW |