Bug 1480819 - Part 2: Switch the temporary variables used for CopyStringChars in CreateDependentString::generate. r=mgaudet
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 03 Aug 2018 09:09:40 -0700
changeset 486370 7ad24c33a9b5747245545b3ea8aca85a0e57429d
parent 486369 09d8a8e246481cde29ee88928dc14a98b36d8634
child 486371 34165b194cf9df25e92febd28948d93554280bf6
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1480819
milestone63.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 1480819 - Part 2: Switch the temporary variables used for CopyStringChars in CreateDependentString::generate. r=mgaudet
js/src/jit/CodeGenerator.cpp
js/src/jit/shared/Assembler-shared.h
js/src/jit/x86/Assembler-x86.h
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -1796,21 +1796,21 @@ CreateDependentString::generate(MacroAss
         // Load chars pointer for the new string.
         masm.loadInlineStringCharsForStore(string, string);
 
         // Load the source characters pointer.
         masm.loadStringChars(base, temp2,
                              latin1 ? CharEncoding::Latin1 : CharEncoding::TwoByte);
         masm.load32(newStartIndexAddress, base);
         if (latin1)
-            masm.addPtr(temp2, base);
+            masm.addPtr(base, temp2);
         else
-            masm.computeEffectiveAddress(BaseIndex(temp2, base, TimesTwo), base);
-
-        CopyStringChars(masm, string, base, temp1, temp2, latin1 ? 1 : 2, latin1 ? 1 : 2);
+            masm.computeEffectiveAddress(BaseIndex(temp2, base, TimesTwo), temp2);
+
+        CopyStringChars(masm, string, temp2, temp1, base, latin1 ? 1 : 2, latin1 ? 1 : 2);
 
         // Null-terminate.
         if (latin1)
             masm.store8(Imm32(0), Address(string, 0));
         else
             masm.store16(Imm32(0), Address(string, 0));
 
         masm.pop(base);
@@ -1972,28 +1972,17 @@ JitRealm::generateRegExpMatcherStub(JSCo
     ValueOperand result = JSReturnOperand;
 
     // We are free to clobber all registers, as LRegExpMatcher is a call instruction.
     AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
     regs.take(input);
     regs.take(regexp);
     regs.take(lastIndex);
 
-    // temp5 is used in single byte instructions when creating dependent
-    // strings, and has restrictions on which register it can be on some
-    // platforms.
-    Register temp5;
-    {
-        AllocatableGeneralRegisterSet oregs = regs;
-        do {
-            temp5 = oregs.takeAny();
-        } while (!MacroAssembler::canUseInSingleByteInstruction(temp5));
-        regs.take(temp5);
-    }
-
+    Register temp5 = regs.takeAny();
     Register temp1 = regs.takeAny();
     Register temp2 = regs.takeAny();
     Register temp3 = regs.takeAny();
 
     Register maybeTemp4 = InvalidReg;
     if (!regs.empty()) {
         // There are not enough registers on x86.
         maybeTemp4 = regs.takeAny();
--- a/js/src/jit/shared/Assembler-shared.h
+++ b/js/src/jit/shared/Assembler-shared.h
@@ -880,20 +880,16 @@ class AssemblerShared
     bool oom() const {
         return !enoughMemory_;
     }
 
     bool embedsNurseryPointers() const {
         return embedsNurseryPointers_;
     }
 
-    static bool canUseInSingleByteInstruction(Register reg) {
-        return true;
-    }
-
     void addCodeLabel(CodeLabel label) {
         propagateOOM(codeLabels_.append(label));
     }
     size_t numCodeLabels() const {
         return codeLabels_.length();
     }
     CodeLabel codeLabel(size_t i) {
         return codeLabels_[i];
--- a/js/src/jit/x86/Assembler-x86.h
+++ b/js/src/jit/x86/Assembler-x86.h
@@ -1055,20 +1055,16 @@ class Assembler : public AssemblerX86Sha
         masm.vmovdqu_rm(src.encoding(), dest.addr);
         return CodeOffset(masm.currentOffset());
     }
     CodeOffset vmovupsWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) {
         MOZ_ASSERT(HasSSE2());
         masm.vmovups_rm(src.encoding(), dest.addr);
         return CodeOffset(masm.currentOffset());
     }
-
-    static bool canUseInSingleByteInstruction(Register reg) {
-        return X86Encoding::HasSubregL(reg.encoding());
-    }
 };
 
 // Get a register in which we plan to put a quantity that will be used as an
 // integer argument.  This differs from GetIntArgReg in that if we have no more
 // actual argument registers to use we will fall back on using whatever
 // CallTempReg* don't overlap the argument registers, and only fail once those
 // run out too.
 static inline bool