Bug 1116591 - Add a Mix4Policy template class, and switch a MixPolicy of MixPolicys over to it. r=nbp

This commit is contained in:
Jeff Walden 2014-12-31 13:51:15 -06:00
parent 7e70950784
commit be739df48d
3 changed files with 19 additions and 3 deletions

View File

@ -12082,7 +12082,7 @@ class MMemoryBarrier
class MCompareExchangeTypedArrayElement
: public MAryInstruction<4>,
public MixPolicy< MixPolicy<ObjectPolicy<0>, IntPolicy<1> >, MixPolicy<IntPolicy<2>, IntPolicy<3> > >::Data
public Mix4Policy<ObjectPolicy<0>, IntPolicy<1>, IntPolicy<2>, IntPolicy<3>>::Data
{
Scalar::Type arrayType_;

View File

@ -996,6 +996,7 @@ FilterTypeSetPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
_(Mix3Policy<StringPolicy<0>, IntPolicy<1>, IntPolicy<2>>) \
_(Mix3Policy<StringPolicy<0>, ObjectPolicy<1>, StringPolicy<2> >) \
_(Mix3Policy<StringPolicy<0>, StringPolicy<1>, StringPolicy<2> >) \
_(Mix4Policy<ObjectPolicy<0>, IntPolicy<1>, IntPolicy<2>, IntPolicy<3>>) \
_(MixPolicy<BoxPolicy<0>, ObjectPolicy<1> >) \
_(MixPolicy<ConvertToStringPolicy<0>, ConvertToStringPolicy<1> >) \
_(MixPolicy<ConvertToStringPolicy<0>, ObjectPolicy<1> >) \
@ -1012,8 +1013,6 @@ FilterTypeSetPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
_(MixPolicy<ObjectPolicy<1>, ConvertToStringPolicy<0> >) \
_(MixPolicy<StringPolicy<0>, IntPolicy<1> >) \
_(MixPolicy<StringPolicy<0>, StringPolicy<1> >) \
_(MixPolicy<MixPolicy<ObjectPolicy<0>, IntPolicy<1>>, \
MixPolicy<IntPolicy<2>, IntPolicy<3>>>) \
_(NoFloatPolicy<0>) \
_(NoFloatPolicyAfter<1>) \
_(NoFloatPolicyAfter<2>) \

View File

@ -344,6 +344,23 @@ class Mix3Policy : public TypePolicy
}
};
// Combine four policies. (Missing variadic templates yet?)
template <class Policy1, class Policy2, class Policy3, class Policy4>
class Mix4Policy : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) {
return Policy1::staticAdjustInputs(alloc, ins) &&
Policy2::staticAdjustInputs(alloc, ins) &&
Policy3::staticAdjustInputs(alloc, ins) &&
Policy4::staticAdjustInputs(alloc, ins);
}
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
return staticAdjustInputs(alloc, ins);
}
};
class CallSetElementPolicy : public SingleObjectPolicy
{
public: