Bug 1355943 - Constant fold ion type-barrier. r=h4writer

This commit is contained in:
Tom Schuster 2017-04-13 12:57:43 +02:00
parent b1373744cb
commit f560973ff4
2 changed files with 17 additions and 0 deletions

View File

@ -2272,6 +2272,22 @@ MTypeBarrier::congruentTo(const MDefinition* def) const
return congruentIfOperandsEqual(other); return congruentIfOperandsEqual(other);
} }
MDefinition*
MTypeBarrier::foldsTo(TempAllocator& alloc)
{
MIRType type = resultTypeSet()->getKnownMIRType();
if (type == MIRType::Value || type == MIRType::Object)
return this;
if (!input()->isConstant())
return this;
if (input()->type() != type)
return this;
return input();
}
#ifdef DEBUG #ifdef DEBUG
void void
MPhi::assertLoopPhi() const MPhi::assertLoopPhi() const

View File

@ -12825,6 +12825,7 @@ class MTypeBarrier
BarrierKind barrierKind() const { BarrierKind barrierKind() const {
return barrierKind_; return barrierKind_;
} }
MDefinition* foldsTo(TempAllocator& alloc) override;
bool alwaysBails() const { bool alwaysBails() const {
// If mirtype of input doesn't agree with mirtype of barrier, // If mirtype of input doesn't agree with mirtype of barrier,