Bug 940686. When we eliminate a barrier, make its unbox infallible if it was a barrier-type unbox before. r=h4writer

This commit is contained in:
Boris Zbarsky 2013-11-20 08:16:19 -05:00
parent 45c142619f
commit ee72990f4e
2 changed files with 14 additions and 2 deletions

View File

@ -1576,11 +1576,16 @@ TryEliminateTypeBarrierFromTest(MTypeBarrier *barrier, bool filtersNull, bool fi
// Disregard the possible unbox added before the Typebarrier for checking.
MDefinition *input = barrier->input();
if (input->isUnbox() && input->toUnbox()->mode() != MUnbox::Fallible)
input = input->toUnbox()->input();
MUnbox *inputUnbox = nullptr;
if (input->isUnbox() && input->toUnbox()->mode() != MUnbox::Fallible) {
inputUnbox = input->toUnbox();
input = inputUnbox->input();
}
if (test->getOperand(0) == input && direction == TRUE_BRANCH) {
*eliminated = true;
if (inputUnbox)
inputUnbox->makeInfallible();
barrier->replaceAllUsesWith(barrier->input());
return;
}
@ -1614,6 +1619,8 @@ TryEliminateTypeBarrierFromTest(MTypeBarrier *barrier, bool filtersNull, bool fi
}
*eliminated = true;
if (inputUnbox)
inputUnbox->makeInfallible();
barrier->replaceAllUsesWith(barrier->input());
}

View File

@ -2373,6 +2373,11 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy
return AliasSet::None();
}
void printOpcode(FILE *fp) const;
void makeInfallible() {
// Should only be called if we're already Infallible or TypeBarrier
JS_ASSERT(mode() != Fallible);
mode_ = Infallible;
}
};
class MGuardObject : public MUnaryInstruction, public SingleObjectPolicy