Commit 1aa2891c authored by mmassi@chromium.org's avatar mmassi@chromium.org

Make keyed operations use the unchecked index but still depend on the checked one.

BUG=

Review URL: https://chromiumcodereview.appspot.com/11445016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13176 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a1d10c69
This diff is collapsed.
......@@ -3499,8 +3499,8 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
HStackCheckEliminator sce(this);
sce.Process();
EliminateRedundantBoundsChecks();
DehoistSimpleArrayIndexComputations();
if (FLAG_array_bounds_checks_elimination) EliminateRedundantBoundsChecks();
if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations();
if (FLAG_dead_code_elimination) DeadCodeElimination();
return true;
......@@ -3657,7 +3657,7 @@ class BoundsCheckBbData: public ZoneObject {
}
if (!keep_new_check) {
new_check->DeleteAndReplaceWith(NULL);
new_check->DeleteAndReplaceWith(new_check->index());
}
}
......@@ -3764,21 +3764,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 =
......@@ -3797,7 +3789,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 {
......@@ -3892,8 +3884,6 @@ static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) {
void HGraph::DehoistSimpleArrayIndexComputations() {
if (!FLAG_array_index_dehoisting) return;
HPhase phase("H_Dehoist index computations", this);
for (int i = 0; i < blocks()->length(); ++i) {
for (HInstruction* instr = blocks()->at(i)->first();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment