375 BoundsCheckBbData* bb_data_list =
NULL;
377 for (HInstructionIterator it(bb); !it.Done(); it.Advance()) {
378 HInstruction*
i = it.Current();
379 if (!
i->IsBoundsCheck())
continue;
381 HBoundsCheck* check = HBoundsCheck::cast(
i);
383 BoundsCheckKey* key =
385 if (key ==
NULL)
continue;
386 BoundsCheckBbData** data_p =
table_.LookupOrInsert(key, zone());
387 BoundsCheckBbData* data = *data_p;
389 bb_data_list =
new(zone()) BoundsCheckBbData(key,
397 *data_p = bb_data_list;
398 if (FLAG_trace_bce) {
400 bb->block_id(), offset);
402 }
else if (data->OffsetIsCovered(offset)) {
403 bb->graph()->isolate()->counters()->
404 bounds_checks_eliminated()->Increment();
405 if (FLAG_trace_bce) {
406 base::OS::Print(
"Eliminating bounds check #%d, offset %d is covered\n",
407 check->id(), offset);
409 check->DeleteAndReplaceWith(check->ActualValue());
410 }
else if (data->BasicBlock() == bb) {
424 data->CoverCheck(check, offset);
425 }
else if (
graph()->use_optimistic_licm() ||
426 bb->IsLoopSuccessorDominator()) {
427 int32_t new_lower_offset = offset < data->LowerOffset()
429 : data->LowerOffset();
430 int32_t new_upper_offset = offset > data->UpperOffset()
432 : data->UpperOffset();
433 bb_data_list =
new(zone()) BoundsCheckBbData(key,
441 if (FLAG_trace_bce) {
442 base::OS::Print(
"Updated bounds check data for block #%d: [%d - %d]\n",
443 bb->block_id(), new_lower_offset, new_upper_offset);
445 table_.Insert(key, bb_data_list, zone());
static void Print(const char *format,...)
static BoundsCheckKey * Create(Zone *zone, HBoundsCheck *check, int32_t *offset)