--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -3054,29 +3054,29 @@ IonBuilder::inlineConstructTypedObject(C
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdBool32x4(CallInfo& callInfo, JSNative native)
{
#define INLINE_SIMD_BITWISE_(OP) \
if (native == js::simd_bool32x4_##OP) \
- return inlineBinarySimd<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
+ return inlineSimdBinary<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
SimdTypeDescr::Bool32x4);
FOREACH_BITWISE_SIMD_BINOP(INLINE_SIMD_BITWISE_)
#undef INLINE_SIMD_BITWISE_
if (native == js::simd_bool32x4_extractLane)
return inlineSimdExtractLane(callInfo, native, SimdTypeDescr::Bool32x4);
if (native == js::simd_bool32x4_replaceLane)
return inlineSimdReplaceLane(callInfo, native, SimdTypeDescr::Bool32x4);
if (native == js::simd_bool32x4_not)
- return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Bool32x4);
+ return inlineSimdUnary(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Bool32x4);
if (native == js::simd_bool32x4_splat)
return inlineSimdSplat(callInfo, native, SimdTypeDescr::Bool32x4);
if (native == js::simd_bool32x4_check)
return inlineSimdCheck(callInfo, native, SimdTypeDescr::Bool32x4);
if (native == js::simd_bool32x4_allTrue)
return inlineSimdAnyAllTrue(callInfo, true, native);
@@ -3086,55 +3086,55 @@ IonBuilder::inlineSimdBool32x4(CallInfo&
return InliningStatus_NotInlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdInt32x4(CallInfo& callInfo, JSNative native)
{
#define INLINE_INT32X4_SIMD_ARITH_(OP) \
if (native == js::simd_int32x4_##OP) \
- return inlineBinarySimd<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
+ return inlineSimdBinary<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
SimdTypeDescr::Int32x4);
FOREACH_NUMERIC_SIMD_BINOP(INLINE_INT32X4_SIMD_ARITH_)
#undef INLINE_INT32X4_SIMD_ARITH_
#define INLINE_SIMD_BITWISE_(OP) \
if (native == js::simd_int32x4_##OP) \
- return inlineBinarySimd<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
+ return inlineSimdBinary<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
SimdTypeDescr::Int32x4);
FOREACH_BITWISE_SIMD_BINOP(INLINE_SIMD_BITWISE_)
#undef INLINE_SIMD_BITWISE_
if (native == js::simd_int32x4_shiftLeftByScalar)
- return inlineBinarySimd<MSimdShift>(callInfo, native, MSimdShift::lsh, SimdTypeDescr::Int32x4);
+ return inlineSimdBinary<MSimdShift>(callInfo, native, MSimdShift::lsh, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_shiftRightArithmeticByScalar ||
native == js::simd_int32x4_shiftRightByScalar) {
- return inlineBinarySimd<MSimdShift>(callInfo, native, MSimdShift::rsh, SimdTypeDescr::Int32x4);
+ return inlineSimdBinary<MSimdShift>(callInfo, native, MSimdShift::rsh, SimdTypeDescr::Int32x4);
}
if (native == js::simd_int32x4_shiftRightLogicalByScalar)
- return inlineBinarySimd<MSimdShift>(callInfo, native, MSimdShift::ursh, SimdTypeDescr::Int32x4);
+ return inlineSimdBinary<MSimdShift>(callInfo, native, MSimdShift::ursh, SimdTypeDescr::Int32x4);
#define INLINE_SIMD_COMPARISON_(OP) \
if (native == js::simd_int32x4_##OP) \
- return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Int32x4);
+ return inlineSimdComp(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Int32x4);
FOREACH_COMP_SIMD_OP(INLINE_SIMD_COMPARISON_)
#undef INLINE_SIMD_COMPARISON_
if (native == js::simd_int32x4_extractLane)
return inlineSimdExtractLane(callInfo, native, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_replaceLane)
return inlineSimdReplaceLane(callInfo, native, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_not)
- return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Int32x4);
+ return inlineSimdUnary(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_neg)
- return inlineUnarySimd(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::Int32x4);
+ return inlineSimdUnary(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::Int32x4);
typedef bool IsCast;
if (native == js::simd_int32x4_fromFloat32x4)
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_fromFloat32x4Bits)
return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_splat)
@@ -3173,38 +3173,38 @@ IonBuilder::inlineSimdInt32x4(CallInfo&
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdFloat32x4(CallInfo& callInfo, JSNative native)
{
// Simd functions
#define INLINE_FLOAT32X4_SIMD_ARITH_(OP) \
if (native == js::simd_float32x4_##OP) \
- return inlineBinarySimd<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
+ return inlineSimdBinary<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
SimdTypeDescr::Float32x4);
FOREACH_NUMERIC_SIMD_BINOP(INLINE_FLOAT32X4_SIMD_ARITH_)
FOREACH_FLOAT_SIMD_BINOP(INLINE_FLOAT32X4_SIMD_ARITH_)
#undef INLINE_FLOAT32X4_SIMD_ARITH_
#define INLINE_SIMD_COMPARISON_(OP) \
if (native == js::simd_float32x4_##OP) \
- return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Float32x4);
+ return inlineSimdComp(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Float32x4);
FOREACH_COMP_SIMD_OP(INLINE_SIMD_COMPARISON_)
#undef INLINE_SIMD_COMPARISON_
if (native == js::simd_float32x4_extractLane)
return inlineSimdExtractLane(callInfo, native, SimdTypeDescr::Float32x4);
if (native == js::simd_float32x4_replaceLane)
return inlineSimdReplaceLane(callInfo, native, SimdTypeDescr::Float32x4);
#define INLINE_SIMD_FLOAT32X4_UNARY_(OP) \
if (native == js::simd_float32x4_##OP) \
- return inlineUnarySimd(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::Float32x4);
+ return inlineSimdUnary(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::Float32x4);
FOREACH_FLOAT_SIMD_UNOP(INLINE_SIMD_FLOAT32X4_UNARY_)
INLINE_SIMD_FLOAT32X4_UNARY_(neg)
#undef INLINE_SIMD_FLOAT32X4_UNARY_
typedef bool IsCast;
if (native == js::simd_float32x4_fromInt32x4)
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Int32x4, SimdTypeDescr::Float32x4);
@@ -3334,17 +3334,17 @@ IonBuilder::inlineConstructSimdObject(Ca
current->add(obj);
current->push(obj);
callInfo.setImplicitlyUsedUnchecked();
return InliningStatus_Inlined;
}
bool
-IonBuilder::checkInlineSimd(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
+IonBuilder::canInlineSimd(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
unsigned numArgs, InlineTypedObject** templateObj)
{
if (callInfo.argc() != numArgs)
return false;
JSObject* templateObject = inspector->getTemplateObjectForNative(pc, native);
if (!templateObject)
return false;;
@@ -3365,125 +3365,125 @@ IonBuilder::boxSimd(CallInfo& callInfo,
current->push(obj);
callInfo.setImplicitlyUsedUnchecked();
return InliningStatus_Inlined;
}
template<typename T>
IonBuilder::InliningStatus
-IonBuilder::inlineBinarySimd(CallInfo& callInfo, JSNative native, typename T::Operation op,
+IonBuilder::inlineSimdBinary(CallInfo& callInfo, JSNative native, typename T::Operation op,
SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 2, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 2, &templateObj))
return InliningStatus_NotInlined;
// If the type of any of the arguments is neither a SIMD type, an Object
// type, or a Value, then the applyTypes phase will add a fallible box &
// unbox sequence. This does not matter much as all binary SIMD
// instructions are supposed to produce a TypeError when they're called
// with non SIMD-arguments.
MIRType mirType = SimdTypeDescrToMIRType(type);
T* ins = T::New(alloc(), callInfo.getArg(0), callInfo.getArg(1), op, mirType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
-IonBuilder::inlineCompSimd(CallInfo& callInfo, JSNative native, MSimdBinaryComp::Operation op,
+IonBuilder::inlineSimdComp(CallInfo& callInfo, JSNative native, MSimdBinaryComp::Operation op,
SimdTypeDescr::Type compType)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, SimdTypeDescr::Bool32x4, 2, &templateObj))
+ if (!canInlineSimd(callInfo, native, SimdTypeDescr::Bool32x4, 2, &templateObj))
return InliningStatus_NotInlined;
// If the type of any of the arguments is neither a SIMD type, an Object
// type, or a Value, then the applyTypes phase will add a fallible box &
// unbox sequence. This does not matter much as all binary SIMD
// instructions are supposed to produce a TypeError when they're called
// with non SIMD-arguments.
MIRType mirType = SimdTypeDescrToMIRType(compType);
MSimdBinaryComp* ins = MSimdBinaryComp::New(alloc(), callInfo.getArg(0), callInfo.getArg(1), op, mirType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
-IonBuilder::inlineUnarySimd(CallInfo& callInfo, JSNative native, MSimdUnaryArith::Operation op,
+IonBuilder::inlineSimdUnary(CallInfo& callInfo, JSNative native, MSimdUnaryArith::Operation op,
SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 1, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 1, &templateObj))
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MIRType mirType = SimdTypeDescrToMIRType(type);
MSimdUnaryArith* ins = MSimdUnaryArith::New(alloc(), callInfo.getArg(0), op, mirType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdSplat(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 1, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 1, &templateObj))
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MIRType mirType = SimdTypeDescrToMIRType(type);
MDefinition* arg = callInfo.getArg(0);
// Convert to 0 / -1 before splatting a boolean lane.
if (SimdTypeToLaneType(mirType) == MIRType_Boolean)
arg = convertToBooleanSimdLane(arg);
MSimdSplatX4* ins = MSimdSplatX4::New(alloc(), arg, mirType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdExtractLane(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 2, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 2, &templateObj))
return InliningStatus_NotInlined;
MDefinition* arg = callInfo.getArg(1);
if (!arg->isConstantValue() || arg->type() != MIRType_Int32)
return InliningStatus_NotInlined;
int32_t lane = callInfo.getArg(1)->constantValue().toInt32();
if (lane < 0 || lane >= 4)
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MIRType vecType = SimdTypeDescrToMIRType(type);
MIRType laneType = SimdTypeToLaneType(vecType);
MSimdExtractElement* ins = MSimdExtractElement::New(alloc(), callInfo.getArg(0),
vecType, laneType, SimdLane(lane));
current->add(ins);
current->push(ins);
callInfo.setImplicitlyUsedUnchecked();
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdReplaceLane(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 3, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 3, &templateObj))
return InliningStatus_NotInlined;
MDefinition* arg = callInfo.getArg(1);
if (!arg->isConstantValue() || arg->type() != MIRType_Int32)
return InliningStatus_NotInlined;
int32_t lane = arg->constantValue().toInt32();
if (lane < 0 || lane >= 4)
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MIRType mirType = SimdTypeDescrToMIRType(type);
// Convert to 0 / -1 before inserting a boolean lane.
MDefinition* value = callInfo.getArg(2);
if (SimdTypeToLaneType(mirType) == MIRType_Boolean)
value = convertToBooleanSimdLane(value);
MSimdInsertElement* ins =
@@ -3491,67 +3491,67 @@ IonBuilder::inlineSimdReplaceLane(CallIn
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdConvert(CallInfo& callInfo, JSNative native, bool isCast,
SimdTypeDescr::Type from, SimdTypeDescr::Type to)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, to, 1, &templateObj))
+ if (!canInlineSimd(callInfo, native, to, 1, &templateObj))
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MInstruction* ins;
MIRType fromType = SimdTypeDescrToMIRType(from);
MIRType toType = SimdTypeDescrToMIRType(to);
if (isCast)
ins = MSimdReinterpretCast::New(alloc(), callInfo.getArg(0), fromType, toType);
else
ins = MSimdConvert::New(alloc(), callInfo.getArg(0), fromType, toType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdSelect(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 3, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 3, &templateObj))
return InliningStatus_NotInlined;
- // See comment in inlineBinarySimd
+ // See comment in inlineSimdBinary
MIRType mirType = SimdTypeDescrToMIRType(type);
MSimdSelect* ins = MSimdSelect::New(alloc(), callInfo.getArg(0), callInfo.getArg(1),
callInfo.getArg(2), mirType);
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdCheck(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 1, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 1, &templateObj))
return InliningStatus_NotInlined;
MIRType mirType = SimdTypeDescrToMIRType(type);
MSimdUnbox* unbox = MSimdUnbox::New(alloc(), callInfo.getArg(0), mirType);
current->add(unbox);
current->push(callInfo.getArg(0));
callInfo.setImplicitlyUsedUnchecked();
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdShuffle(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
unsigned numVectors, unsigned numLanes)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, numVectors + numLanes, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, numVectors + numLanes, &templateObj))
return InliningStatus_NotInlined;
MIRType mirType = SimdTypeDescrToMIRType(type);
MSimdGeneralShuffle* ins = MSimdGeneralShuffle::New(alloc(), numVectors, numLanes, mirType);
if (!ins->init(alloc()))
return InliningStatus_Error;
@@ -3562,17 +3562,17 @@ IonBuilder::inlineSimdShuffle(CallInfo&
return boxSimd(callInfo, ins, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdAnyAllTrue(CallInfo& callInfo, bool IsAllTrue, JSNative native)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, SimdTypeDescr::Bool32x4, 1, &templateObj))
+ if (!canInlineSimd(callInfo, native, SimdTypeDescr::Bool32x4, 1, &templateObj))
return InliningStatus_NotInlined;
MUnaryInstruction* ins;
if (IsAllTrue)
ins = MSimdAllTrue::New(alloc(), callInfo.getArg(0), MIRType_Bool32x4);
else
ins = MSimdAnyTrue::New(alloc(), callInfo.getArg(0), MIRType_Bool32x4);
@@ -3650,17 +3650,17 @@ IonBuilder::prepareForSimdLoadStore(Call
return true;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdLoad(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
unsigned numElems)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 2, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 2, &templateObj))
return InliningStatus_NotInlined;
Scalar::Type simdType = SimdTypeToArrayElementType(type);
MDefinition* index = nullptr;
MInstruction* elements = nullptr;
Scalar::Type arrayType;
if (!prepareForSimdLoadStore(callInfo, simdType, &elements, &index, &arrayType))
@@ -3673,17 +3673,17 @@ IonBuilder::inlineSimdLoad(CallInfo& cal
return boxSimd(callInfo, load, templateObj);
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
unsigned numElems)
{
InlineTypedObject* templateObj = nullptr;
- if (!checkInlineSimd(callInfo, native, type, 3, &templateObj))
+ if (!canInlineSimd(callInfo, native, type, 3, &templateObj))
return InliningStatus_NotInlined;
Scalar::Type simdType = SimdTypeToArrayElementType(type);
MDefinition* index = nullptr;
MInstruction* elements = nullptr;
Scalar::Type arrayType;
if (!prepareForSimdLoadStore(callInfo, simdType, &elements, &index, &arrayType))