Bug 1111218 - Fold congruent type barriers. r=bhackett

This commit is contained in:
Jan de Mooij 2014-12-13 22:39:44 +01:00
parent f0b47b1741
commit aa1fdd5e65
4 changed files with 22 additions and 9 deletions

View File

@ -1207,6 +1207,19 @@ MTypeBarrier::printOpcode(FILE *fp) const
getOperand(0)->printName(fp);
}
bool
MTypeBarrier::congruentTo(const MDefinition *def) const
{
if (!def->isTypeBarrier())
return false;
const MTypeBarrier *other = def->toTypeBarrier();
if (barrierKind() != other->barrierKind() || isGuard() != other->isGuard())
return false;
if (!resultTypeSet()->equals(other->resultTypeSet()))
return false;
return congruentIfOperandsEqual(other);
}
#ifdef DEBUG
void
MPhi::assertLoopPhi() const
@ -4355,13 +4368,10 @@ TryAddTypeBarrierForWrite(TempAllocator &alloc, types::CompilerConstraintList *c
if (!aggregateProperty) {
aggregateProperty.emplace(property);
} else {
if (!aggregateProperty->maybeTypes()->isSubset(property.maybeTypes()) ||
!property.maybeTypes()->isSubset(aggregateProperty->maybeTypes()))
{
if (!aggregateProperty->maybeTypes()->equals(property.maybeTypes()))
return false;
}
}
}
MOZ_ASSERT(aggregateProperty);

View File

@ -11343,10 +11343,8 @@ class MTypeBarrier
}
void printOpcode(FILE *fp) const;
bool congruentTo(const MDefinition *def) const;
bool congruentTo(const MDefinition *def) const {
return false;
}
AliasSet getAliasSet() const {
return AliasSet::None();
}

View File

@ -383,7 +383,7 @@ TypeSet::objectsAreSubset(TypeSet *other)
}
bool
TypeSet::isSubset(TypeSet *other)
TypeSet::isSubset(const TypeSet *other) const
{
if ((baseFlags() & other->baseFlags()) != baseFlags())
return false;

View File

@ -634,7 +634,7 @@ class TypeSet
* Get whether this type set is known to be a subset of other.
* This variant doesn't freeze constraints. That variant is called knownSubset
*/
bool isSubset(TypeSet *other);
bool isSubset(const TypeSet *other) const;
/*
* Get whether the objects in this TypeSet are a subset of the objects
@ -642,6 +642,11 @@ class TypeSet
*/
bool objectsAreSubset(TypeSet *other);
/* Whether this TypeSet contains exactly the same types as other. */
bool equals(const TypeSet *other) const {
return this->isSubset(other) && other->isSubset(this);
}
/* Forward all types in this set to the specified constraint. */
bool addTypesToConstraint(JSContext *cx, TypeConstraint *constraint);