MIPS: New array bounds check elimination pass (focused on induction variables and bitwise operations).

Port r15866 (52e8581c)

BUG=

Review URL: https://codereview.chromium.org/20393002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15890 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
palfia@homejinni.com 2013-07-25 19:55:55 +00:00
parent 3c9efdeeb4
commit c12a0774ea
2 changed files with 23 additions and 4 deletions

View File

@ -4163,6 +4163,21 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
}
void LCodeGen::ApplyCheckIf(Condition cc,
LBoundsCheck* check,
Register src1,
const Operand& src2) {
if (FLAG_debug_code && check->hydrogen()->skip_check()) {
Label done;
__ Branch(&done, NegateCondition(cc), src1, src2);
__ stop("eliminated bounds check failed");
__ bind(&done);
} else {
DeoptimizeIf(cc, check->environment(), src1, src2);
}
}
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
if (instr->hydrogen()->skip_check()) return;
@ -4175,13 +4190,13 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
} else {
__ li(at, Operand(constant_index));
}
DeoptimizeIf(condition,
instr->environment(),
ApplyCheckIf(condition,
instr,
at,
Operand(ToRegister(instr->length())));
} else {
DeoptimizeIf(condition,
instr->environment(),
ApplyCheckIf(condition,
instr,
ToRegister(instr->index()),
Operand(ToRegister(instr->length())));
}

View File

@ -284,6 +284,10 @@ class LCodeGen BASE_EMBEDDED {
LEnvironment* environment,
Register src1 = zero_reg,
const Operand& src2 = Operand(zero_reg));
void ApplyCheckIf(Condition cc,
LBoundsCheck* check,
Register src1 = zero_reg,
const Operand& src2 = Operand(zero_reg));
void AddToTranslation(Translation* translation,
LOperand* op,