void
SpeculativeJIT::compileGetByValOnFloatTypedArray(Node* node, TypedArrayType type,
const
ScopedLambda(DataFormat preferredFormat)>& prefix)
{
ASSERT(isFloat(type));
SpeculateCellOperand base(
this
, m_graph.varArgChild(node, 0));
SpeculateStrictInt32Operand property(
this
, m_graph.varArgChild(node, 1));
StorageOperand storage(
this
, m_graph.varArgChild(node, 2));
GPRTemporary scratch(
this
);
FPRTemporary result(
this
);
GPRReg baseReg = base.gpr();
GPRReg propertyReg = property.gpr();
GPRReg storageReg = storage.gpr();
GPRReg scratchGPR = scratch.gpr();
FPRReg resultReg = result.fpr();
std::optional scratch2;
GPRReg scratch2GPR = InvalidGPRReg;
#if USE(JSVALUE64)
if
(node->arrayMode().mayBeResizableOrGrowableSharedTypedArray()) {
scratch2.emplace(
this
);
scratch2GPR = scratch2->gpr();
}
#endif
JSValueRegs resultRegs;
DataFormat format;
std::tie(resultRegs, format, std::ignore) = prefix(DataFormatDouble);
emitTypedArrayBoundsCheck(node, baseReg, propertyReg, scratchGPR, scratch2GPR);
switch
(elementSize(type)) {
case
4:
loadFloat(BaseIndex(storageReg, propertyReg, TimesFour), resultReg);
convertFloatToDouble(resultReg, resultReg);
break
;
case
8: {
loadDouble(BaseIndex(storageReg, propertyReg, TimesEight), resultReg);
break
;
}
default
:
RELEASE_ASSERT_NOT_REACHED();
}
if
(format == DataFormatJS) {
boxDouble(resultReg, resultRegs);
jsValueResult(resultRegs, node);
}
else
{
ASSERT(format == DataFormatDouble);
doubleResult(resultReg, node);
}
}