Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 1590ab36698d9d5b98605111966ed17b8c7bc2a8..f097fdd2d440f34f51331d57c06e703cab771c14 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3484,7 +3484,7 @@ class BoundsCheckBbData: public ZoneObject { |
} |
if (!keep_new_check) { |
- new_check->DeleteAndReplaceWith(NULL); |
+ new_check->DeleteAndReplaceWith(new_check->index()); |
} |
} |
@@ -3591,21 +3591,13 @@ class BoundsCheckTable : private ZoneHashMap { |
// Eliminates checks in bb and recursively in the dominated blocks. |
-// Also replace the results of check instructions with the original value, if |
-// the result is used. This is safe now, since we don't do code motion after |
-// this point. It enables better register allocation since the value produced |
-// by check instructions is really a copy of the original value. |
void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb, |
BoundsCheckTable* table) { |
BoundsCheckBbData* bb_data_list = NULL; |
for (HInstruction* i = bb->first(); i != NULL; i = i->next()) { |
if (!i->IsBoundsCheck()) continue; |
- |
HBoundsCheck* check = HBoundsCheck::cast(i); |
- check->ReplaceAllUsesWith(check->index()); |
- |
- if (!FLAG_array_bounds_checks_elimination) continue; |
int32_t offset; |
BoundsCheckKey* key = |
@@ -3624,7 +3616,7 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb, |
NULL); |
*data_p = bb_data_list; |
} else if (data->OffsetIsCovered(offset)) { |
- check->DeleteAndReplaceWith(NULL); |
+ check->DeleteAndReplaceWith(check->index()); |
} else if (data->BasicBlock() == bb) { |
data->CoverCheck(check, offset); |
} else { |
@@ -3664,6 +3656,8 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb, |
void HGraph::EliminateRedundantBoundsChecks() { |
+ if (!FLAG_array_bounds_checks_elimination) return; |
Sven Panne
2012/12/06 14:59:02
For consistency with the other phases, move this t
Massi
2012/12/07 10:11:11
Done.
|
+ |
HPhase phase("H_Eliminate bounds checks", this); |
BoundsCheckTable checks_table(zone()); |
EliminateRedundantBoundsChecks(entry_block(), &checks_table); |