Bug 925088 - SpiderMonkey: Micro-optimize x64's testStringTruthy. r=mjrosen

This commit is contained in:
Dan Gohman 2013-10-10 05:21:05 -07:00
parent 3e53c7d352
commit c80eed789b

View File

@ -1057,14 +1057,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
testl(operand.valueReg(), operand.valueReg());
j(truthy ? NonZero : Zero, label);
}
// This returns the tag in ScratchReg.
Condition testStringTruthy(bool truthy, const ValueOperand &value) {
unboxString(value, ScratchReg);
Operand lengthAndFlags(ScratchReg, JSString::offsetOfLengthAndFlags());
movq(lengthAndFlags, ScratchReg);
shrq(Imm32(JSString::LENGTH_SHIFT), ScratchReg);
testq(ScratchReg, ScratchReg);
testq(lengthAndFlags, Imm32(-1 << JSString::LENGTH_SHIFT));
return truthy ? Assembler::NonZero : Assembler::Zero;
}