Bug 925088 - SpiderMonkey: Micro-optimize x64's testStringTruthy. r=mjrosen
authorDan Gohman <sunfish@google.com>
Thu, 10 Oct 2013 05:21:05 -0700
changeset 150324 92416820c9fa036f15039fb19c46b254c7e4e9df
parent 150323 00e39c694626e8354e7265be22e685664ff209f3
child 150325 44c21dcf12745f2f0b8bc8dbc367ac587d14551d
push id34822
push usersunfish@google.com
push dateThu, 10 Oct 2013 12:24:29 +0000
treeherdermozilla-inbound@92416820c9fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosen
bugs925088
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 925088 - SpiderMonkey: Micro-optimize x64's testStringTruthy. r=mjrosen
js/src/jit/x64/MacroAssembler-x64.h
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -1052,24 +1052,21 @@ class MacroAssemblerX64 : public MacroAs
     Condition testInt32Truthy(bool truthy, const ValueOperand &operand) {
         testl(operand.valueReg(), operand.valueReg());
         return truthy ? NonZero : Zero;
     }
     void branchTestBooleanTruthy(bool truthy, const ValueOperand &operand, Label *label) {
         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;
     }
 
 
     void loadInt32OrDouble(const Operand &operand, const FloatRegister &dest) {
         Label notInt32, end;
         branchTestInt32(Assembler::NotEqual, operand, &notInt32);
         convertInt32ToDouble(operand, dest);