OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 new_offset); | 182 new_offset); |
183 if (!result) return false; | 183 if (!result) return false; |
184 lower_check_->ReplaceAllUsesWith(lower_check_->index()); | 184 lower_check_->ReplaceAllUsesWith(lower_check_->index()); |
185 lower_check_->SetOperandAt(0, added_lower_index_); | 185 lower_check_->SetOperandAt(0, added_lower_index_); |
186 } | 186 } |
187 } else { | 187 } else { |
188 ASSERT(false); | 188 ASSERT(false); |
189 } | 189 } |
190 | 190 |
191 if (!keep_new_check) { | 191 if (!keep_new_check) { |
| 192 new_check->block()->graph()->isolate()->counters()-> |
| 193 bounds_checks_eliminated()->Increment(); |
192 new_check->DeleteAndReplaceWith(new_check->ActualValue()); | 194 new_check->DeleteAndReplaceWith(new_check->ActualValue()); |
193 } | 195 } |
194 | 196 |
195 return true; | 197 return true; |
196 } | 198 } |
197 | 199 |
198 void RemoveZeroOperations() { | 200 void RemoveZeroOperations() { |
199 RemoveZeroAdd(&added_lower_index_, &added_lower_offset_); | 201 RemoveZeroAdd(&added_lower_index_, &added_lower_offset_); |
200 RemoveZeroAdd(&added_upper_index_, &added_upper_offset_); | 202 RemoveZeroAdd(&added_upper_index_, &added_upper_offset_); |
201 } | 203 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 bb_data_list = new(zone()) BoundsCheckBbData(key, | 342 bb_data_list = new(zone()) BoundsCheckBbData(key, |
341 offset, | 343 offset, |
342 offset, | 344 offset, |
343 bb, | 345 bb, |
344 check, | 346 check, |
345 check, | 347 check, |
346 bb_data_list, | 348 bb_data_list, |
347 NULL); | 349 NULL); |
348 *data_p = bb_data_list; | 350 *data_p = bb_data_list; |
349 } else if (data->OffsetIsCovered(offset)) { | 351 } else if (data->OffsetIsCovered(offset)) { |
| 352 bb->graph()->isolate()->counters()-> |
| 353 bounds_checks_eliminated()->Increment(); |
350 check->DeleteAndReplaceWith(check->ActualValue()); | 354 check->DeleteAndReplaceWith(check->ActualValue()); |
351 } else if (data->BasicBlock() != bb || | 355 } else if (data->BasicBlock() != bb || |
352 !data->CoverCheck(check, offset)) { | 356 !data->CoverCheck(check, offset)) { |
353 // If the check is in the current BB we try to modify it by calling | 357 // If the check is in the current BB we try to modify it by calling |
354 // "CoverCheck", but if also that fails we record the current offsets | 358 // "CoverCheck", but if also that fails we record the current offsets |
355 // in a new data instance because from now on they are covered. | 359 // in a new data instance because from now on they are covered. |
356 int32_t new_lower_offset = offset < data->LowerOffset() | 360 int32_t new_lower_offset = offset < data->LowerOffset() |
357 ? offset | 361 ? offset |
358 : data->LowerOffset(); | 362 : data->LowerOffset(); |
359 int32_t new_upper_offset = offset > data->UpperOffset() | 363 int32_t new_upper_offset = offset > data->UpperOffset() |
(...skipping 21 matching lines...) Expand all Loading... |
381 data->RemoveZeroOperations(); | 385 data->RemoveZeroOperations(); |
382 if (data->FatherInDominatorTree()) { | 386 if (data->FatherInDominatorTree()) { |
383 table_.Insert(data->Key(), data->FatherInDominatorTree(), zone()); | 387 table_.Insert(data->Key(), data->FatherInDominatorTree(), zone()); |
384 } else { | 388 } else { |
385 table_.Delete(data->Key()); | 389 table_.Delete(data->Key()); |
386 } | 390 } |
387 } | 391 } |
388 } | 392 } |
389 | 393 |
390 } } // namespace v8::internal | 394 } } // namespace v8::internal |
OLD | NEW |