Bug 1075967 - Inline ToInteger, if TypeSet contains multiple optimizable types. r=h4writer

This commit is contained in:
Johannes Schulte 2014-09-30 21:21:44 +02:00
parent 5f9bc27495
commit a26dae6439
3 changed files with 32 additions and 3 deletions

View File

@ -533,6 +533,16 @@ IsSimdType(MIRType type)
return type == MIRType_Int32x4 || type == MIRType_Float32x4;
};
static inline bool
IsMagicType(MIRType type)
{
return type == MIRType_MagicHole ||
type == MIRType_MagicOptimizedOut ||
type == MIRType_MagicIsConstructing ||
type == MIRType_MagicOptimizedArguments ||
type == MIRType_MagicUninitializedLexical;
}
// Returns the number of vector elements (hereby called "length") for a given
// SIMD kind. It is the Y part of the name "Foo x Y".
static inline unsigned

View File

@ -2073,11 +2073,20 @@ IonBuilder::inlineToInteger(CallInfo &callInfo)
if (callInfo.argc() != 1 || callInfo.constructing())
return InliningStatus_NotInlined;
MIRType type = callInfo.getArg(0)->type();
MDefinition *input = callInfo.getArg(0);
// Only optimize cases where input is number, null, or boolean
if (!IsNumberType(type) && type != MIRType_Null && type != MIRType_Boolean)
// Only optimize cases where input contains only number, null or boolean
if (input->mightBeType(MIRType_Object) ||
input->mightBeType(MIRType_String) ||
input->mightBeType(MIRType_Symbol) ||
input->mightBeType(MIRType_Undefined) ||
input->mightBeMagicType())
{
return InliningStatus_NotInlined;
}
MOZ_ASSERT(input->type() == MIRType_Value || input->type() == MIRType_Null ||
input->type() == MIRType_Boolean || IsNumberType(input->type()));
// Only optimize cases where output is int32
if (getInlineReturnType() != MIRType_Int32)

View File

@ -596,6 +596,16 @@ class MDefinition : public MNode
return !resultTypeSet() || resultTypeSet()->mightBeMIRType(type);
}
bool mightBeMagicType() const {
if (IsMagicType(type()))
return true;
if (MIRType_Value != type())
return false;
return !resultTypeSet() || resultTypeSet()->hasType(types::Type::MagicArgType());
}
// Float32 specialization operations (see big comment in IonAnalysis before the Float32
// specialization algorithm).
virtual bool isFloat32Commutative() const { return false; }