Bug 1116591 - Make all TypePolicy subclasses final to prevent the mistake of inheriting from one (rather than inheriting from its nested Data class). r=nbp

This commit is contained in:
Jeff Walden 2014-12-31 13:51:15 -06:00
Родитель 7e3220ac8e
Коммит 78290a2644
4 изменённых файлов: 125 добавлений и 111 удалений

Просмотреть файл

@ -1069,7 +1069,7 @@ TypeAnalyzer::adjustPhiInputs(MPhi *phi)
// the original box.
phi->replaceOperand(i, in->toUnbox()->input());
} else {
MDefinition *box = BoxInputsPolicy::alwaysBoxAt(alloc(), in->block()->lastIns(), in);
MDefinition *box = AlwaysBoxAt(alloc(), in->block()->lastIns(), in);
phi->replaceOperand(i, box);
}
}

Просмотреть файл

@ -3982,7 +3982,9 @@ class MUnbox MOZ_FINAL : public MUnaryInstruction, public BoxInputsPolicy::Data
ALLOW_CLONE(MUnbox)
};
class MGuardObject : public MUnaryInstruction, public SingleObjectPolicy::Data
class MGuardObject
: public MUnaryInstruction,
public SingleObjectPolicy::Data
{
explicit MGuardObject(MDefinition *ins)
: MUnaryInstruction(ins)
@ -11397,7 +11399,9 @@ class MTypeBarrier
// Like MTypeBarrier, guard that the value is in the given type set. This is
// used before property writes to ensure the value being written is represented
// in the property types for the object.
class MMonitorTypes : public MUnaryInstruction, public BoxInputsPolicy::Data
class MMonitorTypes
: public MUnaryInstruction,
public BoxInputsPolicy::Data
{
const types::TemporaryTypeSet *typeSet_;
BarrierKind barrierKind_;

Просмотреть файл

@ -27,15 +27,7 @@ EnsureOperandNotFloat32(TempAllocator &alloc, MInstruction *def, unsigned op)
}
MDefinition *
BoxInputsPolicy::boxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand)
{
if (operand->isUnbox())
return operand->toUnbox()->input();
return alwaysBoxAt(alloc, at, operand);
}
MDefinition *
BoxInputsPolicy::alwaysBoxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand)
js::jit::AlwaysBoxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand)
{
MDefinition *boxedOperand = operand;
// Replace Float32 by double
@ -49,14 +41,22 @@ BoxInputsPolicy::alwaysBoxAt(TempAllocator &alloc, MInstruction *at, MDefinition
return box;
}
static MDefinition *
BoxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand)
{
if (operand->isUnbox())
return operand->toUnbox()->input();
return AlwaysBoxAt(alloc, at, operand);
}
bool
BoxInputsPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
BoxInputsPolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
{
for (size_t i = 0, e = ins->numOperands(); i < e; i++) {
MDefinition *in = ins->getOperand(i);
if (in->type() == MIRType_Value)
continue;
ins->replaceOperand(i, boxAt(alloc, ins, in));
ins->replaceOperand(i, BoxAt(alloc, ins, in));
}
return true;
}
@ -66,7 +66,7 @@ ArithPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
{
MIRType specialization = ins->typePolicySpecialization();
if (specialization == MIRType_None)
return BoxInputsPolicy::adjustInputs(alloc, ins);
return BoxInputsPolicy::staticAdjustInputs(alloc, ins);
MOZ_ASSERT(ins->type() == MIRType_Double || ins->type() == MIRType_Int32 || ins->type() == MIRType_Float32);
@ -114,7 +114,7 @@ ComparePolicy::adjustInputs(TempAllocator &alloc, MInstruction *def)
if (compare->compareType() == MCompare::Compare_Unknown ||
compare->compareType() == MCompare::Compare_Value)
{
return BoxInputsPolicy::adjustInputs(alloc, def);
return BoxInputsPolicy::staticAdjustInputs(alloc, def);
}
// Compare_Boolean specialization is done for "Anything === Bool"
@ -255,14 +255,14 @@ TypeBarrierPolicy::adjustInputs(TempAllocator &alloc, MInstruction *def)
// XXX: Possible optimization: decrease resultTypeSet to only include
// the inputType. This will remove the need for boxing.
MOZ_ASSERT(inputType != MIRType_Value);
ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0)));
ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0)));
return true;
}
// Box input if needed.
if (inputType != MIRType_Value) {
MOZ_ASSERT(ins->alwaysBails());
ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0)));
ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0)));
}
// We can't unbox a value to null/undefined/lazyargs. So keep output
@ -319,7 +319,7 @@ TestPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
}
default:
ins->replaceOperand(0, boxAt(alloc, ins, op));
ins->replaceOperand(0, BoxAt(alloc, ins, op));
break;
}
return true;
@ -330,7 +330,7 @@ BitwisePolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
{
MIRType specialization = ins->typePolicySpecialization();
if (specialization == MIRType_None)
return BoxInputsPolicy::adjustInputs(alloc, ins);
return BoxInputsPolicy::staticAdjustInputs(alloc, ins);
MOZ_ASSERT(ins->type() == specialization);
MOZ_ASSERT(specialization == MIRType_Int32 || specialization == MIRType_Double);
@ -528,7 +528,7 @@ BoxPolicy<Op>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
if (in->type() == MIRType_Value)
return true;
ins->replaceOperand(Op, boxAt(alloc, ins, in));
ins->replaceOperand(Op, BoxAt(alloc, ins, in));
return true;
}
@ -594,7 +594,7 @@ ToDoublePolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
break;
}
in = boxAt(alloc, ins, in);
in = BoxAt(alloc, ins, in);
ins->replaceOperand(0, in);
return true;
}
@ -642,7 +642,7 @@ ToInt32Policy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
break;
}
in = boxAt(alloc, ins, in);
in = BoxAt(alloc, ins, in);
ins->replaceOperand(0, in);
return true;
}
@ -654,7 +654,7 @@ ToStringPolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
MIRType type = ins->getOperand(0)->type();
if (type == MIRType_Object || type == MIRType_Symbol) {
ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0)));
ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0)));
return true;
}
@ -712,14 +712,14 @@ bool
CallSetElementPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
{
// The first operand should be an object.
SingleObjectPolicy::adjustInputs(alloc, ins);
SingleObjectPolicy::staticAdjustInputs(alloc, ins);
// Box the index and value operands.
for (size_t i = 1, e = ins->numOperands(); i < e; i++) {
MDefinition *in = ins->getOperand(i);
if (in->type() == MIRType_Value)
continue;
ins->replaceOperand(i, boxAt(alloc, ins, in));
ins->replaceOperand(i, BoxAt(alloc, ins, in));
}
return true;
}
@ -761,7 +761,7 @@ StoreTypedArrayPolicy::adjustValueInput(TempAllocator &alloc, MInstruction *ins,
case MIRType_Object:
case MIRType_String:
case MIRType_Symbol:
value = boxAt(alloc, ins, value);
value = BoxAt(alloc, ins, value);
break;
default:
MOZ_CRASH("Unexpected type");
@ -836,7 +836,7 @@ StoreTypedArrayHolePolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
MOZ_ASSERT(store->index()->type() == MIRType_Int32);
MOZ_ASSERT(store->length()->type() == MIRType_Int32);
return adjustValueInput(alloc, ins, store->arrayType(), store->value(), 3);
return StoreTypedArrayPolicy::adjustValueInput(alloc, ins, store->arrayType(), store->value(), 3);
}
bool
@ -845,7 +845,7 @@ StoreTypedArrayElementStaticPolicy::adjustInputs(TempAllocator &alloc, MInstruct
MStoreTypedArrayElementStatic *store = ins->toStoreTypedArrayElementStatic();
return ConvertToInt32Policy<0>::staticAdjustInputs(alloc, ins) &&
adjustValueInput(alloc, ins, store->viewType(), store->value(), 1);
StoreTypedArrayPolicy::adjustValueInput(alloc, ins, store->viewType(), store->value(), 1);
}
bool
@ -894,7 +894,7 @@ ClampPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
case MIRType_Value:
break;
default:
ins->replaceOperand(0, boxAt(alloc, ins, in));
ins->replaceOperand(0, BoxAt(alloc, ins, in));
break;
}
@ -915,7 +915,7 @@ FilterTypeSetPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
// Output is a value, box the input.
if (outputType == MIRType_Value) {
MOZ_ASSERT(inputType != MIRType_Value);
ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0)));
ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0)));
return true;
}
@ -927,7 +927,7 @@ FilterTypeSetPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
ins->block()->insertBefore(ins, bail);
bail->setDependency(ins->dependency());
ins->setDependency(bail);
ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0)));
ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0)));
}
// We can't unbox a value to null/undefined/lazyargs. So keep output
@ -1051,12 +1051,14 @@ namespace {
// Default function visited by the C++ lookup rules, if the MIR Instruction does
// not inherit from a TypePolicy::Data type.
static TypePolicy *
thisTypePolicy() {
thisTypePolicy()
{
return nullptr;
}
static MIRType
thisTypeSpecialization() {
thisTypeSpecialization()
{
MOZ_CRASH("TypeSpecialization lacks definition of thisTypeSpecialization.");
}

Просмотреть файл

@ -16,6 +16,9 @@ namespace jit {
class MInstruction;
class MDefinition;
extern MDefinition *
AlwaysBoxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand);
// A type policy directs the type analysis phases, which insert conversion,
// boxing, unboxing, and type changes as necessary.
class TypePolicy
@ -62,136 +65,135 @@ struct TypeSpecializationData
#define SPECIALIZATION_DATA_ INHERIT_DATA_(TypeSpecializationData)
class BoxInputsPolicy : public TypePolicy
{
protected:
static MDefinition *boxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand);
public:
EMPTY_DATA_;
static MDefinition *alwaysBoxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def);
};
class ArithPolicy : public BoxInputsPolicy
class BoxInputsPolicy MOZ_FINAL : public TypePolicy
{
public:
SPECIALIZATION_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
class BitwisePolicy : public BoxInputsPolicy
class ArithPolicy MOZ_FINAL : public TypePolicy
{
public:
SPECIALIZATION_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
class ComparePolicy : public BoxInputsPolicy
class BitwisePolicy MOZ_FINAL : public TypePolicy
{
public:
SPECIALIZATION_DATA_;
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
class ComparePolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
// Policy for MTest instructions.
class TestPolicy : public BoxInputsPolicy
class TestPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class TypeBarrierPolicy : public BoxInputsPolicy
class TypeBarrierPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class CallPolicy : public BoxInputsPolicy
class CallPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
// Policy for MPow. First operand Double; second Double or Int32.
class PowPolicy : public BoxInputsPolicy
class PowPolicy MOZ_FINAL : public TypePolicy
{
public:
SPECIALIZATION_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
// Expect a string for operand Op. If the input is a Value, it is unboxed.
template <unsigned Op>
class StringPolicy : public BoxInputsPolicy
class StringPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Expect a string for operand Op. Else a ToString instruction is inserted.
template <unsigned Op>
class ConvertToStringPolicy : public TypePolicy
class ConvertToStringPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Expect an Int for operand Op. If the input is a Value, it is unboxed.
template <unsigned Op>
class IntPolicy : public BoxInputsPolicy
class IntPolicy MOZ_FINAL : private TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Expect an Int for operand Op. Else a ToInt32 instruction is inserted.
template <unsigned Op>
class ConvertToInt32Policy : public BoxInputsPolicy
class ConvertToInt32Policy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Expect a double for operand Op. If the input is a Value, it is unboxed.
template <unsigned Op>
class DoublePolicy : public BoxInputsPolicy
class DoublePolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Expect a float32 for operand Op. If the input is a Value, it is unboxed.
template <unsigned Op>
class Float32Policy : public BoxInputsPolicy
class Float32Policy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
@ -199,7 +201,7 @@ class Float32Policy : public BoxInputsPolicy
// Expect a float32 OR a double for operand Op, but will prioritize Float32
// if the result type is set as such. If the input is a Value, it is unboxed.
template <unsigned Op>
class FloatingPointPolicy : public TypePolicy
class FloatingPointPolicy MOZ_FINAL : public TypePolicy
{
public:
@ -219,16 +221,16 @@ class FloatingPointPolicy : public TypePolicy
INHERIT_DATA_(PolicyTypeData);
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
template <unsigned Op>
class NoFloatPolicy : public TypePolicy
class NoFloatPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
@ -236,53 +238,53 @@ class NoFloatPolicy : public TypePolicy
// Policy for guarding variadic instructions such as object / array state
// instructions.
template <unsigned FirstOp>
class NoFloatPolicyAfter : public TypePolicy
class NoFloatPolicyAfter MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
// Box objects or strings as an input to a ToDouble instruction.
class ToDoublePolicy : public BoxInputsPolicy
class ToDoublePolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Box objects, strings and undefined as input to a ToInt32 instruction.
class ToInt32Policy : public BoxInputsPolicy
class ToInt32Policy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
// Box objects as input to a ToString instruction.
class ToStringPolicy : public BoxInputsPolicy
class ToStringPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
bool adjustInputs(TempAllocator &alloc, MInstruction *def) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, def);
}
};
template <unsigned Op>
class ObjectPolicy : public BoxInputsPolicy
class ObjectPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
@ -292,19 +294,19 @@ class ObjectPolicy : public BoxInputsPolicy
typedef ObjectPolicy<0> SingleObjectPolicy;
template <unsigned Op>
class BoxPolicy : public BoxInputsPolicy
class BoxPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
// Boxes everything except inputs of type Type.
template <unsigned Op, MIRType Type>
class BoxExceptPolicy : public TypePolicy
class BoxExceptPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
@ -316,21 +318,21 @@ class BoxExceptPolicy : public TypePolicy
// Combine multiple policies.
template <class Lhs, class Rhs>
class MixPolicy : public TypePolicy
class MixPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) {
return Lhs::staticAdjustInputs(alloc, ins) && Rhs::staticAdjustInputs(alloc, ins);
}
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
// Combine three policies.
template <class Policy1, class Policy2, class Policy3>
class Mix3Policy : public TypePolicy
class Mix3Policy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
@ -339,7 +341,7 @@ class Mix3Policy : public TypePolicy
Policy2::staticAdjustInputs(alloc, ins) &&
Policy3::staticAdjustInputs(alloc, ins);
}
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
@ -356,71 +358,77 @@ class Mix4Policy : public TypePolicy
Policy3::staticAdjustInputs(alloc, ins) &&
Policy4::staticAdjustInputs(alloc, ins);
}
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) {
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
class CallSetElementPolicy : public SingleObjectPolicy
class CallSetElementPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
// First operand will be boxed to a Value (except for an object)
// Second operand (if specified) will forcefully be unboxed to an object
class InstanceOfPolicy : public TypePolicy
class InstanceOfPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
class StoreTypedArrayPolicy : public BoxInputsPolicy
class StoreTypedArrayHolePolicy;
class StoreTypedArrayElementStaticPolicy;
class StoreTypedArrayPolicy : public TypePolicy
{
protected:
bool adjustValueInput(TempAllocator &alloc, MInstruction *ins, int arrayType, MDefinition *value, int valueOperand);
private:
static bool adjustValueInput(TempAllocator &alloc, MInstruction *ins, int arrayType, MDefinition *value, int valueOperand);
friend class StoreTypedArrayHolePolicy;
friend class StoreTypedArrayElementStaticPolicy;
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class StoreTypedArrayHolePolicy : public StoreTypedArrayPolicy
class StoreTypedArrayHolePolicy MOZ_FINAL : public StoreTypedArrayPolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class StoreTypedArrayElementStaticPolicy : public StoreTypedArrayPolicy
class StoreTypedArrayElementStaticPolicy MOZ_FINAL : public StoreTypedArrayPolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class StoreUnboxedObjectOrNullPolicy : public TypePolicy
class StoreUnboxedObjectOrNullPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *def);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
};
// Accepts integers and doubles. Everything else is boxed.
class ClampPolicy : public BoxInputsPolicy
class ClampPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
class FilterTypeSetPolicy : public BoxInputsPolicy
class FilterTypeSetPolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
bool adjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE;
};
static inline bool