MIPS: Eliminate redundant smi checks

Port r11774 (28c45b9b)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10536128
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11789 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2012-06-13 07:55:53 +00:00
parent 9a80637be7
commit 4a385fa269
2 changed files with 9 additions and 5 deletions

View File

@ -2510,8 +2510,13 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
// Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) {
__ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
__ And(scratch, result, Operand(kSmiTagMask));
DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
} else {
__ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
}
}
}

View File

@ -1647,10 +1647,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} else {
ASSERT(to.IsInteger32());
LOperand* value = UseRegisterAtStart(instr->value());
bool needs_check = !instr->value()->type().IsSmi();
LInstruction* res = NULL;
if (!needs_check) {
res = DefineAsRegister(new(zone()) LSmiUntag(value, needs_check));
if (instr->value()->type().IsSmi()) {
res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
} else {
LOperand* temp1 = TempRegister();
LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()