From 0588f478ce9328ecd3b27d1738b08afe13dd6e4a Mon Sep 17 00:00:00 2001 From: "Nicholas D. Matsakis" Date: Thu, 30 Jan 2014 23:17:20 -0500 Subject: [PATCH] Bug 966575 part 10 -- Remove uses of raw TypeRepr from SIMD r=sfink --- js/src/builtin/SIMD.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 23d62bd760e..d308cd51d36 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -46,8 +46,10 @@ extern const JSFunctionSpec Int32x4Methods[]; return false; \ } \ TypedDatum &datum = args.thisv().toObject().as(); \ - TypeRepresentation *typeRepr = datum.typeRepresentation(); \ - if (typeRepr->kind() != TypeDescr::X4 || typeRepr->asX4()->type() != Type32x4::type) { \ + TypeDescr &descr = datum.typeDescr(); \ + if (descr.kind() != TypeDescr::X4 || \ + descr.as().type() != Type32x4::type) \ + { \ JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \ X4TypeDescr::class_.name, laneNames[lane], \ InformalValueTypeName(args.thisv())); \ @@ -77,8 +79,10 @@ extern const JSFunctionSpec Int32x4Methods[]; return false; \ } \ TypedDatum &datum = args.thisv().toObject().as(); \ - TypeRepresentation *typeRepr = datum.typeRepresentation(); \ - if (typeRepr->kind() != TypeDescr::X4 || typeRepr->asX4()->type() != Type32x4::type) { \ + TypeDescr &descr = datum.typeDescr(); \ + if (descr.kind() != TypeDescr::X4 || \ + descr.as().type() != Type32x4::type) \ + { \ JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \ X4TypeDescr::class_.name, "signMask", \ InformalValueTypeName(args.thisv())); \ @@ -243,13 +247,12 @@ X4TypeDescr::call(JSContext *cx, unsigned argc, Value *vp) return false; } - Rooted typeObj(cx, &args.callee().as()); - Rooted result(cx, TypedObject::createZeroed(cx, typeObj, 0)); + Rooted descr(cx, &args.callee().as()); + Rooted result(cx, TypedObject::createZeroed(cx, descr, 0)); if (!result) return false; - X4TypeRepresentation *typeRepr = typeObj->typeRepresentation()->asX4(); - switch (typeRepr->type()) { + switch (descr->type()) { #define STORE_LANES(_constant, _type, _name) \ case _constant: \ { \ @@ -367,10 +370,10 @@ static bool ObjectIsVector(JSObject &obj) { if (!obj.is()) return false; - TypeRepresentation *typeRepr = obj.as().typeRepresentation(); - if (typeRepr->kind() != TypeDescr::X4) + TypeDescr &typeRepr = obj.as().typeDescr(); + if (typeRepr.kind() != TypeDescr::X4) return false; - return typeRepr->asX4()->type() == V::type; + return typeRepr.as().type() == V::type; } template