зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 232c0f30075c (bug 1031203) for j1 test failures
This commit is contained in:
Родитель
592726d322
Коммит
619828717a
|
@ -463,7 +463,7 @@ struct JSClass {
|
|||
// the beginning of every global object's slots for use by the
|
||||
// application.
|
||||
#define JSCLASS_GLOBAL_APPLICATION_SLOTS 4
|
||||
#define JSCLASS_GLOBAL_SLOT_COUNT (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 3 + 31)
|
||||
#define JSCLASS_GLOBAL_SLOT_COUNT (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 3 + 30)
|
||||
#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
|
||||
(JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n)))
|
||||
#define JSCLASS_GLOBAL_FLAGS \
|
||||
|
|
|
@ -30,7 +30,6 @@ using mozilla::FloorLog2;
|
|||
|
||||
namespace js {
|
||||
extern const JSFunctionSpec Float32x4Methods[];
|
||||
extern const JSFunctionSpec Float64x2Methods[];
|
||||
extern const JSFunctionSpec Int32x4Methods[];
|
||||
}
|
||||
|
||||
|
@ -65,7 +64,6 @@ js::IsVectorObject(HandleValue v)
|
|||
|
||||
template bool js::IsVectorObject<Int32x4>(HandleValue v);
|
||||
template bool js::IsVectorObject<Float32x4>(HandleValue v);
|
||||
template bool js::IsVectorObject<Float64x2>(HandleValue v);
|
||||
|
||||
template<typename V>
|
||||
bool
|
||||
|
@ -125,9 +123,6 @@ static bool type##Lane##lane(JSContext *cx, unsigned argc, Value *vp) { \
|
|||
FOUR_LANES_ACCESSOR(Int32x4);
|
||||
FOUR_LANES_ACCESSOR(Float32x4);
|
||||
#undef FOUR_LANES_ACCESSOR
|
||||
|
||||
LANE_ACCESSOR(Float64x2, 0);
|
||||
LANE_ACCESSOR(Float64x2, 1);
|
||||
#undef LANE_ACCESSOR
|
||||
|
||||
template<typename SimdType>
|
||||
|
@ -153,11 +148,11 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
Elem *data = reinterpret_cast<Elem *>(typedObj.typedMem());
|
||||
int32_t lanes = SimdTypeDescr::lanes(descr.as<SimdTypeDescr>().type());
|
||||
int32_t result = 0;
|
||||
for (int32_t i = 0; i < lanes; i++)
|
||||
result |= (data[i] < 0.0 ? 1 : 0) << i;
|
||||
|
||||
int32_t mx = data[0] < 0.0 ? 1 : 0;
|
||||
int32_t my = data[1] < 0.0 ? 1 : 0;
|
||||
int32_t mz = data[2] < 0.0 ? 1 : 0;
|
||||
int32_t mw = data[3] < 0.0 ? 1 : 0;
|
||||
int32_t result = mx | my << 1 | mz << 2 | mw << 3;
|
||||
args.rval().setInt32(result);
|
||||
return true;
|
||||
}
|
||||
|
@ -167,7 +162,6 @@ static bool type##SignMask(JSContext *cx, unsigned argc, Value *vp) { \
|
|||
return SignMask<type>(cx, argc, vp); \
|
||||
}
|
||||
SIGN_MASK(Float32x4);
|
||||
SIGN_MASK(Float64x2);
|
||||
SIGN_MASK(Int32x4);
|
||||
#undef SIGN_MASK
|
||||
|
||||
|
@ -201,13 +195,6 @@ class Float32x4Defn {
|
|||
static const JSPropertySpec TypedObjectProperties[];
|
||||
static const JSFunctionSpec TypedObjectMethods[];
|
||||
};
|
||||
class Float64x2Defn {
|
||||
public:
|
||||
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64;
|
||||
static const JSFunctionSpec TypeDescriptorMethods[];
|
||||
static const JSPropertySpec TypedObjectProperties[];
|
||||
static const JSFunctionSpec TypedObjectMethods[];
|
||||
};
|
||||
} // namespace js
|
||||
|
||||
const JSFunctionSpec js::Float32x4Defn::TypeDescriptorMethods[] = {
|
||||
|
@ -231,25 +218,6 @@ const JSFunctionSpec js::Float32x4Defn::TypedObjectMethods[] = {
|
|||
JS_FS_END
|
||||
};
|
||||
|
||||
const JSFunctionSpec js::Float64x2Defn::TypeDescriptorMethods[] = {
|
||||
JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
|
||||
JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0),
|
||||
JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
const JSPropertySpec js::Float64x2Defn::TypedObjectProperties[] = {
|
||||
JS_PSG("x", Float64x2Lane0, JSPROP_PERMANENT),
|
||||
JS_PSG("y", Float64x2Lane1, JSPROP_PERMANENT),
|
||||
JS_PSG("signMask", Float64x2SignMask, JSPROP_PERMANENT),
|
||||
JS_PS_END
|
||||
};
|
||||
|
||||
const JSFunctionSpec js::Float64x2Defn::TypedObjectMethods[] = {
|
||||
JS_SELF_HOSTED_FN("toSource", "SimdToSource", 0, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
const JSFunctionSpec js::Int32x4Defn::TypeDescriptorMethods[] = {
|
||||
JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
|
||||
JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0),
|
||||
|
@ -294,7 +262,6 @@ CreateSimdClass(JSContext *cx, Handle<GlobalObject*> global, HandlePropertyName
|
|||
typeDescr->initReservedSlot(JS_DESCR_SLOT_SIZE, Int32Value(SimdTypeDescr::size(type)));
|
||||
typeDescr->initReservedSlot(JS_DESCR_SLOT_OPAQUE, BooleanValue(false));
|
||||
typeDescr->initReservedSlot(JS_DESCR_SLOT_TYPE, Int32Value(T::type));
|
||||
typeDescr->initReservedSlot(JS_DESCR_SLOT_LANES, Int32Value(SimdTypeDescr::lanes(type)));
|
||||
|
||||
if (!CreateUserSizeAndAlignmentProperties(cx, typeDescr))
|
||||
return nullptr;
|
||||
|
@ -325,23 +292,11 @@ CreateSimdClass(JSContext *cx, Handle<GlobalObject*> global, HandlePropertyName
|
|||
return typeDescr;
|
||||
}
|
||||
|
||||
const char*
|
||||
SimdTypeToMinimumLanesNumber(SimdTypeDescr &descr) {
|
||||
switch (descr.type()) {
|
||||
case SimdTypeDescr::TYPE_INT32:
|
||||
case SimdTypeDescr::TYPE_FLOAT32:
|
||||
return "3";
|
||||
case SimdTypeDescr::TYPE_FLOAT64:
|
||||
return "1";
|
||||
}
|
||||
MOZ_CRASH("Unexpected SIMD type description.");
|
||||
}
|
||||
|
||||
bool
|
||||
SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
const unsigned lanes = SimdTypeDescr::lanes(args.callee().as<SimdTypeDescr>().type());
|
||||
const unsigned LANES = 4;
|
||||
|
||||
Rooted<SimdTypeDescr*> descr(cx, &args.callee().as<SimdTypeDescr>());
|
||||
if (args.length() == 1) {
|
||||
|
@ -355,9 +310,9 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (args.length() < lanes) {
|
||||
if (args.length() < LANES) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
args.callee().getClass()->name, SimdTypeToMinimumLanesNumber(*descr), "s");
|
||||
args.callee().getClass()->name, "3", "s");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -382,14 +337,6 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SimdTypeDescr::TYPE_FLOAT64: {
|
||||
double *mem = reinterpret_cast<double*>(result->typedMem());
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
if (!ToNumber(cx, args[i], &mem[i]))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
args.rval().setObject(*result);
|
||||
return true;
|
||||
|
@ -440,23 +387,6 @@ SIMDObject::initClass(JSContext *cx, Handle<GlobalObject *> global)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// float64x2
|
||||
RootedObject float64x2Object(cx);
|
||||
float64x2Object = CreateSimdClass<Float64x2Defn>(cx, global,
|
||||
cx->names().float64x2);
|
||||
if (!float64x2Object)
|
||||
return nullptr;
|
||||
|
||||
// Define float64x2 functions and install as a property of the SIMD object.
|
||||
RootedValue float64x2Value(cx, ObjectValue(*float64x2Object));
|
||||
if (!JS_DefineFunctions(cx, float64x2Object, Float64x2Methods) ||
|
||||
!JSObject::defineProperty(cx, SIMD, cx->names().float64x2,
|
||||
float64x2Value, nullptr, nullptr,
|
||||
JSPROP_READONLY | JSPROP_PERMANENT))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// int32x4
|
||||
RootedObject int32x4Object(cx);
|
||||
int32x4Object = CreateSimdClass<Int32x4Defn>(cx, global,
|
||||
|
@ -482,7 +412,6 @@ SIMDObject::initClass(JSContext *cx, Handle<GlobalObject *> global)
|
|||
|
||||
global->setConstructor(JSProto_SIMD, SIMDValue);
|
||||
global->setFloat32x4TypeDescr(*float32x4Object);
|
||||
global->setFloat64x2TypeDescr(*float64x2Object);
|
||||
global->setInt32x4TypeDescr(*int32x4Object);
|
||||
return SIMD;
|
||||
}
|
||||
|
@ -513,7 +442,6 @@ js::CreateSimd(JSContext *cx, typename V::Elem *data)
|
|||
}
|
||||
|
||||
template JSObject *js::CreateSimd<Float32x4>(JSContext *cx, Float32x4::Elem *data);
|
||||
template JSObject *js::CreateSimd<Float64x2>(JSContext *cx, Float64x2::Elem *data);
|
||||
template JSObject *js::CreateSimd<Int32x4>(JSContext *cx, Int32x4::Elem *data);
|
||||
|
||||
namespace js {
|
||||
|
@ -840,10 +768,8 @@ CompareFunc(JSContext *cx, unsigned argc, Value *vp)
|
|||
int32_t result[Int32x4::lanes];
|
||||
InElem *left = TypedObjectMemory<InElem *>(args[0]);
|
||||
InElem *right = TypedObjectMemory<InElem *>(args[1]);
|
||||
for (unsigned i = 0; i < Int32x4::lanes; i++) {
|
||||
unsigned j = (i * In::lanes) / Int32x4::lanes;
|
||||
result[i] = Op<InElem>::apply(left[j], right[j]);
|
||||
}
|
||||
for (unsigned i = 0; i < Int32x4::lanes; i++)
|
||||
result[i] = Op<InElem>::apply(left[i], right[i]);
|
||||
|
||||
return StoreResult<Int32x4>(cx, args, result);
|
||||
}
|
||||
|
@ -862,8 +788,7 @@ FuncConvert(JSContext *cx, unsigned argc, Value *vp)
|
|||
Elem *val = TypedObjectMemory<Elem *>(args[0]);
|
||||
RetElem result[Vret::lanes];
|
||||
for (unsigned i = 0; i < Vret::lanes; i++)
|
||||
result[i] = i < V::lanes ? ConvertScalar<RetElem>(val[i]) : 0;
|
||||
|
||||
result[i] = ConvertScalar<RetElem>(val[i]);
|
||||
return StoreResult<Vret>(cx, args, result);
|
||||
}
|
||||
|
||||
|
@ -934,40 +859,35 @@ Int32x4Bool(JSContext *cx, unsigned argc, Value *vp)
|
|||
return StoreResult<Int32x4>(cx, args, result);
|
||||
}
|
||||
|
||||
template<typename In>
|
||||
static bool
|
||||
Clamp(JSContext *cx, unsigned argc, Value *vp)
|
||||
Float32x4Clamp(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
typedef typename In::Elem InElem;
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 3 || !IsVectorObject<In>(args[0]) ||
|
||||
!IsVectorObject<In>(args[1]) || !IsVectorObject<In>(args[2]))
|
||||
if (args.length() != 3 || !IsVectorObject<Float32x4>(args[0]) ||
|
||||
!IsVectorObject<Float32x4>(args[1]) || !IsVectorObject<Float32x4>(args[2]))
|
||||
{
|
||||
return ErrorBadArgs(cx);
|
||||
}
|
||||
|
||||
InElem *val = TypedObjectMemory<InElem *>(args[0]);
|
||||
InElem *lowerLimit = TypedObjectMemory<InElem *>(args[1]);
|
||||
InElem *upperLimit = TypedObjectMemory<InElem *>(args[2]);
|
||||
float *val = TypedObjectMemory<float *>(args[0]);
|
||||
float *lowerLimit = TypedObjectMemory<float *>(args[1]);
|
||||
float *upperLimit = TypedObjectMemory<float *>(args[2]);
|
||||
|
||||
InElem result[In::lanes];
|
||||
for (unsigned i = 0; i < In::lanes; i++) {
|
||||
float result[Float32x4::lanes];
|
||||
for (unsigned i = 0; i < Float32x4::lanes; i++) {
|
||||
result[i] = val[i] < lowerLimit[i] ? lowerLimit[i] : val[i];
|
||||
result[i] = result[i] > upperLimit[i] ? upperLimit[i] : result[i];
|
||||
}
|
||||
|
||||
return StoreResult<In>(cx, args, result);
|
||||
return StoreResult<Float32x4>(cx, args, result);
|
||||
}
|
||||
|
||||
template <typename In>
|
||||
static bool
|
||||
Select(JSContext *cx, unsigned argc, Value *vp)
|
||||
Int32x4Select(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
typedef typename In::Elem RetElem;
|
||||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 3 || !IsVectorObject<Int32x4>(args[0]) ||
|
||||
!IsVectorObject<In>(args[1]) || !IsVectorObject<In>(args[2]))
|
||||
!IsVectorObject<Int32x4>(args[1]) || !IsVectorObject<Int32x4>(args[2]))
|
||||
{
|
||||
return ErrorBadArgs(cx);
|
||||
}
|
||||
|
@ -988,8 +908,37 @@ Select(JSContext *cx, unsigned argc, Value *vp)
|
|||
for (unsigned i = 0; i < Int32x4::lanes; i++)
|
||||
orInt[i] = Or<int32_t>::apply(tr[i], fr[i]);
|
||||
|
||||
RetElem *result = reinterpret_cast<RetElem *>(orInt);
|
||||
return StoreResult<In>(cx, args, result);
|
||||
return StoreResult<Int32x4>(cx, args, orInt);
|
||||
}
|
||||
|
||||
static bool
|
||||
Float32x4Select(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 3 || !IsVectorObject<Int32x4>(args[0]) ||
|
||||
!IsVectorObject<Float32x4>(args[1]) || !IsVectorObject<Float32x4>(args[2]))
|
||||
{
|
||||
return ErrorBadArgs(cx);
|
||||
}
|
||||
|
||||
int32_t *val = TypedObjectMemory<int32_t *>(args[0]);
|
||||
int32_t *tv = TypedObjectMemory<int32_t *>(args[1]);
|
||||
int32_t *fv = TypedObjectMemory<int32_t *>(args[2]);
|
||||
|
||||
int32_t tr[Int32x4::lanes];
|
||||
for (unsigned i = 0; i < Int32x4::lanes; i++)
|
||||
tr[i] = And<int32_t>::apply(val[i], tv[i]);
|
||||
|
||||
int32_t fr[Int32x4::lanes];
|
||||
for (unsigned i = 0; i < Int32x4::lanes; i++)
|
||||
fr[i] = And<int32_t>::apply(Not<int32_t>::apply(val[i]), fv[i]);
|
||||
|
||||
int32_t orInt[Int32x4::lanes];
|
||||
for (unsigned i = 0; i < Int32x4::lanes; i++)
|
||||
orInt[i] = Or<int32_t>::apply(tr[i], fr[i]);
|
||||
|
||||
float *result = reinterpret_cast<float *>(orInt);
|
||||
return StoreResult<Float32x4>(cx, args, result);
|
||||
}
|
||||
|
||||
template<class VElem, unsigned NumElem>
|
||||
|
@ -1080,16 +1029,7 @@ js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
|||
return Func(cx, argc, vp); \
|
||||
}
|
||||
FLOAT32X4_FUNCTION_LIST(DEFINE_SIMD_FLOAT32X4_FUNCTION)
|
||||
#undef DEFINE_SIMD_FLOAT32X4_FUNCTION
|
||||
|
||||
#define DEFINE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands, Flags) \
|
||||
bool \
|
||||
js::simd_float64x2_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
||||
{ \
|
||||
return Func(cx, argc, vp); \
|
||||
}
|
||||
FLOAT64X2_FUNCTION_LIST(DEFINE_SIMD_FLOAT64X2_FUNCTION)
|
||||
#undef DEFINE_SIMD_FLOAT64X2_FUNCTION
|
||||
#undef DEFINE_SIMD_FLOAT32x4_FUNCTION
|
||||
|
||||
#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags) \
|
||||
bool \
|
||||
|
@ -1108,14 +1048,6 @@ const JSFunctionSpec js::Float32x4Methods[] = {
|
|||
JS_FS_END
|
||||
};
|
||||
|
||||
const JSFunctionSpec js::Float64x2Methods[] = {
|
||||
#define SIMD_FLOAT64X2_FUNCTION_ITEM(Name, Func, Operands, Flags) \
|
||||
JS_FN(#Name, js::simd_float64x2_##Name, Operands, Flags),
|
||||
FLOAT64X2_FUNCTION_LIST(SIMD_FLOAT64X2_FUNCTION_ITEM)
|
||||
#undef SIMD_FLOAT64X2_FUNCTION_ITEM
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
const JSFunctionSpec js::Int32x4Methods[] = {
|
||||
#define SIMD_INT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags) \
|
||||
JS_FN(#Name, js::simd_int32x4_##Name, Operands, Flags),
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#define FLOAT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
V(abs, (UnaryFunc<Float32x4, Abs, Float32x4>), 1, 0) \
|
||||
V(fromFloat64x2, (FuncConvert<Float64x2, Float32x4> ), 1, 0) \
|
||||
V(fromFloat64x2Bits, (FuncConvertBits<Float64x2, Float32x4>), 1, 0) \
|
||||
V(fromInt32x4, (FuncConvert<Int32x4, Float32x4> ), 1, 0) \
|
||||
V(fromInt32x4Bits, (FuncConvertBits<Int32x4, Float32x4>), 1, 0) \
|
||||
V(neg, (UnaryFunc<Float32x4, Neg, Float32x4>), 1, 0) \
|
||||
|
@ -63,8 +61,8 @@
|
|||
V(xor, (CoercedBinaryFunc<Float32x4, Int32x4, Xor, Float32x4>), 2, 0)
|
||||
|
||||
#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(clamp, Clamp<Float32x4>, 3, 0) \
|
||||
V(select, Select<Float32x4>, 3, 0)
|
||||
V(clamp, Float32x4Clamp, 3, 0) \
|
||||
V(select, Float32x4Select, 3, 0)
|
||||
|
||||
#define FLOAT32X4_SHUFFLE_FUNCTION_LIST(V) \
|
||||
V(swizzle, Swizzle<Float32x4>, 2, 0) \
|
||||
|
@ -76,59 +74,9 @@
|
|||
FLOAT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_SHUFFLE_FUNCTION_LIST(V)
|
||||
|
||||
#define FLOAT64X2_UNARY_FUNCTION_LIST(V) \
|
||||
V(abs, (UnaryFunc<Float64x2, Abs, Float64x2>), 1, 0) \
|
||||
V(fromFloat32x4, (FuncConvert<Float32x4, Float64x2> ), 1, 0) \
|
||||
V(fromFloat32x4Bits, (FuncConvertBits<Float32x4, Float64x2>), 1, 0) \
|
||||
V(fromInt32x4, (FuncConvert<Int32x4, Float64x2> ), 1, 0) \
|
||||
V(fromInt32x4Bits, (FuncConvertBits<Int32x4, Float64x2>), 1, 0) \
|
||||
V(neg, (UnaryFunc<Float64x2, Neg, Float64x2>), 1, 0) \
|
||||
V(reciprocal, (UnaryFunc<Float64x2, Rec, Float64x2>), 1, 0) \
|
||||
V(reciprocalSqrt, (UnaryFunc<Float64x2, RecSqrt, Float64x2>), 1, 0) \
|
||||
V(splat, (FuncSplat<Float64x2>), 1, 0) \
|
||||
V(sqrt, (UnaryFunc<Float64x2, Sqrt, Float64x2>), 1, 0)
|
||||
|
||||
#define FLOAT64X2_BINARY_FUNCTION_LIST(V) \
|
||||
V(add, (BinaryFunc<Float64x2, Add, Float64x2>), 2, 0) \
|
||||
V(div, (BinaryFunc<Float64x2, Div, Float64x2>), 2, 0) \
|
||||
V(equal, (CompareFunc<Float64x2, Equal>), 2, 0) \
|
||||
V(greaterThan, (CompareFunc<Float64x2, GreaterThan>), 2, 0) \
|
||||
V(greaterThanOrEqual, (CompareFunc<Float64x2, GreaterThanOrEqual>), 2, 0) \
|
||||
V(lessThan, (CompareFunc<Float64x2, LessThan>), 2, 0) \
|
||||
V(lessThanOrEqual, (CompareFunc<Float64x2, LessThanOrEqual>), 2, 0) \
|
||||
V(load, (Load<Float64x2, 2>), 2, 0) \
|
||||
V(loadX, (Load<Float64x2, 1>), 2, 0) \
|
||||
V(max, (BinaryFunc<Float64x2, Maximum, Float64x2>), 2, 0) \
|
||||
V(maxNum, (BinaryFunc<Float64x2, MaxNum, Float64x2>), 2, 0) \
|
||||
V(min, (BinaryFunc<Float64x2, Minimum, Float64x2>), 2, 0) \
|
||||
V(minNum, (BinaryFunc<Float64x2, MinNum, Float64x2>), 2, 0) \
|
||||
V(mul, (BinaryFunc<Float64x2, Mul, Float64x2>), 2, 0) \
|
||||
V(notEqual, (CompareFunc<Float64x2, NotEqual>), 2, 0) \
|
||||
V(store, (Store<Float64x2, 2>), 3, 0) \
|
||||
V(storeX, (Store<Float64x2, 1>), 3, 0) \
|
||||
V(sub, (BinaryFunc<Float64x2, Sub, Float64x2>), 2, 0) \
|
||||
V(withX, (FuncWith<Float64x2, WithX>), 2, 0) \
|
||||
V(withY, (FuncWith<Float64x2, WithY>), 2, 0)
|
||||
|
||||
#define FLOAT64X2_TERNARY_FUNCTION_LIST(V) \
|
||||
V(clamp, Clamp<Float64x2>, 3, 0) \
|
||||
V(select, Select<Float64x2>, 3, 0)
|
||||
|
||||
#define FLOAT64X2_SHUFFLE_FUNCTION_LIST(V) \
|
||||
V(swizzle, Swizzle<Float64x2>, 2, 0) \
|
||||
V(shuffle, Shuffle<Float64x2>, 3, 0)
|
||||
|
||||
#define FLOAT64X2_FUNCTION_LIST(V) \
|
||||
FLOAT64X2_UNARY_FUNCTION_LIST(V) \
|
||||
FLOAT64X2_BINARY_FUNCTION_LIST(V) \
|
||||
FLOAT64X2_TERNARY_FUNCTION_LIST(V) \
|
||||
FLOAT64X2_SHUFFLE_FUNCTION_LIST(V)
|
||||
|
||||
#define INT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
V(fromFloat32x4, (FuncConvert<Float32x4, Int32x4>), 1, 0) \
|
||||
V(fromFloat32x4Bits, (FuncConvertBits<Float32x4, Int32x4>), 1, 0) \
|
||||
V(fromFloat64x2, (FuncConvert<Float64x2, Int32x4>), 1, 0) \
|
||||
V(fromFloat64x2Bits, (FuncConvertBits<Float64x2, Int32x4>), 1, 0) \
|
||||
V(neg, (UnaryFunc<Int32x4, Neg, Int32x4>), 1, 0) \
|
||||
V(not, (UnaryFunc<Int32x4, Not, Int32x4>), 1, 0) \
|
||||
V(splat, (FuncSplat<Int32x4>), 0, 0)
|
||||
|
@ -163,7 +111,7 @@
|
|||
V(xor, (BinaryFunc<Int32x4, Xor, Int32x4>), 2, 0)
|
||||
|
||||
#define INT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(select, Select<Int32x4>, 3, 0) \
|
||||
V(select, Int32x4Select, 3, 0) \
|
||||
|
||||
#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \
|
||||
V(bool, Int32x4Bool, 4, 0)
|
||||
|
@ -259,26 +207,6 @@ struct Float32x4 {
|
|||
}
|
||||
};
|
||||
|
||||
struct Float64x2 {
|
||||
typedef double Elem;
|
||||
static const unsigned lanes = 2;
|
||||
static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64;
|
||||
|
||||
static TypeDescr &GetTypeDescr(GlobalObject &global) {
|
||||
return global.float64x2TypeDescr().as<TypeDescr>();
|
||||
}
|
||||
static Elem toType(Elem a) {
|
||||
return a;
|
||||
}
|
||||
static bool toType(JSContext *cx, JS::HandleValue v, Elem *out) {
|
||||
*out = v.toNumber();
|
||||
return true;
|
||||
}
|
||||
static void setReturn(CallArgs &args, Elem value) {
|
||||
args.rval().setDouble(JS::CanonicalizeNaN(value));
|
||||
}
|
||||
};
|
||||
|
||||
struct Int32x4 {
|
||||
typedef int32_t Elem;
|
||||
static const unsigned lanes = 4;
|
||||
|
@ -313,12 +241,6 @@ simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
|
|||
FLOAT32X4_FUNCTION_LIST(DECLARE_SIMD_FLOAT32X4_FUNCTION)
|
||||
#undef DECLARE_SIMD_FLOAT32X4_FUNCTION
|
||||
|
||||
#define DECLARE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands, Flags) \
|
||||
extern bool \
|
||||
simd_float64x2_##Name(JSContext *cx, unsigned argc, Value *vp);
|
||||
FLOAT64X2_FUNCTION_LIST(DECLARE_SIMD_FLOAT64X2_FUNCTION)
|
||||
#undef DECLARE_SIMD_FLOAT64X2_FUNCTION
|
||||
|
||||
#define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags) \
|
||||
extern bool \
|
||||
simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
|
|
@ -406,25 +406,18 @@ js::ReferenceTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
* SIMD type objects
|
||||
* X4 type objects
|
||||
*
|
||||
* Note: these are partially defined in SIMD.cpp
|
||||
*/
|
||||
|
||||
static const int32_t SimdSizes[] = {
|
||||
#define SIMD_SIZE(_kind, _type, _name, _lanes) \
|
||||
sizeof(_type) * _lanes,
|
||||
#define SIMD_SIZE(_kind, _type, _name) \
|
||||
sizeof(_type) * 4,
|
||||
JS_FOR_EACH_SIMD_TYPE_REPR(SIMD_SIZE) 0
|
||||
#undef SIMD_SIZE
|
||||
};
|
||||
|
||||
static int32_t SimdLanes[] = {
|
||||
#define SIMD_LANE(_kind, _type, _name, _lanes) \
|
||||
_lanes,
|
||||
JS_FOR_EACH_SIMD_TYPE_REPR(SIMD_LANE) 0
|
||||
#undef SIMD_LANE
|
||||
};
|
||||
|
||||
int32_t
|
||||
SimdTypeDescr::size(Type t)
|
||||
{
|
||||
|
@ -437,12 +430,6 @@ SimdTypeDescr::alignment(Type t)
|
|||
return SimdSizes[t];
|
||||
}
|
||||
|
||||
int32_t
|
||||
SimdTypeDescr::lanes(Type t)
|
||||
{
|
||||
return SimdLanes[t];
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* ArrayMetaTypeDescr class
|
||||
*/
|
||||
|
@ -2772,16 +2759,6 @@ js::GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::GetFloat64x2TypeDescr(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
Rooted<GlobalObject*> global(cx, cx->global());
|
||||
MOZ_ASSERT(global);
|
||||
args.rval().setObject(global->float64x2TypeDescr());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
|
|
|
@ -324,7 +324,7 @@ class ComplexTypeDescr : public TypeDescr
|
|||
};
|
||||
|
||||
/*
|
||||
* Type descriptors `float32x4`, `int32x4` and `float64x2`
|
||||
* Type descriptors `float32x4` and `int32x4`
|
||||
*/
|
||||
class SimdTypeDescr : public ComplexTypeDescr
|
||||
{
|
||||
|
@ -332,7 +332,6 @@ class SimdTypeDescr : public ComplexTypeDescr
|
|||
enum Type {
|
||||
TYPE_INT32 = JS_SIMDTYPEREPR_INT32,
|
||||
TYPE_FLOAT32 = JS_SIMDTYPEREPR_FLOAT32,
|
||||
TYPE_FLOAT64 = JS_SIMDTYPEREPR_FLOAT64
|
||||
};
|
||||
|
||||
static const type::Kind Kind = type::Simd;
|
||||
|
@ -340,7 +339,6 @@ class SimdTypeDescr : public ComplexTypeDescr
|
|||
static const Class class_;
|
||||
static int32_t size(Type t);
|
||||
static int32_t alignment(Type t);
|
||||
static int32_t lanes(Type t);
|
||||
|
||||
SimdTypeDescr::Type type() const {
|
||||
return (SimdTypeDescr::Type) getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32();
|
||||
|
@ -351,9 +349,8 @@ class SimdTypeDescr : public ComplexTypeDescr
|
|||
};
|
||||
|
||||
#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)
|
||||
macro_(SimdTypeDescr::TYPE_INT32, int32_t, int32) \
|
||||
macro_(SimdTypeDescr::TYPE_FLOAT32, float, float32)
|
||||
|
||||
bool IsTypedObjectClass(const Class *clasp); // Defined below
|
||||
bool IsTypedObjectArray(JSObject& obj);
|
||||
|
@ -894,14 +891,6 @@ bool GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp);
|
|||
*/
|
||||
bool GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
||||
/*
|
||||
* Usage: GetFloat64x2TypeDescr()
|
||||
*
|
||||
* Returns the float64x2 type object. SIMD pseudo-module must have
|
||||
* been initialized for this to be safe.
|
||||
*/
|
||||
bool GetFloat64x2TypeDescr(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
||||
/*
|
||||
* Usage: GetInt32x4TypeDescr()
|
||||
*
|
||||
|
|
|
@ -152,11 +152,6 @@ function TypedObjectGetSimd(descr, typedObj, offset) {
|
|||
var w = Load_float32(typedObj, offset + 12);
|
||||
return GetFloat32x4TypeDescr()(x, y, z, w);
|
||||
|
||||
case JS_SIMDTYPEREPR_FLOAT64:
|
||||
var x = Load_float64(typedObj, offset + 0);
|
||||
var y = Load_float64(typedObj, offset + 8);
|
||||
return GetFloat64x2TypeDescr()(x, y);
|
||||
|
||||
case JS_SIMDTYPEREPR_INT32:
|
||||
var x = Load_int32(typedObj, offset + 0);
|
||||
var y = Load_int32(typedObj, offset + 4);
|
||||
|
@ -327,10 +322,6 @@ function TypedObjectSetSimd(descr, typedObj, offset, fromValue) {
|
|||
Store_float32(typedObj, offset + 8, Load_float32(fromValue, 8));
|
||||
Store_float32(typedObj, offset + 12, Load_float32(fromValue, 12));
|
||||
break;
|
||||
case JS_SIMDTYPEREPR_FLOAT64:
|
||||
Store_float64(typedObj, offset + 0, Load_float64(fromValue, 0));
|
||||
Store_float64(typedObj, offset + 8, Load_float64(fromValue, 8));
|
||||
break;
|
||||
case JS_SIMDTYPEREPR_INT32:
|
||||
Store_int32(typedObj, offset + 0, Load_int32(fromValue, 0));
|
||||
Store_int32(typedObj, offset + 4, Load_int32(fromValue, 4));
|
||||
|
@ -466,21 +457,6 @@ function SimdProtoString(type) {
|
|||
return "int32x4";
|
||||
case JS_SIMDTYPEREPR_FLOAT32:
|
||||
return "float32x4";
|
||||
case JS_SIMDTYPEREPR_FLOAT64:
|
||||
return "float64x2";
|
||||
}
|
||||
|
||||
assert(false, "Unhandled type constant");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function SimdTypeToLength(type) {
|
||||
switch (type) {
|
||||
case JS_SIMDTYPEREPR_INT32:
|
||||
case JS_SIMDTYPEREPR_FLOAT32:
|
||||
return 4;
|
||||
case JS_SIMDTYPEREPR_FLOAT64:
|
||||
return 2;
|
||||
}
|
||||
|
||||
assert(false, "Unhandled type constant");
|
||||
|
@ -497,12 +473,7 @@ function SimdToSource() {
|
|||
ThrowError(JSMSG_INCOMPATIBLE_PROTO, "SIMD", "toSource", typeof this);
|
||||
|
||||
var type = DESCR_TYPE(descr);
|
||||
var protoString = SimdProtoString(type);
|
||||
var length = SimdTypeToLength(type);
|
||||
if (length == 4)
|
||||
return protoString+"("+this.x+", "+this.y+", "+this.z+", "+this.w+")";
|
||||
else if (length == 2)
|
||||
return protoString+"("+this.x+", "+this.y+")";
|
||||
return SimdProtoString(type)+"("+this.x+", "+this.y+", "+this.z+", "+this.w+")";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -32,9 +32,8 @@
|
|||
#define JS_DESCR_SLOT_ARRAYPROTO 6 // Lazily created prototype for arrays
|
||||
#define JS_DESCR_SLOT_TRACE_LIST 7 // List of references for use in tracing
|
||||
|
||||
// Slots on scalars, references, and SIMD objects
|
||||
// Slots on scalars, references, and x4s
|
||||
#define JS_DESCR_SLOT_TYPE 8 // Type code
|
||||
#define JS_DESCR_SLOT_LANES 9
|
||||
|
||||
// Slots on array descriptors
|
||||
#define JS_DESCR_SLOT_ARRAY_ELEM_TYPE 8
|
||||
|
@ -86,6 +85,5 @@
|
|||
// case.
|
||||
#define JS_SIMDTYPEREPR_INT32 0
|
||||
#define JS_SIMDTYPEREPR_FLOAT32 1
|
||||
#define JS_SIMDTYPEREPR_FLOAT64 2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
macro(float32, float32, "float32") \
|
||||
macro(float32x4, float32x4, "float32x4") \
|
||||
macro(float64, float64, "float64") \
|
||||
macro(float64x2, float64x2, "float64x2") \
|
||||
macro(forceInterpreter, forceInterpreter, "forceInterpreter") \
|
||||
macro(format, format, "format") \
|
||||
macro(frame, frame, "frame") \
|
||||
|
|
|
@ -104,9 +104,8 @@ class GlobalObject : public NativeObject
|
|||
static const unsigned RUNTIME_CODEGEN_ENABLED = WARNED_PROTO_SETTING_SLOW + 1;
|
||||
static const unsigned DEBUGGERS = RUNTIME_CODEGEN_ENABLED + 1;
|
||||
static const unsigned INTRINSICS = DEBUGGERS + 1;
|
||||
static const unsigned FLOAT32X4_TYPE_DESCR = INTRINSICS + 1;
|
||||
static const unsigned FLOAT64X2_TYPE_DESCR = FLOAT32X4_TYPE_DESCR + 1;
|
||||
static const unsigned INT32X4_TYPE_DESCR = FLOAT64X2_TYPE_DESCR + 1;
|
||||
static const unsigned FLOAT32X4_TYPE_DESCR = INTRINSICS + 1;
|
||||
static const unsigned INT32X4_TYPE_DESCR = FLOAT32X4_TYPE_DESCR + 1;
|
||||
static const unsigned FOR_OF_PIC_CHAIN = INT32X4_TYPE_DESCR + 1;
|
||||
|
||||
/* Total reserved-slot count for global objects. */
|
||||
|
@ -409,16 +408,6 @@ class GlobalObject : public NativeObject
|
|||
return getSlotRef(FLOAT32X4_TYPE_DESCR).toObject();
|
||||
}
|
||||
|
||||
void setFloat64x2TypeDescr(JSObject &obj) {
|
||||
MOZ_ASSERT(getSlotRef(FLOAT64X2_TYPE_DESCR).isUndefined());
|
||||
setSlot(FLOAT64X2_TYPE_DESCR, ObjectValue(obj));
|
||||
}
|
||||
|
||||
JSObject &float64x2TypeDescr() {
|
||||
MOZ_ASSERT(getSlotRef(FLOAT64X2_TYPE_DESCR).isObject());
|
||||
return getSlotRef(FLOAT64X2_TYPE_DESCR).toObject();
|
||||
}
|
||||
|
||||
void setInt32x4TypeDescr(JSObject &obj) {
|
||||
MOZ_ASSERT(getSlotRef(INT32X4_TYPE_DESCR).isUndefined());
|
||||
setSlot(INT32X4_TYPE_DESCR, ObjectValue(obj));
|
||||
|
|
|
@ -1181,7 +1181,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
&js::ClampToUint8JitInfo, 1, 0),
|
||||
JS_FN("GetTypedObjectModule", js::GetTypedObjectModule, 0, 0),
|
||||
JS_FN("GetFloat32x4TypeDescr", js::GetFloat32x4TypeDescr, 0, 0),
|
||||
JS_FN("GetFloat64x2TypeDescr", js::GetFloat64x2TypeDescr, 0, 0),
|
||||
JS_FN("GetInt32x4TypeDescr", js::GetInt32x4TypeDescr, 0, 0),
|
||||
|
||||
#define LOAD_AND_STORE_SCALAR_FN_DECLS(_constant, _type, _name) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче