зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596718 - Part 1: Add MIsNullOrUndefined::foldsTo to omit unreachable tests. r=jandem
Fold away MIsNullOrUndefined when the input is definitely null/undefined resp. never null/undefined. Differential Revision: https://phabricator.services.mozilla.com/D53172 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
10c450f91f
Коммит
96975a6e96
|
@ -5688,6 +5688,24 @@ MDefinition* MTypedArrayIndexToInt32::foldsTo(TempAllocator& alloc) {
|
|||
return MConstant::New(alloc, Int32Value(ival));
|
||||
}
|
||||
|
||||
MDefinition* MIsNullOrUndefined::foldsTo(TempAllocator& alloc) {
|
||||
MDefinition* input = value();
|
||||
if (input->isBox()) {
|
||||
input = input->getOperand(0);
|
||||
}
|
||||
|
||||
if (input->type() == MIRType::Null || input->type() == MIRType::Undefined) {
|
||||
return MConstant::New(alloc, BooleanValue(true));
|
||||
}
|
||||
|
||||
if (!input->mightBeType(MIRType::Null) &&
|
||||
!input->mightBeType(MIRType::Undefined)) {
|
||||
return MConstant::New(alloc, BooleanValue(false));
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bool jit::ElementAccessIsDenseNative(CompilerConstraintList* constraints,
|
||||
MDefinition* obj, MDefinition* id) {
|
||||
if (obj->mightBeType(MIRType::String)) {
|
||||
|
|
|
@ -10777,6 +10777,8 @@ class MIsNullOrUndefined : public MUnaryInstruction,
|
|||
TRIVIAL_NEW_WRAPPERS
|
||||
NAMED_OPERANDS((0, value))
|
||||
|
||||
MDefinition* foldsTo(TempAllocator& alloc) override;
|
||||
|
||||
bool congruentTo(const MDefinition* ins) const override {
|
||||
return congruentIfOperandsEqual(ins);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче