Bug 1250634 - Part 0: Fix MacroAssembler support for store16(). r=jandem
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Thu, 25 Feb 2016 17:03:00 -0500
changeset 322460 1783f15418c50cdaacde593f1a321b67abe16e85
parent 322459 02a2962dcbecff190b62d6c398b79b0ab8ff6325
child 322461 5e76a5e6b927dd54878494e949fd038c2555293c
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1250634
milestone47.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 1250634 - Part 0: Fix MacroAssembler support for store16(). r=jandem
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x86/MacroAssembler-x86.h
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -39,16 +39,17 @@ class MacroAssemblerX64 : public MacroAs
     MacroAssembler& asMasm();
     const MacroAssembler& asMasm() const;
 
     void bindOffsets(const MacroAssemblerX86Shared::UsesVector&);
 
   public:
     using MacroAssemblerX86Shared::load32;
     using MacroAssemblerX86Shared::store32;
+    using MacroAssemblerX86Shared::store16;
 
     MacroAssemblerX64()
     {
     }
 
     // The buffer is about to be linked, make sure any constant pools or excess
     // bookkeeping has been flushed to the instruction stream.
     void finish();
@@ -639,16 +640,25 @@ class MacroAssemblerX64 : public MacroAs
         if (X86Encoding::IsAddressImmediate(address.addr)) {
             movl(src, Operand(address));
         } else {
             ScratchRegisterScope scratch(asMasm());
             mov(ImmPtr(address.addr), scratch);
             store32(src, Address(scratch, 0x0));
         }
     }
+    void store16(Register src, AbsoluteAddress address) {
+        if (X86Encoding::IsAddressImmediate(address.addr)) {
+            movw(src, Operand(address));
+        } else {
+            ScratchRegisterScope scratch(asMasm());
+            mov(ImmPtr(address.addr), scratch);
+            store16(src, Address(scratch, 0x0));
+        }
+    }
     void store64(Register64 src, Address address) {
         movq(src.reg, Operand(address));
     }
 
     void splitTag(Register src, Register dest) {
         if (src != dest)
             movq(src, dest);
         shrq(Imm32(JSVAL_TAG_SHIFT), dest);
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -47,16 +47,17 @@ class MacroAssemblerX86 : public MacroAs
         return Operand(address.base, address.index, address.scale, address.offset + 4);
     }
 
     void setupABICall(uint32_t args);
 
   public:
     using MacroAssemblerX86Shared::load32;
     using MacroAssemblerX86Shared::store32;
+    using MacroAssemblerX86Shared::store16;
     using MacroAssemblerX86Shared::call;
 
     MacroAssemblerX86()
     {
     }
 
     // The buffer is about to be linked, make sure any constant pools or excess
     // bookkeeping has been flushed to the instruction stream.
@@ -639,16 +640,19 @@ class MacroAssemblerX86 : public MacroAs
         movl(src, dest);
     }
     void storePtr(Register src, AbsoluteAddress address) {
         movl(src, Operand(address));
     }
     void store32(Register src, AbsoluteAddress address) {
         movl(src, Operand(address));
     }
+    void store16(Register src, AbsoluteAddress address) {
+        movw(src, Operand(address));
+    }
     void store64(Register64 src, Address address) {
         movl(src.low, Operand(address));
         movl(src.high, Operand(Address(address.base, address.offset + 4)));
     }
 
     void setStackArg(Register reg, uint32_t arg) {
         movl(reg, Operand(esp, arg * sizeof(intptr_t)));
     }