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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 current_check->upper_limit() == upper_constant_limit; | 246 current_check->upper_limit() == upper_constant_limit; |
247 counters()->bounds_checks_eliminated()->Increment(); | 247 counters()->bounds_checks_eliminated()->Increment(); |
248 current_check->check()->set_skip_check(); | 248 current_check->check()->set_skip_check(); |
249 } | 249 } |
250 | 250 |
251 // Choose the appropriate limit. | 251 // Choose the appropriate limit. |
252 Zone* zone = graph()->zone(); | 252 Zone* zone = graph()->zone(); |
253 HValue* context = graph()->GetInvalidContext(); | 253 HValue* context = graph()->GetInvalidContext(); |
254 HValue* limit = data->limit(); | 254 HValue* limit = data->limit(); |
255 if (has_upper_constant_limit) { | 255 if (has_upper_constant_limit) { |
256 HConstant* new_limit = HConstant::New(zone, context, | 256 HConstant* new_limit = HConstant::New(graph()->isolate(), zone, context, |
257 upper_constant_limit); | 257 upper_constant_limit); |
258 new_limit->InsertBefore(pre_header->end()); | 258 new_limit->InsertBefore(pre_header->end()); |
259 limit = new_limit; | 259 limit = new_limit; |
260 } | 260 } |
261 | 261 |
262 // If necessary, redefine the limit in the preheader. | 262 // If necessary, redefine the limit in the preheader. |
263 if (limit->IsInteger32Constant() && | 263 if (limit->IsInteger32Constant() && |
264 limit->block() != pre_header && | 264 limit->block() != pre_header && |
265 !limit->block()->Dominates(pre_header)) { | 265 !limit->block()->Dominates(pre_header)) { |
266 HConstant* new_limit = HConstant::New(zone, context, | 266 HConstant* new_limit = HConstant::New(graph()->isolate(), zone, context, |
267 limit->GetInteger32Constant()); | 267 limit->GetInteger32Constant()); |
268 new_limit->InsertBefore(pre_header->end()); | 268 new_limit->InsertBefore(pre_header->end()); |
269 limit = new_limit; | 269 limit = new_limit; |
270 } | 270 } |
271 | 271 |
272 // Do the hoisting. | 272 // Do the hoisting. |
273 HBoundsCheck* hoisted_check = HBoundsCheck::New( | 273 HBoundsCheck* hoisted_check = HBoundsCheck::New( |
274 zone, context, limit, check->check()->length()); | 274 graph()->isolate(), zone, context, limit, check->check()->length()); |
275 hoisted_check->InsertBefore(pre_header->end()); | 275 hoisted_check->InsertBefore(pre_header->end()); |
276 hoisted_check->set_allow_equality(true); | 276 hoisted_check->set_allow_equality(true); |
277 counters()->bounds_checks_hoisted()->Increment(); | 277 counters()->bounds_checks_hoisted()->Increment(); |
278 } | 278 } |
279 | 279 |
280 void CollectInductionVariableData(HBasicBlock* bb) { | 280 void CollectInductionVariableData(HBasicBlock* bb) { |
281 bool additional_limit = false; | 281 bool additional_limit = false; |
282 | 282 |
283 for (int i = 0; i < bb->phis()->length(); i++) { | 283 for (int i = 0; i < bb->phis()->length(); i++) { |
284 HPhi* phi = bb->phis()->at(i); | 284 HPhi* phi = bb->phis()->at(i); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 void HBoundsCheckHoistingPhase::HoistRedundantBoundsChecks() { | 370 void HBoundsCheckHoistingPhase::HoistRedundantBoundsChecks() { |
371 InductionVariableBlocksTable table(graph()); | 371 InductionVariableBlocksTable table(graph()); |
372 table.CollectInductionVariableData(graph()->entry_block()); | 372 table.CollectInductionVariableData(graph()->entry_block()); |
373 for (int i = 0; i < graph()->blocks()->length(); i++) { | 373 for (int i = 0; i < graph()->blocks()->length(); i++) { |
374 table.EliminateRedundantBoundsChecks(graph()->blocks()->at(i)); | 374 table.EliminateRedundantBoundsChecks(graph()->blocks()->at(i)); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 } } // namespace v8::internal | 378 } } // namespace v8::internal |
OLD | NEW |