Bug 1225908 - SimdTypeToArrayElementType. r=bbouvier

This function returns the typed array element type that corresponds to the
lanes in a SIMD vector type. It is used to handle SIMD loads and stores from a
typed array.
This commit is contained in:
Jakob Stoklund Olesen 2015-11-19 10:37:18 -08:00
parent a687ecc81e
commit 12062418b8

View File

@ -3473,8 +3473,10 @@ IonBuilder::inlineSimdShuffle(CallInfo& callInfo, JSNative native, SimdTypeDescr
return boxSimd(callInfo, ins, templateObj);
}
// Get the typed array element type corresponding to the lanes in a SIMD vector type.
// This only applies to SIMD types that can be loaded and stored to a typed array.
static Scalar::Type
SimdTypeToScalarType(SimdTypeDescr::Type type)
SimdTypeToArrayElementType(SimdTypeDescr::Type type)
{
switch (type) {
case SimdTypeDescr::Float32x4: return Scalar::Float32x4;
@ -3538,7 +3540,7 @@ IonBuilder::inlineSimdLoad(CallInfo& callInfo, JSNative native, SimdTypeDescr::T
if (!checkInlineSimd(callInfo, native, type, 2, &templateObj))
return InliningStatus_NotInlined;
Scalar::Type simdType = SimdTypeToScalarType(type);
Scalar::Type simdType = SimdTypeToArrayElementType(type);
MDefinition* index = nullptr;
MInstruction* elements = nullptr;
@ -3561,7 +3563,7 @@ IonBuilder::inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::
if (!checkInlineSimd(callInfo, native, type, 3, &templateObj))
return InliningStatus_NotInlined;
Scalar::Type simdType = SimdTypeToScalarType(type);
Scalar::Type simdType = SimdTypeToArrayElementType(type);
MDefinition* index = nullptr;
MInstruction* elements = nullptr;