Bug 1213146 - IonMonkey: MIPS: Fix build failure caused by bug 1194139. r=nbp
authorHeiher <r@hev.cc>
Sun, 01 Nov 2015 05:10:01 +0800
changeset 304724 7459205ed7c350bf073f009aee259762fa5cd760
parent 304723 5649b6b8cec386092fea92be17d0963050ffc1f7
child 304725 ffaccc986c34b637cd76d2e6b0d06ac5b9196895
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1213146, 1194139
milestone45.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 1213146 - IonMonkey: MIPS: Fix build failure caused by bug 1194139. r=nbp --- js/src/jit/mips-shared/Architecture-mips-shared.h | 12 +++--- js/src/jit/mips-shared/Assembler-mips-shared.h | 38 ------------------- js/src/jit/mips32/Architecture-mips32.cpp | 17 +++++++++ js/src/jit/mips32/Architecture-mips32.h | 17 --------- js/src/jit/mips32/Assembler-mips32.h | 46 +++++++++++++++++++---- js/src/jit/mips64/Architecture-mips64.cpp | 17 +++++++++ js/src/jit/mips64/Architecture-mips64.h | 17 --------- js/src/jit/mips64/Assembler-mips64.h | 45 ++++++++++++++++++---- 8 files changed, 117 insertions(+), 92 deletions(-)
js/src/jit/mips-shared/Architecture-mips-shared.h
js/src/jit/mips-shared/Assembler-mips-shared.h
js/src/jit/mips32/Architecture-mips32.cpp
js/src/jit/mips32/Architecture-mips32.h
js/src/jit/mips32/Assembler-mips32.h
js/src/jit/mips64/Architecture-mips64.cpp
js/src/jit/mips64/Architecture-mips64.h
js/src/jit/mips64/Assembler-mips64.h
--- a/js/src/jit/mips-shared/Architecture-mips-shared.h
+++ b/js/src/jit/mips-shared/Architecture-mips-shared.h
@@ -123,37 +123,37 @@ class Registers
     typedef uint8_t Code;
     typedef RegisterID Encoding;
 
     // Content spilled during bailouts.
     union RegisterContent {
         uintptr_t r;
     };
 
+    static const char * const RegNames[];
     static const char* GetName(Code code) {
         MOZ_ASSERT(code < Total);
-        static const char * const Names[] = REGISTERS_NAMES;
-        return Names[code];
+        return RegNames[code];
     }
     static const char* GetName(Encoding i) {
         return GetName(Code(i));
     }
 
     static Code FromName(const char* name);
 
     static const Encoding StackPointer = sp;
     static const Encoding Invalid = invalid_reg;
 
     static const uint32_t Total = 32;
-    static const uint32_t Allocatable = REGISTERS_ALLOCATABLE;
+    static const uint32_t Allocatable;
 
     typedef uint32_t SetType;
     static const SetType AllMask = 0xffffffff;
     static const SetType SharedArgRegMask = (1 << a0) | (1 << a1) | (1 << a2) | (1 << a3);
-    static const SetType ArgRegMask = REGISTERS_ARGREGMASK;
+    static const SetType ArgRegMask;
 
     static const SetType VolatileMask =
         (1 << Registers::v0) |
         (1 << Registers::v1) |
         (1 << Registers::a0) |
         (1 << Registers::a1) |
         (1 << Registers::a2) |
         (1 << Registers::a3) |
@@ -195,21 +195,21 @@ class Registers
         (1 << Registers::sp) |
         (1 << Registers::fp) |
         (1 << Registers::ra);
 
     // Registers that can be allocated without being saved, generally.
     static const SetType TempMask = VolatileMask & ~NonAllocatableMask;
 
     // Registers returned from a JS -> JS call.
-    static const SetType JSCallMask = REGISTERS_JSCALLMASK;
+    static const SetType JSCallMask;
 
     // Registers returned from a JS -> C call.
     static const SetType SharedCallMask = (1 << Registers::v0);
-    static const SetType CallMask = REGISTERS_CALLMASK;
+    static const SetType CallMask;
 
     static const SetType AllocatableMask = AllMask & ~NonAllocatableMask;
 
     static uint32_t SetSize(SetType x) {
         static_assert(sizeof(SetType) == 4, "SetType must be 32 bits");
         return mozilla::CountPopulation32(x);
     }
     static uint32_t FirstBit(SetType x) {
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -90,18 +90,16 @@ static MOZ_CONSTEXPR_VAR Register IntArg
 static MOZ_CONSTEXPR_VAR Register IntArgReg2 = a2;
 static MOZ_CONSTEXPR_VAR Register IntArgReg3 = a3;
 static MOZ_CONSTEXPR_VAR Register IntArgReg4 = a4;
 static MOZ_CONSTEXPR_VAR Register IntArgReg5 = a5;
 static MOZ_CONSTEXPR_VAR Register IntArgReg6 = a6;
 static MOZ_CONSTEXPR_VAR Register IntArgReg7 = a7;
 static MOZ_CONSTEXPR_VAR Register GlobalReg = s6; // used by Odin
 static MOZ_CONSTEXPR_VAR Register HeapReg = s7; // used by Odin
-static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = CALL_TEMP_NON_ARG_REGS;
-static const uint32_t NumCallTempNonArgRegs = mozilla::ArrayLength(CallTempNonArgRegs);
 
 static MOZ_CONSTEXPR_VAR Register PreBarrierReg = a1;
 
 static MOZ_CONSTEXPR_VAR Register InvalidReg = { Registers::invalid_reg };
 static MOZ_CONSTEXPR_VAR FloatRegister InvalidFloatReg;
 
 static MOZ_CONSTEXPR_VAR Register StackPointer = sp;
 static MOZ_CONSTEXPR_VAR Register FramePointer = InvalidReg;
@@ -1312,48 +1310,12 @@ class InstJump : public Instruction
       : Instruction(op | off.encode())
     { }
 
     uint32_t extractImm26Value() {
         return extractBitField(Imm26Shift + Imm26Bits - 1, Imm26Shift);
     }
 };
 
-static const uint32_t NumIntArgRegs = NUM_INT_ARG_REGS;
-
-static inline bool
-GetIntArgReg(uint32_t usedArgSlots, Register* out)
-{
-    if (usedArgSlots < NumIntArgRegs) {
-        *out = Register::FromCode(a0.code() + usedArgSlots);
-        return true;
-    }
-    return false;
-}
-
-// 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
-GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register* out)
-{
-    // NOTE: We can't properly determine which regs are used if there are
-    // float arguments. If this is needed, we will have to guess.
-    MOZ_ASSERT(usedFloatArgs == 0);
-
-    if (GetIntArgReg(usedIntArgs, out))
-        return true;
-    // Unfortunately, we have to assume things about the point at which
-    // GetIntArgReg returns false, because we need to know how many registers it
-    // can allocate.
-    usedIntArgs -= NumIntArgRegs;
-    if (usedIntArgs >= NumCallTempNonArgRegs)
-        return false;
-    *out = CallTempNonArgRegs[usedIntArgs];
-    return true;
-}
-
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_Assembler_mips_shared_h */
--- a/js/src/jit/mips32/Architecture-mips32.cpp
+++ b/js/src/jit/mips32/Architecture-mips32.cpp
@@ -6,16 +6,33 @@
 
 #include "jit/mips32/Architecture-mips32.h"
 
 #include "jit/RegisterSets.h"
 
 namespace js {
 namespace jit {
 
+const char * const Registers::RegNames[] = { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+                                             "t0",   "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+                                             "s0",   "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+                                             "t8",   "t9", "k0", "k1", "gp", "sp", "fp", "ra" };
+
+const uint32_t Allocatable = 14;
+
+const Registers::SetType Registers::ArgRegMask = Registers::SharedArgRegMask;
+
+const Registers::SetType Registers::JSCallMask =
+    (1 << Registers::a2) |
+    (1 << Registers::a3);
+
+const Registers::SetType Registers::CallMask =
+    (1 << Registers::v0) |
+    (1 << Registers::v1);  // used for double-size returns
+
 FloatRegisters::Code
 FloatRegisters::FromName(const char* name)
 {
     for (size_t i = 0; i < Total; i++) {
         if (strcmp(GetName(i), name) == 0)
             return Code(i);
     }
 
--- a/js/src/jit/mips32/Architecture-mips32.h
+++ b/js/src/jit/mips32/Architecture-mips32.h
@@ -7,33 +7,16 @@
 #ifndef jit_mips32_Architecture_mips32_h
 #define jit_mips32_Architecture_mips32_h
 
 #include "mozilla/MathAlgorithms.h"
 
 #include <limits.h>
 #include <stdint.h>
 
-#define REGISTERS_NAMES         \
-    { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
-      "t0",   "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
-      "s0",   "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
-      "t8",   "t9", "k0", "k1", "gp", "sp", "fp", "ra"};
-
-#define REGISTERS_ALLOCATABLE   14
-#define REGISTERS_ARGREGMASK    SharedArgRegMask
-
-#define REGISTERS_JSCALLMASK    \
-    (1 << Registers::a2) |      \
-    (1 << Registers::a3);
-
-#define REGISTERS_CALLMASK      \
-    (1 << Registers::v0) |      \
-    (1 << Registers::v1);  // used for double-size returns
-
 #include "jit/mips-shared/Architecture-mips-shared.h"
 
 #include "js/Utility.h"
 
 namespace js {
 namespace jit {
 
 // Shadow stack space is not required on MIPS.
--- a/js/src/jit/mips32/Assembler-mips32.h
+++ b/js/src/jit/mips32/Assembler-mips32.h
@@ -2,33 +2,29 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_mips32_Assembler_mips32_h
 #define jit_mips32_Assembler_mips32_h
 
-// NOTE: Don't use these macros directly
-// CallTempNonArgRegs
-#define CALL_TEMP_NON_ARG_REGS  \
-    { t0, t1, t2, t3, t4 };
-// NumIntArgRegs
-#define NUM_INT_ARG_REGS        4;
-
 #include "jit/mips-shared/Assembler-mips-shared.h"
 
 #include "jit/mips32/Architecture-mips32.h"
 
 namespace js {
 namespace jit {
 
 static MOZ_CONSTEXPR_VAR Register CallTempReg4 = t4;
 static MOZ_CONSTEXPR_VAR Register CallTempReg5 = t5;
 
+static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { t0, t1, t2, t3, t4 };
+static const uint32_t NumCallTempNonArgRegs = mozilla::ArrayLength(CallTempNonArgRegs);
+
 class ABIArgGenerator
 {
     unsigned usedArgSlots_;
     unsigned firstArgFloatSize_;
     // Note: This is not compliant with the system ABI.  The Lowering phase
     // expects to lower an MAsmJSParameter to only one register.
     bool useGPRForFloats_;
     ABIArg current_;
@@ -154,16 +150,52 @@ class Assembler : public AssemblerMIPSSh
     static void PatchInstructionImmediate(uint8_t* code, PatchedImmPtr imm);
 
     static void ToggleCall(CodeLocationLabel inst_, bool enabled);
 
     static void UpdateBoundsCheck(uint32_t logHeapSize, Instruction* inst);
     static int32_t ExtractCodeLabelOffset(uint8_t* code);
 }; // Assembler
 
+static const uint32_t NumIntArgRegs = 4;
+
+static inline bool
+GetIntArgReg(uint32_t usedArgSlots, Register* out)
+{
+    if (usedArgSlots < NumIntArgRegs) {
+        *out = Register::FromCode(a0.code() + usedArgSlots);
+        return true;
+    }
+    return false;
+}
+
+// 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
+GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register* out)
+{
+    // NOTE: We can't properly determine which regs are used if there are
+    // float arguments. If this is needed, we will have to guess.
+    MOZ_ASSERT(usedFloatArgs == 0);
+
+    if (GetIntArgReg(usedIntArgs, out))
+        return true;
+    // Unfortunately, we have to assume things about the point at which
+    // GetIntArgReg returns false, because we need to know how many registers it
+    // can allocate.
+    usedIntArgs -= NumIntArgRegs;
+    if (usedIntArgs >= NumCallTempNonArgRegs)
+        return false;
+    *out = CallTempNonArgRegs[usedIntArgs];
+    return true;
+}
+
 static inline uint32_t
 GetArgStackDisp(uint32_t usedArgSlots)
 {
     MOZ_ASSERT(usedArgSlots >= NumIntArgRegs);
     // Even register arguments have place reserved on stack.
     return usedArgSlots * sizeof(intptr_t);
 }
 
--- a/js/src/jit/mips64/Architecture-mips64.cpp
+++ b/js/src/jit/mips64/Architecture-mips64.cpp
@@ -6,16 +6,33 @@
 
 #include "jit/mips64/Architecture-mips64.h"
 
 #include "jit/RegisterSets.h"
 
 namespace js {
 namespace jit {
 
+const char * const Registers::RegNames[] = { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+                                             "a4",   "a5", "a6", "a7", "t0", "t1", "t2", "t3",
+                                             "s0",   "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+                                             "t8",   "t9", "k0", "k1", "gp", "sp", "fp", "ra" };
+
+const uint32_t Allocatable = 22;
+
+const Registers::SetType Registers::ArgRegMask =
+    Registers::SharedArgRegMask |
+    (1 << a4) | (1 << a5) | (1 << a6) | (1 << a7);
+
+const Registers::SetType Registers::JSCallMask =
+    (1 << Registers::v1);
+
+const Registers::SetType Registers::CallMask =
+    (1 << Registers::v0);
+
 FloatRegisters::Encoding
 FloatRegisters::FromName(const char* name)
 {
     for (size_t i = 0; i < Total; i++) {
         if (strcmp(GetName(Encoding(i)), name) == 0)
             return Encoding(i);
     }
 
--- a/js/src/jit/mips64/Architecture-mips64.h
+++ b/js/src/jit/mips64/Architecture-mips64.h
@@ -7,33 +7,16 @@
 #ifndef jit_mips64_Architecture_mips64_h
 #define jit_mips64_Architecture_mips64_h
 
 #include "mozilla/MathAlgorithms.h"
 
 #include <limits.h>
 #include <stdint.h>
 
-#define REGISTERS_NAMES         \
-    { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
-      "a4",   "a5", "a6", "a7", "t0", "t1", "t2", "t3", \
-      "s0",   "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
-      "t8",   "t9", "k0", "k1", "gp", "sp", "fp", "ra"};
-
-#define REGISTERS_ALLOCATABLE   22
-#define REGISTERS_ARGREGMASK    \
-    SharedArgRegMask |          \
-    (1 << a4) | (1 << a5) | (1 << a6) | (1 << a7);
-
-#define REGISTERS_JSCALLMASK    \
-    (1 << Registers::v1);
-
-#define REGISTERS_CALLMASK      \
-    (1 << Registers::v0);
-
 #include "jit/mips-shared/Architecture-mips-shared.h"
 
 #include "js/Utility.h"
 
 namespace js {
 namespace jit {
 
 // Shadow stack space is not required on MIPS64.
--- a/js/src/jit/mips64/Assembler-mips64.h
+++ b/js/src/jit/mips64/Assembler-mips64.h
@@ -2,33 +2,29 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_mips64_Assembler_mips64_h
 #define jit_mips64_Assembler_mips64_h
 
-// NOTE: Don't use these macros directly
-// CallTempNonArgRegs
-#define CALL_TEMP_NON_ARG_REGS  \
-    { t0, t1, t2, t3 };
-// NumIntArgRegs
-#define NUM_INT_ARG_REGS        8;
-
 #include "jit/mips-shared/Assembler-mips-shared.h"
 
 #include "jit/mips64/Architecture-mips64.h"
 
 namespace js {
 namespace jit {
 
 static MOZ_CONSTEXPR_VAR Register CallTempReg4 = a4;
 static MOZ_CONSTEXPR_VAR Register CallTempReg5 = a5;
 
+static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { t0, t1, t2, t3 };
+static const uint32_t NumCallTempNonArgRegs = mozilla::ArrayLength(CallTempNonArgRegs);
+
 class ABIArgGenerator
 {
     unsigned usedArgSlots_;
     bool firstArgFloat;
     ABIArg current_;
 
   public:
     ABIArgGenerator();
@@ -156,28 +152,63 @@ class Assembler : public AssemblerMIPSSh
     static void PatchInstructionImmediate(uint8_t* code, PatchedImmPtr imm);
 
     static void ToggleCall(CodeLocationLabel inst_, bool enabled);
 
     static void UpdateBoundsCheck(uint64_t logHeapSize, Instruction* inst);
     static int64_t ExtractCodeLabelOffset(uint8_t* code);
 }; // Assembler
 
+static const uint32_t NumIntArgRegs = 8;
 static const uint32_t NumFloatArgRegs = NumIntArgRegs;
 
 static inline bool
+GetIntArgReg(uint32_t usedArgSlots, Register* out)
+{
+    if (usedArgSlots < NumIntArgRegs) {
+        *out = Register::FromCode(a0.code() + usedArgSlots);
+        return true;
+    }
+    return false;
+}
+
+static inline bool
 GetFloatArgReg(uint32_t usedArgSlots, FloatRegister* out)
 {
     if (usedArgSlots < NumFloatArgRegs) {
         *out = FloatRegister::FromCode(f12.code() + usedArgSlots);
         return true;
     }
     return false;
 }
 
+// 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
+GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register* out)
+{
+    // NOTE: We can't properly determine which regs are used if there are
+    // float arguments. If this is needed, we will have to guess.
+    MOZ_ASSERT(usedFloatArgs == 0);
+
+    if (GetIntArgReg(usedIntArgs, out))
+        return true;
+    // Unfortunately, we have to assume things about the point at which
+    // GetIntArgReg returns false, because we need to know how many registers it
+    // can allocate.
+    usedIntArgs -= NumIntArgRegs;
+    if (usedIntArgs >= NumCallTempNonArgRegs)
+        return false;
+    *out = CallTempNonArgRegs[usedIntArgs];
+    return true;
+}
+
 static inline uint32_t
 GetArgStackDisp(uint32_t usedArgSlots)
 {
     MOZ_ASSERT(usedArgSlots >= NumIntArgRegs);
     return (usedArgSlots - NumIntArgRegs) * sizeof(int64_t);
 }
 
 } // namespace jit