本文整理汇总了C++中CCallHelpers::branchTruncateDoubleToInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ CCallHelpers::branchTruncateDoubleToInt32方法的具体用法?C++ CCallHelpers::branchTruncateDoubleToInt32怎么用?C++ CCallHelpers::branchTruncateDoubleToInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCallHelpers
的用法示例。
在下文中一共展示了CCallHelpers::branchTruncateDoubleToInt32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateFastPath
void JITRightShiftGenerator::generateFastPath(CCallHelpers& jit)
{
ASSERT(m_scratchGPR != InvalidGPRReg);
ASSERT(m_scratchGPR != m_left.payloadGPR());
ASSERT(m_scratchGPR != m_right.payloadGPR());
#if USE(JSVALUE32_64)
ASSERT(m_scratchGPR != m_left.tagGPR());
ASSERT(m_scratchGPR != m_right.tagGPR());
ASSERT(m_scratchFPR != InvalidFPRReg);
#endif
ASSERT(!m_leftOperand.isConstInt32() || !m_rightOperand.isConstInt32());
m_didEmitFastPath = true;
if (m_rightOperand.isConstInt32()) {
// Try to do (intVar >> intConstant).
CCallHelpers::Jump notInt = jit.branchIfNotInt32(m_left);
jit.moveValueRegs(m_left, m_result);
int32_t shiftAmount = m_rightOperand.asConstInt32() & 0x1f;
if (shiftAmount) {
if (m_shiftType == SignedShift)
jit.rshift32(CCallHelpers::Imm32(shiftAmount), m_result.payloadGPR());
else
jit.urshift32(CCallHelpers::Imm32(shiftAmount), m_result.payloadGPR());
#if USE(JSVALUE64)
jit.or64(GPRInfo::tagTypeNumberRegister, m_result.payloadGPR());
#endif
}
if (jit.supportsFloatingPointTruncate()) {
m_endJumpList.append(jit.jump()); // Terminate the above case before emitting more code.
// Try to do (doubleVar >> intConstant).
notInt.link(&jit);
m_slowPathJumpList.append(jit.branchIfNotNumber(m_left, m_scratchGPR));
jit.unboxDoubleNonDestructive(m_left, m_leftFPR, m_scratchGPR, m_scratchFPR);
m_slowPathJumpList.append(jit.branchTruncateDoubleToInt32(m_leftFPR, m_scratchGPR));
if (shiftAmount) {
if (m_shiftType == SignedShift)
jit.rshift32(CCallHelpers::Imm32(shiftAmount), m_scratchGPR);
else
jit.urshift32(CCallHelpers::Imm32(shiftAmount), m_scratchGPR);
}
jit.boxInt32(m_scratchGPR, m_result);
} else
m_slowPathJumpList.append(notInt);
} else {
// Try to do (intConstant >> intVar) or (intVar >> intVar).
m_slowPathJumpList.append(jit.branchIfNotInt32(m_right));
CCallHelpers::Jump notInt;
if (m_leftOperand.isConstInt32()) {
#if USE(JSVALUE32_64)
jit.move(m_right.tagGPR(), m_result.tagGPR());
#endif
jit.move(CCallHelpers::Imm32(m_leftOperand.asConstInt32()), m_result.payloadGPR());
} else {
notInt = jit.branchIfNotInt32(m_left);
jit.moveValueRegs(m_left, m_result);
}
if (m_shiftType == SignedShift)
jit.rshift32(m_right.payloadGPR(), m_result.payloadGPR());
else
jit.urshift32(m_right.payloadGPR(), m_result.payloadGPR());
#if USE(JSVALUE64)
jit.or64(GPRInfo::tagTypeNumberRegister, m_result.payloadGPR());
#endif
if (m_leftOperand.isConstInt32())
return;
if (jit.supportsFloatingPointTruncate()) {
m_endJumpList.append(jit.jump()); // Terminate the above case before emitting more code.
// Try to do (doubleVar >> intVar).
notInt.link(&jit);
m_slowPathJumpList.append(jit.branchIfNotNumber(m_left, m_scratchGPR));
jit.unboxDoubleNonDestructive(m_left, m_leftFPR, m_scratchGPR, m_scratchFPR);
m_slowPathJumpList.append(jit.branchTruncateDoubleToInt32(m_leftFPR, m_scratchGPR));
if (m_shiftType == SignedShift)
jit.rshift32(m_right.payloadGPR(), m_scratchGPR);
else
jit.urshift32(m_right.payloadGPR(), m_scratchGPR);
jit.boxInt32(m_scratchGPR, m_result);
} else
m_slowPathJumpList.append(notInt);
}
}