Revert "Bug 925088 - SpiderMonkey: Micro-optimize x64's testStringTruthy. r=mjrosen"
authorDan Gohman <sunfish@google.com>
Sat, 19 Oct 2013 12:14:51 -0700
changeset 151448 8de556315ae67ab77b7f95284efbb25f48495c1a
parent 151447 e8f7b915ad46f573d7b744597967d4e2f26aa0a5
child 151449 fec466b50c14130ce09e5a12f9ea98e6b9bb16d4
push id25493
push userMs2ger@gmail.com
push dateSun, 20 Oct 2013 08:44:04 +0000
treeherdermozilla-central@0d316980f21f [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
Revert "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
@@ -1054,21 +1054,24 @@ 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());
-        testq(lengthAndFlags, Imm32(-1 << JSString::LENGTH_SHIFT));
+        movq(lengthAndFlags, ScratchReg);
+        shrq(Imm32(JSString::LENGTH_SHIFT), ScratchReg);
+        testq(ScratchReg, ScratchReg);
         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);