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/hydrogen-bch.h" | 5 #include "src/hydrogen-bch.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 /* | 10 /* |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 (hoistability == OPTIMISTICALLY_HOISTABLE && | 230 (hoistability == OPTIMISTICALLY_HOISTABLE && |
231 !graph()->use_optimistic_licm())) { | 231 !graph()->use_optimistic_licm())) { |
232 return; | 232 return; |
233 } | 233 } |
234 | 234 |
235 // We will do the hoisting, but we must see if the limit is "limit" or if | 235 // We will do the hoisting, but we must see if the limit is "limit" or if |
236 // all checks are done on constants: if all check are done against the same | 236 // all checks are done on constants: if all check are done against the same |
237 // constant limit we will use that instead of the induction limit. | 237 // constant limit we will use that instead of the induction limit. |
238 bool has_upper_constant_limit = true; | 238 bool has_upper_constant_limit = true; |
239 int32_t upper_constant_limit = | 239 int32_t upper_constant_limit = |
240 check != NULL && check->HasUpperLimit() ? check->upper_limit() : 0; | 240 check->HasUpperLimit() ? check->upper_limit() : 0; |
241 for (InductionVariableData::InductionVariableCheck* current_check = check; | 241 for (InductionVariableData::InductionVariableCheck* current_check = check; |
242 current_check != NULL; | 242 current_check != NULL; |
243 current_check = current_check->next()) { | 243 current_check = current_check->next()) { |
244 has_upper_constant_limit = | 244 has_upper_constant_limit = |
245 has_upper_constant_limit && | 245 has_upper_constant_limit && current_check->HasUpperLimit() && |
Yang
2014/10/02 09:54:13
This seems like a bug fix rather and a mechanical
| |
246 check->HasUpperLimit() && | 246 current_check->upper_limit() == upper_constant_limit; |
247 check->upper_limit() == upper_constant_limit; | |
248 counters()->bounds_checks_eliminated()->Increment(); | 247 counters()->bounds_checks_eliminated()->Increment(); |
249 current_check->check()->set_skip_check(); | 248 current_check->check()->set_skip_check(); |
250 } | 249 } |
251 | 250 |
252 // Choose the appropriate limit. | 251 // Choose the appropriate limit. |
253 Zone* zone = graph()->zone(); | 252 Zone* zone = graph()->zone(); |
254 HValue* context = graph()->GetInvalidContext(); | 253 HValue* context = graph()->GetInvalidContext(); |
255 HValue* limit = data->limit(); | 254 HValue* limit = data->limit(); |
256 if (has_upper_constant_limit) { | 255 if (has_upper_constant_limit) { |
257 HConstant* new_limit = HConstant::New(zone, context, | 256 HConstant* new_limit = HConstant::New(zone, context, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 | 369 |
371 void HBoundsCheckHoistingPhase::HoistRedundantBoundsChecks() { | 370 void HBoundsCheckHoistingPhase::HoistRedundantBoundsChecks() { |
372 InductionVariableBlocksTable table(graph()); | 371 InductionVariableBlocksTable table(graph()); |
373 table.CollectInductionVariableData(graph()->entry_block()); | 372 table.CollectInductionVariableData(graph()->entry_block()); |
374 for (int i = 0; i < graph()->blocks()->length(); i++) { | 373 for (int i = 0; i < graph()->blocks()->length(); i++) { |
375 table.EliminateRedundantBoundsChecks(graph()->blocks()->at(i)); | 374 table.EliminateRedundantBoundsChecks(graph()->blocks()->at(i)); |
376 } | 375 } |
377 } | 376 } |
378 | 377 |
379 } } // namespace v8::internal | 378 } } // namespace v8::internal |
OLD | NEW |