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

This commit is contained in:
Dan Gohman 2013-12-18 15:54:32 -08:00
parent 890486dfd3
commit 11d1351e08

View File

@ -1103,14 +1103,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;
}