本文整理汇总了C++中ValueOperand::scratchReg方法的典型用法代码示例。如果您正苦于以下问题:C++ ValueOperand::scratchReg方法的具体用法?C++ ValueOperand::scratchReg怎么用?C++ ValueOperand::scratchReg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValueOperand
的用法示例。
在下文中一共展示了ValueOperand::scratchReg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
MacroAssembler::loadFromTypedArray(int arrayType, const T &src, const ValueOperand &dest,
bool allowDouble, Register temp, Label *fail)
{
switch (arrayType) {
case TypedArray::TYPE_INT8:
case TypedArray::TYPE_UINT8:
case TypedArray::TYPE_UINT8_CLAMPED:
case TypedArray::TYPE_INT16:
case TypedArray::TYPE_UINT16:
case TypedArray::TYPE_INT32:
loadFromTypedArray(arrayType, src, AnyRegister(dest.scratchReg()), InvalidReg, NULL);
tagValue(JSVAL_TYPE_INT32, dest.scratchReg(), dest);
break;
case TypedArray::TYPE_UINT32:
// Don't clobber dest when we could fail, instead use temp.
load32(src, temp);
test32(temp, temp);
if (allowDouble) {
// If the value fits in an int32, store an int32 type tag.
// Else, convert the value to double and box it.
Label done, isDouble;
j(Assembler::Signed, &isDouble);
{
tagValue(JSVAL_TYPE_INT32, temp, dest);
jump(&done);
}
bind(&isDouble);
{
convertUInt32ToDouble(temp, ScratchFloatReg);
boxDouble(ScratchFloatReg, dest);
}
bind(&done);
} else {
// Bailout if the value does not fit in an int32.
j(Assembler::Signed, fail);
tagValue(JSVAL_TYPE_INT32, temp, dest);
}
break;
case TypedArray::TYPE_FLOAT32:
case TypedArray::TYPE_FLOAT64:
loadFromTypedArray(arrayType, src, AnyRegister(ScratchFloatReg), dest.scratchReg(), NULL);
boxDouble(ScratchFloatReg, dest);
break;
default:
JS_NOT_REACHED("Invalid typed array type");
break;
}
}