Bug 1146295: Rename SimdTypeDescr::TYPE_SCALAR into SimdTypeDescr::TypeXn; r=h4writer

This commit is contained in:
Benjamin Bouvier 2015-03-23 11:55:15 +01:00
parent a1c9ed7f61
commit 4e3770de15
8 changed files with 75 additions and 75 deletions

View File

@ -190,7 +190,7 @@ namespace {
// These classes just exist to group together various properties and so on.
class Int32x4Defn {
public:
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_INT32;
static const SimdTypeDescr::Type type = SimdTypeDescr::Int32x4;
static const JSFunctionSpec TypeDescriptorMethods[];
static const JSPropertySpec TypedObjectProperties[];
static const JSFunctionSpec TypedObjectMethods[];
@ -198,7 +198,7 @@ class Int32x4Defn {
};
class Float32x4Defn {
public:
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT32;
static const SimdTypeDescr::Type type = SimdTypeDescr::Float32x4;
static const JSFunctionSpec TypeDescriptorMethods[];
static const JSPropertySpec TypedObjectProperties[];
static const JSFunctionSpec TypedObjectMethods[];
@ -206,7 +206,7 @@ class Float32x4Defn {
};
class Float64x2Defn {
public:
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64;
static const SimdTypeDescr::Type type = SimdTypeDescr::Float64x2;
static const JSFunctionSpec TypeDescriptorMethods[];
static const JSPropertySpec TypedObjectProperties[];
static const JSFunctionSpec TypedObjectMethods[];
@ -391,9 +391,9 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
return false;
switch (descr->type()) {
case SimdTypeDescr::TYPE_INT32: return FillLanes<Int32x4>(cx, result, args);
case SimdTypeDescr::TYPE_FLOAT32: return FillLanes<Float32x4>(cx, result, args);
case SimdTypeDescr::TYPE_FLOAT64: return FillLanes<Float64x2>(cx, result, args);
case SimdTypeDescr::Int32x4: return FillLanes< ::Int32x4>(cx, result, args);
case SimdTypeDescr::Float32x4: return FillLanes< ::Float32x4>(cx, result, args);
case SimdTypeDescr::Float64x2: return FillLanes< ::Float64x2>(cx, result, args);
}
MOZ_CRASH("unexpected SIMD descriptor");

View File

@ -275,7 +275,7 @@ class SIMDObject : public JSObject
struct Float32x4 {
typedef float Elem;
static const unsigned lanes = 4;
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT32;
static const SimdTypeDescr::Type type = SimdTypeDescr::Float32x4;
static TypeDescr &GetTypeDescr(GlobalObject &global) {
return global.float32x4TypeDescr().as<TypeDescr>();
@ -298,7 +298,7 @@ struct Float32x4 {
struct Float64x2 {
typedef double Elem;
static const unsigned lanes = 2;
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64;
static const SimdTypeDescr::Type type = SimdTypeDescr::Float64x2;
static TypeDescr &GetTypeDescr(GlobalObject &global) {
return global.float64x2TypeDescr().as<TypeDescr>();
@ -317,7 +317,7 @@ struct Float64x2 {
struct Int32x4 {
typedef int32_t Elem;
static const unsigned lanes = 4;
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_INT32;
static const SimdTypeDescr::Type type = SimdTypeDescr::Int32x4;
static TypeDescr &GetTypeDescr(GlobalObject &global) {
return global.int32x4TypeDescr().as<TypeDescr>();

View File

@ -331,10 +331,10 @@ class SimdTypeDescr : public ComplexTypeDescr
{
public:
enum Type {
TYPE_INT32 = JS_SIMDTYPEREPR_INT32,
TYPE_FLOAT32 = JS_SIMDTYPEREPR_FLOAT32,
TYPE_FLOAT64 = JS_SIMDTYPEREPR_FLOAT64,
LAST_TYPE = TYPE_FLOAT64
Int32x4 = JS_SIMDTYPEREPR_INT32,
Float32x4 = JS_SIMDTYPEREPR_FLOAT32,
Float64x2 = JS_SIMDTYPEREPR_FLOAT64,
LAST_TYPE = Float64x2
};
static const type::Kind Kind = type::Simd;
@ -352,10 +352,10 @@ class SimdTypeDescr : public ComplexTypeDescr
static bool is(const Value &v);
};
#define JS_FOR_EACH_SIMD_TYPE_REPR(macro_) \
macro_(SimdTypeDescr::TYPE_INT32, int32_t, int32, 4) \
macro_(SimdTypeDescr::TYPE_FLOAT32, float, float32, 4) \
macro_(SimdTypeDescr::TYPE_FLOAT64, double, float64, 2)
#define JS_FOR_EACH_SIMD_TYPE_REPR(macro_) \
macro_(SimdTypeDescr::Int32x4, int32_t, int32, 4) \
macro_(SimdTypeDescr::Float32x4, float, float32, 4) \
macro_(SimdTypeDescr::Float64x2, double, float64, 2)
bool IsTypedObjectClass(const Class *clasp); // Defined below
bool IsTypedObjectArray(JSObject& obj);

View File

@ -4535,10 +4535,10 @@ CodeGenerator::visitSimdUnbox(LSimdUnbox *lir)
js::SimdTypeDescr::Type type;
switch (lir->mir()->type()) {
case MIRType_Int32x4:
type = js::SimdTypeDescr::TYPE_INT32;
type = js::SimdTypeDescr::Int32x4;
break;
case MIRType_Float32x4:
type = js::SimdTypeDescr::TYPE_FLOAT32;
type = js::SimdTypeDescr::Float32x4;
break;
default:
MOZ_CRASH("Unexpected SIMD Type.");

View File

@ -18,8 +18,8 @@ MIRTypeToSimdTypeDescr(MIRType type)
{
MOZ_ASSERT(IsSimdType(type));
switch (type) {
case MIRType_Float32x4: return SimdTypeDescr::TYPE_FLOAT32;
case MIRType_Int32x4: return SimdTypeDescr::TYPE_INT32;
case MIRType_Float32x4: return SimdTypeDescr::Float32x4;
case MIRType_Int32x4: return SimdTypeDescr::Int32x4;
default: break;
}
MOZ_CRASH("unexpected MIRType");

View File

@ -10254,9 +10254,9 @@ MIRType
IonBuilder::SimdTypeDescrToMIRType(SimdTypeDescr::Type type)
{
switch (type) {
case SimdTypeDescr::TYPE_INT32: return MIRType_Int32x4;
case SimdTypeDescr::TYPE_FLOAT32: return MIRType_Float32x4;
case SimdTypeDescr::TYPE_FLOAT64: return MIRType_Undefined;
case SimdTypeDescr::Int32x4: return MIRType_Int32x4;
case SimdTypeDescr::Float32x4: return MIRType_Float32x4;
case SimdTypeDescr::Float64x2: return MIRType_Undefined;
}
MOZ_CRASH("unimplemented MIR type for a SimdTypeDescr::Type");
}

View File

@ -263,12 +263,12 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target)
#define INLINE_FLOAT32X4_SIMD_ARITH_(OP) \
if (native == js::simd_float32x4_##OP) \
return inlineBinarySimd<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
SimdTypeDescr::TYPE_FLOAT32);
SimdTypeDescr::Float32x4);
#define INLINE_INT32X4_SIMD_ARITH_(OP) \
if (native == js::simd_int32x4_##OP) \
return inlineBinarySimd<MSimdBinaryArith>(callInfo, native, MSimdBinaryArith::Op_##OP, \
SimdTypeDescr::TYPE_INT32);
SimdTypeDescr::Int32x4);
ARITH_COMMONX4_SIMD_OP(INLINE_INT32X4_SIMD_ARITH_)
ARITH_COMMONX4_SIMD_OP(INLINE_FLOAT32X4_SIMD_ARITH_)
@ -279,28 +279,28 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target)
#define INLINE_SIMD_BITWISE_(OP) \
if (native == js::simd_int32x4_##OP) \
return inlineBinarySimd<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
SimdTypeDescr::TYPE_INT32); \
SimdTypeDescr::Int32x4); \
if (native == js::simd_float32x4_##OP) \
return inlineBinarySimd<MSimdBinaryBitwise>(callInfo, native, MSimdBinaryBitwise::OP##_, \
SimdTypeDescr::TYPE_FLOAT32);
SimdTypeDescr::Float32x4);
BITWISE_COMMONX4_SIMD_OP(INLINE_SIMD_BITWISE_)
#undef INLINE_SIMD_BITWISE_
#define INLINE_SIMD_COMPARISON_(OP) \
if (native == js::simd_int32x4_##OP) \
return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::TYPE_INT32); \
return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Int32x4); \
if (native == js::simd_float32x4_##OP) \
return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::TYPE_FLOAT32);
return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Float32x4);
COMP_COMMONX4_TO_INT32X4_SIMD_OP(INLINE_SIMD_COMPARISON_)
#undef INLINE_SIMD_COMPARISON_
#define INLINE_SIMD_SETTER_(LANE) \
if (native == js::simd_int32x4_with##LANE) \
return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::TYPE_INT32); \
return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::Int32x4); \
if (native == js::simd_float32x4_with##LANE) \
return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::Float32x4);
INLINE_SIMD_SETTER_(X)
INLINE_SIMD_SETTER_(Y)
@ -309,94 +309,94 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target)
#undef INLINE_SIMD_SETTER_
if (native == js::simd_int32x4_not)
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::TYPE_INT32);
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_neg)
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::TYPE_INT32);
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::Int32x4);
#define INLINE_SIMD_FLOAT32X4_UNARY_(OP) \
if (native == js::simd_float32x4_##OP) \
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::TYPE_FLOAT32);
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::Float32x4);
UNARY_ARITH_FLOAT32X4_SIMD_OP(INLINE_SIMD_FLOAT32X4_UNARY_)
INLINE_SIMD_FLOAT32X4_UNARY_(neg)
#undef INLINE_SIMD_FLOAT32X4_UNARY_
if (native == js::simd_float32x4_not)
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::TYPE_FLOAT32);
return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Float32x4);
typedef bool IsCast;
if (native == js::simd_float32x4_fromInt32x4)
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::TYPE_INT32, SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Int32x4, SimdTypeDescr::Float32x4);
if (native == js::simd_int32x4_fromFloat32x4)
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::TYPE_FLOAT32, SimdTypeDescr::TYPE_INT32);
return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4);
if (native == js::simd_float32x4_fromInt32x4Bits)
return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::TYPE_INT32, SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::Int32x4, SimdTypeDescr::Float32x4);
if (native == js::simd_int32x4_fromFloat32x4Bits)
return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::TYPE_FLOAT32, SimdTypeDescr::TYPE_INT32);
return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_splat)
return inlineSimdSplat(callInfo, native, SimdTypeDescr::TYPE_INT32);
return inlineSimdSplat(callInfo, native, SimdTypeDescr::Int32x4);
if (native == js::simd_float32x4_splat)
return inlineSimdSplat(callInfo, native, SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdSplat(callInfo, native, SimdTypeDescr::Float32x4);
if (native == js::simd_int32x4_check)
return inlineSimdCheck(callInfo, native, SimdTypeDescr::TYPE_INT32);
return inlineSimdCheck(callInfo, native, SimdTypeDescr::Int32x4);
if (native == js::simd_float32x4_check)
return inlineSimdCheck(callInfo, native, SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdCheck(callInfo, native, SimdTypeDescr::Float32x4);
typedef bool IsElementWise;
if (native == js::simd_int32x4_select)
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::TYPE_INT32);
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Int32x4);
if (native == js::simd_int32x4_bitselect)
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::TYPE_INT32);
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Int32x4);
if (native == js::simd_float32x4_select)
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Float32x4);
if (native == js::simd_float32x4_bitselect)
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::TYPE_FLOAT32);
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Float32x4);
if (native == js::simd_int32x4_swizzle)
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_INT32, 1, 4);
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Int32x4, 1, 4);
if (native == js::simd_float32x4_swizzle)
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1, 4);
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Float32x4, 1, 4);
if (native == js::simd_int32x4_shuffle)
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_INT32, 2, 4);
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Int32x4, 2, 4);
if (native == js::simd_float32x4_shuffle)
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2, 4);
return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Float32x4, 2, 4);
if (native == js::simd_int32x4_load)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 4);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 4);
if (native == js::simd_int32x4_loadX)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 1);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 1);
if (native == js::simd_int32x4_loadXY)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 2);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 2);
if (native == js::simd_int32x4_loadXYZ)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 3);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 3);
if (native == js::simd_float32x4_load)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 4);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 4);
if (native == js::simd_float32x4_loadX)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 1);
if (native == js::simd_float32x4_loadXY)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 2);
if (native == js::simd_float32x4_loadXYZ)
return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 3);
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 3);
if (native == js::simd_int32x4_store)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 4);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 4);
if (native == js::simd_int32x4_storeX)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 1);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 1);
if (native == js::simd_int32x4_storeXY)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 2);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 2);
if (native == js::simd_int32x4_storeXYZ)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 3);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 3);
if (native == js::simd_float32x4_store)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 4);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 4);
if (native == js::simd_float32x4_storeX)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 1);
if (native == js::simd_float32x4_storeXY)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 2);
if (native == js::simd_float32x4_storeXYZ)
return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 3);
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 3);
return InliningStatus_NotInlined;
}
@ -3116,7 +3116,7 @@ IonBuilder::inlineCompSimd(CallInfo &callInfo, JSNative native, MSimdBinaryComp:
SimdTypeDescr::Type compType)
{
InlineTypedObject *templateObj = nullptr;
if (!checkInlineSimd(callInfo, native, SimdTypeDescr::TYPE_INT32, 2, &templateObj))
if (!checkInlineSimd(callInfo, native, SimdTypeDescr::Int32x4, 2, &templateObj))
return InliningStatus_NotInlined;
// If the type of any of the arguments is neither a SIMD type, an Object
@ -3251,9 +3251,9 @@ static Scalar::Type
SimdTypeToScalarType(SimdTypeDescr::Type type)
{
switch (type) {
case SimdTypeDescr::TYPE_FLOAT32: return Scalar::Float32x4;
case SimdTypeDescr::TYPE_INT32: return Scalar::Int32x4;
case SimdTypeDescr::TYPE_FLOAT64: break;
case SimdTypeDescr::Float32x4: return Scalar::Float32x4;
case SimdTypeDescr::Int32x4: return Scalar::Int32x4;
case SimdTypeDescr::Float64x2: break;
}
MOZ_CRASH("unexpected simd type");
}

View File

@ -1338,17 +1338,17 @@ RSimdBox::recover(JSContext *cx, SnapshotIterator &iter) const
MOZ_ASSERT(iter.allocationReadable(a));
const FloatRegisters::RegisterContent *raw = iter.floatAllocationPointer(a);
switch (SimdTypeDescr::Type(type_)) {
case SimdTypeDescr::TYPE_INT32:
case SimdTypeDescr::Int32x4:
MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG,
a.fpuReg().isInt32x4());
resultObject = js::CreateSimd<Int32x4>(cx, (const Int32x4::Elem *) raw);
break;
case SimdTypeDescr::TYPE_FLOAT32:
case SimdTypeDescr::Float32x4:
MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG,
a.fpuReg().isFloat32x4());
resultObject = js::CreateSimd<Float32x4>(cx, (const Float32x4::Elem *) raw);
break;
case SimdTypeDescr::TYPE_FLOAT64:
case SimdTypeDescr::Float64x2:
MOZ_CRASH("NYI, RSimdBox of Float64x2");
break;
}