зеркало из https://github.com/mozilla/gecko-dev.git
Bug 876607 - IonMonkey: Reordering of operands should look to real use count, r=sstangl
This commit is contained in:
Родитель
4b0528c455
Коммит
3fcf048742
|
@ -858,7 +858,13 @@ ReorderCommutative(MDefinition **lhsp, MDefinition **rhsp)
|
|||
// Ensure that if there is a constant, then it is in rhs.
|
||||
// In addition, since clobbering binary operations clobber the left
|
||||
// operand, prefer a non-constant lhs operand with no further uses.
|
||||
if (lhs->isConstant() || (!rhs->isConstant() && rhs->useCount() == 1)) {
|
||||
|
||||
if (rhs->isConstant())
|
||||
return;
|
||||
|
||||
if (lhs->isConstant() ||
|
||||
(lhs->defUseCount() == 1 && rhs->defUseCount() != 1))
|
||||
{
|
||||
*rhsp = lhs;
|
||||
*lhsp = rhs;
|
||||
}
|
||||
|
|
|
@ -241,6 +241,16 @@ MDefinition::useCount() const
|
|||
return count;
|
||||
}
|
||||
|
||||
size_t
|
||||
MDefinition::defUseCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (MUseIterator i(uses_.begin()); i != uses_.end(); i++)
|
||||
if ((*i)->consumer()->isDefinition())
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
MUseIterator
|
||||
MDefinition::removeUse(MUseIterator use)
|
||||
{
|
||||
|
|
|
@ -441,6 +441,10 @@ class MDefinition : public MNode
|
|||
// Number of uses of this instruction.
|
||||
size_t useCount() const;
|
||||
|
||||
// Number of uses of this instruction.
|
||||
// (only counting MDefinitions, ignoring MResumePoints)
|
||||
size_t defUseCount() const;
|
||||
|
||||
bool hasUses() const {
|
||||
return !uses_.empty();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче