Bug 883574 - Add const qualifiers to variables and pointers in the JS tree. r=evilpies
authorDan Gohman <sunfish@google.com>
Mon, 17 Jun 2013 18:31:47 -0700
changeset 146890 b4967e7c6da70ea226bf04f027ddc9761217b1d7
parent 146889 0ebce5e16ea6f0e97adacad894bb2a103fd60083
child 146891 1e93bc25a700947d06b623707689e687b4f882d3
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpies
bugs883574
milestone24.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 883574 - Add const qualifiers to variables and pointers in the JS tree. r=evilpies
js/jsd/jsd_text.cpp
js/src/TraceLogging.cpp
js/src/TraceLogging.h
js/src/assembler/assembler/ARMAssembler.h
js/src/assembler/assembler/AbstractMacroAssembler.h
js/src/assembler/assembler/MacroAssemblerARM.h
js/src/assembler/assembler/MacroAssemblerARMv7.h
js/src/assembler/assembler/MacroAssemblerCodeRef.h
js/src/assembler/assembler/MacroAssemblerMIPS.h
js/src/assembler/assembler/MacroAssemblerSparc.h
js/src/assembler/assembler/MacroAssemblerX86_64.h
js/src/assembler/assembler/SparcAssembler.h
js/src/assembler/assembler/X86Assembler.h
js/src/builtin/embedjs.py
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/ParseNode.cpp
js/src/frontend/SourceNotes.h
js/src/gc/Statistics.cpp
js/src/ion/IonCaches.cpp
js/src/ion/IonSpewer.cpp
js/src/ion/LIR.cpp
js/src/ion/LiveRangeAllocator.h
js/src/ion/MIR.cpp
js/src/ion/RegisterAllocator.h
js/src/ion/VMFunctions.cpp
js/src/ion/arm/Architecture-arm.h
js/src/ion/x64/Architecture-x64.h
js/src/ion/x86/Architecture-x86.h
js/src/jsapi-tests/testArgumentsObject.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsatom.cpp
js/src/jsatom.h
js/src/jsdate.cpp
js/src/jsexn.cpp
js/src/jsgc.cpp
js/src/jsgcinlines.h
js/src/jsinfer.cpp
js/src/jsmath.cpp
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsreflect.cpp
js/src/jsreflect.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/shell/js.cpp
js/src/shell/jsoptparse.cpp
js/src/yarr/YarrCanonicalizeUCS2.cpp
js/src/yarr/YarrCanonicalizeUCS2.h
js/src/yarr/YarrPattern.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCException.cpp
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/jsd/jsd_text.cpp
+++ b/js/jsd/jsd_text.cpp
@@ -167,17 +167,17 @@ strncasecomp (const char* one, const cha
         if (!(*pA && *pB)) 
             return *pA - *pB;
         tmp = tolower(*pA) - tolower(*pB);
         if (tmp) 
             return tmp;
     }
 }
 
-static char file_url_prefix[]    = "file:";
+static const char file_url_prefix[] = "file:";
 #define FILE_URL_PREFIX_LEN     (sizeof file_url_prefix - 1)
 
 char*
 jsd_BuildNormalizedURL( const char* url_string )
 {
     char *new_url_string;
 
     if( ! url_string )
--- a/js/src/TraceLogging.cpp
+++ b/js/src/TraceLogging.cpp
@@ -56,17 +56,17 @@ js::rdtsc(void)
     result = upper;
     result = result<<32;
     result = result|lower;
 
     return(result);
 }
 #endif
 
-const char* TraceLogging::type_name[] = {
+const char* const TraceLogging::type_name[] = {
     "start,ion_compile",
     "stop,ion_compile",
     "start,ion_cannon",
     "stop,ion_cannon",
     "stop,ion_cannon_bailout",
     "start,ion_side_cannon",
     "stop,ion_side_cannon",
     "stop,ion_side_cannon_bailout",
--- a/js/src/TraceLogging.h
+++ b/js/src/TraceLogging.h
@@ -56,17 +56,17 @@ class TraceLogging
 
     uint64_t loggingTime;
     Entry *entries;
     unsigned int curEntry;
     unsigned int numEntries;
     int fileno;
     FILE *out;
 
-    const static char *type_name[];
+    static const char * const type_name[];
     static TraceLogging* _defaultLogger;
   public:
     TraceLogging();
     ~TraceLogging();
 
     void log(Type type, const char* filename, unsigned int line);
     void log(Type type, JSScript* script);
     void log(const char* log);
--- a/js/src/assembler/assembler/ARMAssembler.h
+++ b/js/src/assembler/assembler/ARMAssembler.h
@@ -1198,46 +1198,46 @@ namespace JSC {
             return AL | B | (offset & BRANCH_MASK);
         }
 
         // pretty-printing functions
         static char const * nameGpReg(int reg)
         {
             ASSERT(reg <= 16);
             ASSERT(reg >= 0);
-            static char const * names[] = {
+            static char const * const names[] = {
                 "r0", "r1", "r2", "r3",
                 "r4", "r5", "r6", "r7",
                 "r8", "r9", "r10", "r11",
                 "ip", "sp", "lr", "pc"
             };
             return names[reg];
         }
 
         static char const * nameFpRegD(int reg)
         {
             ASSERT(reg <= 31);
             ASSERT(reg >= 0);
-            static char const * names[] = {
+            static char const * const names[] = {
                  "d0",   "d1",   "d2",   "d3",
                  "d4",   "d5",   "d6",   "d7",
                  "d8",   "d9",  "d10",  "d11",
                 "d12",  "d13",  "d14",  "d15",
                 "d16",  "d17",  "d18",  "d19",
                 "d20",  "d21",  "d22",  "d23",
                 "d24",  "d25",  "d26",  "d27",
                 "d28",  "d29",  "d30",  "d31"
             };
             return names[reg];
         }
         static char const * nameFpRegS(int reg)
         {
             ASSERT(reg <= 31);
             ASSERT(reg >= 0);
-            static char const * names[] = {
+            static char const * const names[] = {
                  "s0",   "s1",   "s2",   "s3",
                  "s4",   "s5",   "s6",   "s7",
                  "s8",   "s9",  "s10",  "s11",
                 "s12",  "s13",  "s14",  "s15",
                 "s16",  "s17",  "s18",  "s19",
                 "s20",  "s21",  "s22",  "s23",
                 "s24",  "s25",  "s26",  "s27",
                 "s28",  "s29",  "s30",  "s31"
@@ -1246,17 +1246,17 @@ namespace JSC {
         }
 
         static char const * nameCC(Condition cc)
         {
             ASSERT(cc <= AL);
             ASSERT((cc & 0x0fffffff) == 0);
 
             uint32_t    ccIndex = cc >> 28;
-            static char const * names[] = {
+            static char const * const names[] = {
                 "eq", "ne",
                 "cs", "cc",
                 "mi", "pl",
                 "vs", "vc",
                 "hi", "ls",
                 "ge", "lt",
                 "gt", "le",
                 "  "        // AL is the default, so don't show it.
--- a/js/src/assembler/assembler/AbstractMacroAssembler.h
+++ b/js/src/assembler/assembler/AbstractMacroAssembler.h
@@ -152,22 +152,22 @@ public:
         int32_t offset;
     };
 
     // AbsoluteAddress:
     //
     // Describes an memory operand given by a pointer.  For regular load & store
     // operations an unwrapped void* will be used, rather than using this.
     struct AbsoluteAddress {
-        explicit AbsoluteAddress(void* ptr)
+        explicit AbsoluteAddress(const void* ptr)
             : m_ptr(ptr)
         {
         }
 
-        void* m_ptr;
+        const void* m_ptr;
     };
 
     // TrustedImmPtr:
     //
     // A pointer sized immediate operand to an instruction - this is wrapped
     // in a class requiring explicit construction in order to differentiate
     // from pointers used as absolute addresses to memory operations
     struct TrustedImmPtr {
@@ -403,22 +403,22 @@ public:
         {
         }
         
         Jump(JmpSrc jmp)    
             : m_jmp(jmp)
         {
         }
         
-        void link(AbstractMacroAssembler<AssemblerType>* masm)
+        void link(AbstractMacroAssembler<AssemblerType>* masm) const
         {
             masm->m_assembler.linkJump(m_jmp, masm->m_assembler.label());
         }
         
-        void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm)
+        void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm) const
         {
             masm->m_assembler.linkJump(m_jmp, label.m_label);
         }
 
         bool isSet() const { return m_jmp.isSet(); }
 
     private:
         JmpSrc m_jmp;
--- a/js/src/assembler/assembler/MacroAssemblerARM.h
+++ b/js/src/assembler/assembler/MacroAssemblerARM.h
@@ -1024,17 +1024,17 @@ public:
     {
         m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
         m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
         sub32(imm, ARMRegisters::S1);
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address.m_ptr));
         m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
     }
 
-    void load32(void* address, RegisterID dest)
+    void load32(const void* address, RegisterID dest)
     {
         m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
         m_assembler.dtr_u(true, dest, ARMRegisters::S0, 0);
     }
 
     Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
     {
         load32(left.m_ptr, ARMRegisters::S1);
--- a/js/src/assembler/assembler/MacroAssemblerARMv7.h
+++ b/js/src/assembler/assembler/MacroAssemblerARMv7.h
@@ -428,17 +428,17 @@ public:
         load32(setupArmAddress(address), dest);
     }
 
     void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
     {
         load32(setupArmAddress(address), dest);
     }
 
-    void load32(void* address, RegisterID dest)
+    void load32(const void* address, RegisterID dest)
     {
         move(ImmPtr(address), addressTempRegister);
         m_assembler.ldr(dest, addressTempRegister, ARMThumbImmediate::makeUInt16(0));
     }
 
     void load8(ImplicitAddress address, RegisterID dest)
     {
         load8(setupArmAddress(address), dest);
--- a/js/src/assembler/assembler/MacroAssemblerCodeRef.h
+++ b/js/src/assembler/assembler/MacroAssemblerCodeRef.h
@@ -151,17 +151,17 @@ public:
     }
 #if WTF_CPU_ARM_THUMB2
     // To use this pointer as a data address remove the decoration.
     void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast<char*>(m_value) - 1; }
 #else
     void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; }
 #endif
 
-    bool operator!()
+    bool operator!() const
     {
         return !m_value;
     }
 
     ptrdiff_t operator -(const MacroAssemblerCodePtr &other) const
     {
         JS_ASSERT(m_value);
         return reinterpret_cast<uint8_t *>(m_value) -
--- a/js/src/assembler/assembler/MacroAssemblerMIPS.h
+++ b/js/src/assembler/assembler/MacroAssemblerMIPS.h
@@ -856,17 +856,17 @@ public:
             m_assembler.lwr(dest, addrTempRegister, 3);
 #else
             m_assembler.lwl(dest, addrTempRegister, 3);
             m_assembler.lwr(dest, addrTempRegister, 0);
 #endif
         }
     }
 
-    void load32(void* address, RegisterID dest)
+    void load32(const void* address, RegisterID dest)
     {
         /*
             li  addrTemp, address
             lw  dest, 0(addrTemp)
         */
         move(ImmPtr(address), addrTempRegister);
         m_assembler.lw(dest, addrTempRegister, 0);
     }
--- a/js/src/assembler/assembler/MacroAssemblerSparc.h
+++ b/js/src/assembler/assembler/MacroAssemblerSparc.h
@@ -1019,17 +1019,17 @@ namespace JSC {
 
         void sub32(TrustedImm32 imm, AbsoluteAddress address)
         {
             load32(address.m_ptr, SparcRegisters::g2);
             sub32(imm, SparcRegisters::g2);
             store32(SparcRegisters::g2, address.m_ptr);
         }
 
-        void load32(void* address, RegisterID dest)
+        void load32(const void* address, RegisterID dest)
         {
             m_assembler.move_nocheck((int)address, SparcRegisters::g3);
             m_assembler.lduw_r(SparcRegisters::g3, SparcRegisters::g0, dest);
         }
 
         Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
         {
             load32(left.m_ptr, SparcRegisters::g2);
--- a/js/src/assembler/assembler/MacroAssemblerX86_64.h
+++ b/js/src/assembler/assembler/MacroAssemblerX86_64.h
@@ -81,17 +81,17 @@ public:
     }
 
     void sub32(TrustedImm32 imm, AbsoluteAddress address)
     {
         move(ImmPtr(address.m_ptr), scratchRegister);
         sub32(imm, Address(scratchRegister));
     }
 
-    void load32(void* address, RegisterID dest)
+    void load32(const void* address, RegisterID dest)
     {
         if (dest == X86Registers::eax)
             m_assembler.movl_mEAX(address);
         else {
             move(ImmPtr(address), scratchRegister);
             load32(ImplicitAddress(scratchRegister), dest);
         }
     }
@@ -100,17 +100,17 @@ public:
     {
         DataLabelPtr label = moveWithPatch(ImmPtr(address), scratchRegister);
         loadDouble(scratchRegister, dest);
         return label;
     }
 
     void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
     {
-        move(Imm32(*static_cast<int32_t*>(src.m_ptr)), scratchRegister);
+        move(Imm32(*static_cast<const int32_t*>(src.m_ptr)), scratchRegister);
         m_assembler.cvtsi2sd_rr(scratchRegister, dest);
     }
 
     void convertUInt32ToDouble(RegisterID srcDest, FPRegisterID dest)
     {
         zeroExtend32ToPtr(srcDest, srcDest);
         zeroDouble(dest); // break dependency chains
         m_assembler.cvtsq2sd_rr(srcDest, dest);
@@ -292,17 +292,17 @@ public:
         m_assembler.movq_mr(address.offset, address.base, dest);
     }
 
     void loadPtr(BaseIndex address, RegisterID dest)
     {
         m_assembler.movq_mr(address.offset, address.base, address.index, address.scale, dest);
     }
 
-    void loadPtr(void* address, RegisterID dest)
+    void loadPtr(const void* address, RegisterID dest)
     {
         if (dest == X86Registers::eax)
             m_assembler.movq_mEAX(address);
         else {
             move(ImmPtr(address), scratchRegister);
             loadPtr(ImplicitAddress(scratchRegister), dest);
         }
     }
--- a/js/src/assembler/assembler/SparcAssembler.h
+++ b/js/src/assembler/assembler/SparcAssembler.h
@@ -1135,34 +1135,34 @@ namespace JSC {
             ExecutableAllocator::cacheFlush(where, 4);
         }
 
     private:
         static char const * nameGpReg(int reg)
         {
             ASSERT(reg <= 31);
             ASSERT(reg >= 0);
-            static char const * names[] = {
+            static char const * const names[] = {
                 "%g0", "%g1", "%g2", "%g3",
                 "%g4", "%g5", "%g6", "%g7",
                 "%o0", "%o1", "%o2", "%o3",
                 "%o4", "%o5", "%sp", "%o7",
                 "%l0", "%l1", "%l2", "%l3",
                 "%l4", "%l5", "%l6", "%l7",
                 "%i0", "%i1", "%i2", "%i3",
                 "%i4", "%i5", "%fp", "%i7"
             };
             return names[reg];
         }
 
         static char const * nameFpReg(int reg)
         {
             ASSERT(reg <= 31);
             ASSERT(reg >= 0);
-            static char const * names[] = {
+            static char const * const names[] = {
                 "%f0",   "%f1",   "%f2",   "%f3",
                 "%f4",   "%f5",   "%f6",   "%f7",
                 "%f8",   "%f9",  "%f10",  "%f11",
                 "%f12",  "%f13",  "%f14",  "%f15",
                 "%f16",  "%f17",  "%f18",  "%f19",
                 "%f20",  "%f21",  "%f22",  "%f23",
                 "%f24",  "%f25",  "%f26",  "%f27",
                 "%f28",  "%f29",  "%f30",  "%f31"
@@ -1171,17 +1171,17 @@ namespace JSC {
         }
 
         static char const * nameICC(Condition cc)
         {
             ASSERT(cc <= ConditionVC);
             ASSERT(cc >= 0);
 
             uint32_t    ccIndex = cc;
-            static char const * inames[] = {
+            static char const * const inames[] = {
                 "   ", "e  ",
                 "le ", "l  ",
                 "leu", "cs ",
                 "neg", "vs ",
                 "a  ", "ne ",
                 "g  ", "ge ",
                 "gu ", "cc ",
                 "   ", "vc "
@@ -1190,17 +1190,17 @@ namespace JSC {
         }
 
         static char const * nameFCC(DoubleCondition cc)
         {
             ASSERT(cc <= DoubleConditionULE);
             ASSERT(cc >= 0);
 
             uint32_t    ccIndex = cc;
-            static char const * fnames[] = {
+            static char const * const fnames[] = {
                 "   ", "ne ",
                 "   ", "ul ",
                 "l  ", "ug ",
                 "g  ", "   ",
                 "   ", "e  ",
                 "ue ", "ge ",
                 "ugu", "le ",
                 "ule", "   "
--- a/js/src/assembler/assembler/X86Assembler.h
+++ b/js/src/assembler/assembler/X86Assembler.h
@@ -89,41 +89,41 @@ namespace X86Registers {
         xmm14,
         xmm15
 #endif
        ,invalid_xmm
     } XMMRegisterID;
 
     static const char* nameFPReg(XMMRegisterID fpreg)
     {
-        static const char* xmmnames[16]
+        static const char* const xmmnames[16]
           = { "%xmm0", "%xmm1", "%xmm2", "%xmm3",
               "%xmm4", "%xmm5", "%xmm6", "%xmm7",
               "%xmm8", "%xmm9", "%xmm10", "%xmm11",
               "%xmm12", "%xmm13", "%xmm14", "%xmm15" };
         int off = (XMMRegisterID)fpreg - (XMMRegisterID)xmm0;
         return (off < 0 || off > 15) ? "%xmm?" : xmmnames[off];
     }
 
     static const char* nameIReg(int szB, RegisterID reg)
     {
-        static const char* r64names[16]
+        static const char* const r64names[16]
           = { "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
               "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" };
-        static const char* r32names[16]
+        static const char* const r32names[16]
           = { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
               "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" };
-        static const char* r16names[16]
+        static const char* const r16names[16]
           = { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
               "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" };
-        static const char* r8names[16]
+        static const char* const r8names[16]
           = { "%al", "%cl", "%dl", "%bl", "%ah/spl", "%ch/bpl", "%dh/sil", "%bh/dil",
               "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" };
         int          off = (RegisterID)reg - (RegisterID)eax;
-        const char** tab = r64names;
+        const char* const* tab = r64names;
         switch (szB) {
             case 1: tab = r8names; break;
             case 2: tab = r16names; break;
             case 4: tab = r32names; break;
         }
         return (off < 0 || off > 15) ? "%r???" : tab[off];
     }
 
@@ -164,17 +164,17 @@ public:
         ConditionG,
 
         ConditionC  = ConditionB,
         ConditionNC = ConditionAE
     } Condition;
 
     static const char* nameCC(Condition cc)
     {
-        static const char* names[16]
+        static const char* const names[16]
           = { "o ", "no", "b ", "ae", "e ", "ne", "be", "a ",
               "s ", "ns", "p ", "np", "l ", "ge", "le", "g " };
         int ix = (int)cc;
         return (ix < 0 || ix > 15) ? "??" : names[ix];
     }
 
     // Rounding modes for ROUNDSD.
     typedef enum {
@@ -455,17 +455,17 @@ public:
     {
         spew("popf");
         m_formatter.oneByteOp(OP_POPFLAGS);
     }
 
     // Arithmetic operations:
 
 #if !WTF_CPU_X86_64
-    void adcl_im(int imm, void* addr)
+    void adcl_im(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADC, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADC, addr);
             m_formatter.immediate32(imm);
@@ -553,17 +553,17 @@ public:
             m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_ADD, base, offset);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_ADD, base, offset);
             m_formatter.immediate32(imm);
         }
     }
 #else
-    void addl_im(int imm, void* addr)
+    void addl_im(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADD, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADD, addr);
             m_formatter.immediate32(imm);
@@ -644,17 +644,17 @@ public:
             m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_AND, dst);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_AND, dst);
             m_formatter.immediate32(imm);
         }
     }
 #else
-    void andl_im(int imm, void* addr)
+    void andl_im(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_AND, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_AND, addr);
             m_formatter.immediate32(imm);
@@ -772,17 +772,17 @@ public:
     }
 
     void notq_r(RegisterID dst)
     {
         spew("notq       %s", nameIReg(8,dst));
         m_formatter.oneByteOp64(OP_GROUP3_Ev, GROUP3_OP_NOT, dst);
     }
 #else
-    void orl_im(int imm, void* addr)
+    void orl_im(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_OR, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_OR, addr);
             m_formatter.immediate32(imm);
@@ -857,17 +857,17 @@ public:
             m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_SUB, dst);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_SUB, dst);
             m_formatter.immediate32(imm);
         }
     }
 #else
-    void subl_im(int imm, void* addr)
+    void subl_im(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_SUB, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_SUB, addr);
             m_formatter.immediate32(imm);
@@ -1221,23 +1221,23 @@ public:
             m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
             m_formatter.immediate32(imm);
         }
     }
 #else
-    void cmpl_rm(RegisterID reg, void* addr)
+    void cmpl_rm(RegisterID reg, const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp(OP_CMP_EvGv, reg, addr);
     }
 
-    void cmpl_im(int imm, void* addr)
+    void cmpl_im(int imm, const void* addr)
     {
         spew("cmpl       $0x%x, 0x%p", imm, addr);
         if (CAN_SIGN_EXTEND_8_32(imm)) {
             m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, addr);
             m_formatter.immediate8(imm);
         } else {
             m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, addr);
             m_formatter.immediate32(imm);
@@ -1478,17 +1478,17 @@ public:
 
     void movl_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
     {
         spew("movl       %s, %d(%s,%s,%d)",
              nameIReg(4, src), offset, nameIReg(base), nameIReg(index), 1<<scale);
         m_formatter.oneByteOp(OP_MOV_EvGv, src, base, index, scale, offset);
     }
 
-    void movl_mEAX(void* addr)
+    void movl_mEAX(const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp(OP_MOV_EAXOv);
 #if WTF_CPU_X86_64
         m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
 #else
         m_formatter.immediate32(reinterpret_cast<int>(addr));
 #endif
@@ -1503,17 +1503,17 @@ public:
 
     void movl_mr_disp32(int offset, RegisterID base, RegisterID dst)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp_disp32(OP_MOV_GvEv, dst, base, offset);
     }
 
 #if WTF_CPU_X86
-    void movl_mr(void* base, RegisterID index, int scale, RegisterID dst)
+    void movl_mr(const void* base, RegisterID index, int scale, RegisterID dst)
     {
         spew("movl       %d(%s,%d), %s",
              int(base), nameIReg(index), scale, nameIReg(dst));
         m_formatter.oneByteOp_disp32(OP_MOV_GvEv, dst, index, scale, int(base));
     }
 #endif
 
     void movl_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
@@ -1576,17 +1576,17 @@ public:
     void movl_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale)
     {
         spew("movl       $0x%x, %d(%s,%s,%d)",
              imm, offset, nameIReg(base), nameIReg(index), 1<<scale);
         m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, base, index, scale, offset);
         m_formatter.immediate32(imm);
     }
 
-    void movl_EAXm(void* addr)
+    void movl_EAXm(const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp(OP_MOV_OvEAX);
 #if WTF_CPU_X86_64
         m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
 #else
         m_formatter.immediate32(reinterpret_cast<int>(addr));
 #endif
@@ -1615,24 +1615,24 @@ public:
 
     void movq_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
     {
         spew("movq       %s, %s0x%x(%s)",
              nameIReg(8,src), PRETTY_PRINT_OFFSET(offset), nameIReg(base));
         m_formatter.oneByteOp64(OP_MOV_EvGv, src, base, index, scale, offset);
     }
 
-    void movq_mEAX(void* addr)
+    void movq_mEAX(const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp64(OP_MOV_EAXOv);
         m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
     }
 
-    void movq_EAXm(void* addr)
+    void movq_EAXm(const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp64(OP_MOV_OvEAX);
         m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
     }
 
     void movq_mr(int offset, RegisterID base, RegisterID dst)
     {
@@ -1716,37 +1716,37 @@ public:
     JmpSrc movq_ripr(RegisterID dst)
     {
         spew("movl       \?(%%rip), %s",
              nameIReg(dst));
         m_formatter.oneByteRipOp64(OP_MOV_GvEv, dst, 0);
         return JmpSrc(m_formatter.size());
     }
 #else
-    void movl_rm(RegisterID src, void* addr)
+    void movl_rm(RegisterID src, const void* addr)
     {
         spew("movl       %s, 0(%p)",
              nameIReg(4, src), addr);
         if (src == X86Registers::eax)
             movl_EAXm(addr);
         else
             m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
     }
 
-    void movl_mr(void* addr, RegisterID dst)
+    void movl_mr(const void* addr, RegisterID dst)
     {
         spew("movl       0(%p), %s",
              addr, nameIReg(4, dst));
         if (dst == X86Registers::eax)
             movl_mEAX(addr);
         else
             m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
     }
 
-    void movl_i32m(int imm, void* addr)
+    void movl_i32m(int imm, const void* addr)
     {
         FIXME_INSN_PRINTING;
         m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, addr);
         m_formatter.immediate32(imm);
     }
 #endif
 
     void movb_rm(RegisterID src, int offset, RegisterID base)
@@ -2165,17 +2165,17 @@ public:
     {
         spew("cvtsi2sd   %d(%s,%s,%d), %s",
              offset, nameIReg(base), nameIReg(index), 1<<scale, nameFPReg(dst));
         m_formatter.prefix(PRE_SSE_F2);
         m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, base, index, scale, offset);
     }
 
 #if !WTF_CPU_X86_64
-    void cvtsi2sd_mr(void* address, XMMRegisterID dst)
+    void cvtsi2sd_mr(const void* address, XMMRegisterID dst)
     {
         spew("cvtsi2sd   %p, %s",
              address, nameFPReg(dst));
         m_formatter.prefix(PRE_SSE_F2);
         m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, address);
     }
 #endif
 
@@ -2766,17 +2766,17 @@ public:
 
     static void repatchInt32(void* where, int32_t value)
     {
         staticSpew("##relinkInt32 ((where=%p)) ((value=%d))",
                    where, value);
         setInt32(where, value);
     }
 
-    static void repatchPointer(void* where, void* value)
+    static void repatchPointer(void* where, const void* value)
     {
         staticSpew("##repatchPtr ((where=%p)) ((value=%p))",
                    where, value);
         setPointer(where, value);
     }
 
     static void repatchLoadPtrToLEA(void* where)
     {
@@ -2972,17 +2972,17 @@ private:
         {
             m_buffer.ensureSpace(maxInstructionSize);
             emitRexIfNeeded(reg, index, 0);
             m_buffer.putByteUnchecked(opcode);
             memoryModRM_disp32(reg, index, scale, offset);
         }
 
 #if !WTF_CPU_X86_64
-        void oneByteOp(OneByteOpcodeID opcode, int reg, void* address)
+        void oneByteOp(OneByteOpcodeID opcode, int reg, const void* address)
         {
             m_buffer.ensureSpace(maxInstructionSize);
             m_buffer.putByteUnchecked(opcode);
             memoryModRM(reg, address);
         }
 #else
         void oneByteRipOp(OneByteOpcodeID opcode, int reg, int ripOffset)
         {
--- a/js/src/builtin/embedjs.py
+++ b/js/src/builtin/embedjs.py
@@ -59,17 +59,17 @@ HEADER_TEMPLATE = """\
 /* 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/. */
 
 namespace js {
 namespace selfhosted {
     static const %(sources_type)s data[] = { %(sources_data)s };
 
-    static const %(sources_type)s *%(sources_name)s = reinterpret_cast<const %(sources_type)s *>(data);
+    static const %(sources_type)s * const %(sources_name)s = reinterpret_cast<const %(sources_type)s *>(data);
 
     uint32_t GetCompressedSize() {
         return %(compressed_total_length)i;
     }
 
     uint32_t GetRawScriptsSize() {
         return %(raw_total_length)i;
     }
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -281,17 +281,17 @@ EmitJump(JSContext *cx, BytecodeEmitter 
     return offset;
 }
 
 /* XXX too many "... statement" L10N gaffes below -- fix via js.msg! */
 const char js_with_statement_str[] = "with statement";
 const char js_finally_block_str[]  = "finally block";
 const char js_script_str[]         = "script";
 
-static const char *statementName[] = {
+static const char * const statementName[] = {
     "label statement",       /* LABEL */
     "if statement",          /* IF */
     "else statement",        /* ELSE */
     "destructuring body",    /* BODY */
     "switch statement",      /* SWITCH */
     "block",                 /* BLOCK */
     js_with_statement_str,   /* WITH */
     "catch block",           /* CATCH */
@@ -6421,17 +6421,17 @@ CGConstList::finish(ConstArray *array)
     for (unsigned i = 0; i < length(); i++)
         array->vector[i] = list[i];
 }
 
 /*
  * We should try to get rid of offsetBias (always 0 or 1, where 1 is
  * JSOP_{NOP,POP}_LENGTH), which is used only by SRC_FOR.
  */
-JS_FRIEND_DATA(JSSrcNoteSpec) js_SrcNoteSpec[] = {
+JS_FRIEND_DATA(const JSSrcNoteSpec) js_SrcNoteSpec[] = {
 /*  0 */ {"null",           0},
 
 /*  1 */ {"if",             0},
 /*  2 */ {"if-else",        1},
 /*  3 */ {"cond",           1},
 
 /*  4 */ {"for",            3},
 
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -369,17 +369,17 @@ NameNode::create(ParseNodeKind kind, JSA
         ((NameNode *)pn)->initCommon(pc);
     }
     return (NameNode *)pn;
 }
 
 const char *
 Definition::kindString(Kind kind)
 {
-    static const char *table[] = {
+    static const char * const table[] = {
         "", js_var_str, js_const_str, js_let_str, js_function_str, "argument", "unknown"
     };
 
     JS_ASSERT(unsigned(kind) <= unsigned(ARG));
     return table[kind];
 }
 
 namespace js {
@@ -570,17 +570,17 @@ Parser<FullParseHandler>::cloneLeftHandS
     return pn;
 }
 
 } /* namespace frontend */
 } /* namespace js */
 
 #ifdef DEBUG
 
-static const char *parseNodeNames[] = {
+static const char * const parseNodeNames[] = {
 #define STRINGIFY(name) #name,
     FOR_EACH_PARSE_NODE_KIND(STRINGIFY)
 #undef STRINGIFY
 };
 
 void
 frontend::DumpParseTree(ParseNode *pn, int indent)
 {
--- a/js/src/frontend/SourceNotes.h
+++ b/js/src/frontend/SourceNotes.h
@@ -145,17 +145,17 @@ enum SrcNoteType {
 #define SN_MAKE_TERMINATOR(sn)  (*(sn) = SRC_NULL)
 #define SN_IS_TERMINATOR(sn)    (*(sn) == SRC_NULL)
 
 struct JSSrcNoteSpec {
     const char      *name;      /* name for disassembly/debugging output */
     int8_t          arity;      /* number of offset operands */
 };
 
-extern JS_FRIEND_DATA(JSSrcNoteSpec)  js_SrcNoteSpec[];
+extern JS_FRIEND_DATA(const JSSrcNoteSpec) js_SrcNoteSpec[];
 extern JS_FRIEND_API(unsigned)         js_SrcNoteLength(jssrcnote *sn);
 
 /*
  * Get and set the offset operand identified by which (0 for the first, etc.).
  */
 extern JS_FRIEND_API(ptrdiff_t)
 js_GetSrcNoteOffset(jssrcnote *sn, unsigned which);
 
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -273,17 +273,17 @@ struct PhaseInfo
 {
     Phase index;
     const char *name;
     Phase parent;
 };
 
 static const Phase PHASE_NO_PARENT = PHASE_LIMIT;
 
-static PhaseInfo phases[] = {
+static const PhaseInfo phases[] = {
     { PHASE_GC_BEGIN, "Begin Callback", PHASE_NO_PARENT },
     { PHASE_WAIT_BACKGROUND_THREAD, "Wait Background Thread", PHASE_NO_PARENT },
     { PHASE_MARK_DISCARD_CODE, "Mark Discard Code", PHASE_NO_PARENT },
     { PHASE_PURGE, "Purge", PHASE_NO_PARENT },
     { PHASE_MARK, "Mark", PHASE_NO_PARENT },
     { PHASE_MARK_ROOTS, "Mark Roots", PHASE_MARK },
     { PHASE_MARK_TYPES, "Mark Types", PHASE_MARK_ROOTS },
     { PHASE_MARK_DELAYED, "Mark Delayed", PHASE_MARK },
--- a/js/src/ion/IonCaches.cpp
+++ b/js/src/ion/IonCaches.cpp
@@ -79,17 +79,17 @@ CodeOffsetJump::fixup(MacroAssembler *ma
 #ifdef JS_SMALL_BRANCH
      jumpTableIndex_ = masm->actualIndex(jumpTableIndex_);
 #endif
 }
 
 const char *
 IonCache::CacheName(IonCache::Kind kind)
 {
-    static const char *names[] =
+    static const char * const names[] =
     {
 #define NAME(x) #x,
         IONCACHE_KIND_LIST(NAME)
 #undef NAME
     };
     return names[kind];
 }
 
--- a/js/src/ion/IonSpewer.cpp
+++ b/js/src/ion/IonSpewer.cpp
@@ -26,17 +26,17 @@ using namespace js::ion;
 
 // IonSpewer singleton.
 static IonSpewer ionspewer;
 
 static bool LoggingChecked = false;
 static uint32_t LoggingBits = 0;
 static uint32_t filteredOutCompilations = 0;
 
-static const char *ChannelNames[] =
+static const char * const ChannelNames[] =
 {
 #define IONSPEW_CHANNEL(name) #name,
     IONSPEW_CHANNEL_LIST(IONSPEW_CHANNEL)
 #undef IONSPEW_CHANNEL
 };
 
 static bool
 FilterContainsLocation(HandleScript function)
--- a/js/src/ion/LIR.cpp
+++ b/js/src/ion/LIR.cpp
@@ -165,17 +165,17 @@ LPhi::New(MIRGenerator *gen, MPhi *ins)
     if (!phi->init(gen))
         return NULL;
     return phi;
 }
 
 void
 LInstruction::printName(FILE *fp, Opcode op)
 {
-    static const char *names[] =
+    static const char * const names[] =
     {
 #define LIROP(x) #x,
         LIR_OPCODE_LIST(LIROP)
 #undef LIROP
     };
     const char *name = names[op];
     size_t len = strlen(name);
     for (size_t i = 0; i < len; i++)
@@ -183,17 +183,17 @@ LInstruction::printName(FILE *fp, Opcode
 }
 
 void
 LInstruction::printName(FILE *fp)
 {
     printName(fp, op());
 }
 
-static const char *TypeChars[] =
+static const char * const TypeChars[] =
 {
     "i",            // INTEGER
     "o",            // OBJECT
     "f",            // DOUBLE
 #ifdef JS_NUNBOX32
     "t",            // TYPE
     "d"             // PAYLOAD
 #elif JS_PUNBOX64
--- a/js/src/ion/LiveRangeAllocator.h
+++ b/js/src/ion/LiveRangeAllocator.h
@@ -373,17 +373,17 @@ class VirtualRegister
         ins_ = ins;
         def_ = def;
         isTemp_ = isTemp;
         LiveInterval *initial = new LiveInterval(def->virtualRegister(), 0);
         if (!initial)
             return false;
         return intervals_.append(initial);
     }
-    uint32_t id() {
+    uint32_t id() const {
         return id_;
     }
     LBlock *block() {
         return block_;
     }
     LInstruction *ins() {
         return ins_;
     }
@@ -629,17 +629,17 @@ class LiveRangeAllocator : public Regist
                 continue;
 
             LSafepoint *safepoint = ins->safepoint();
             safepoint->addLiveRegister(a->toRegister());
         }
     }
 
     // Finds the first safepoint that is within range of an interval.
-    size_t findFirstSafepoint(LiveInterval *interval, size_t startFrom)
+    size_t findFirstSafepoint(const LiveInterval *interval, size_t startFrom) const
     {
         size_t i = startFrom;
         for (; i < graph.numSafepoints(); i++) {
             LInstruction *ins = graph.getSafepoint(i);
             if (interval->start() <= inputOf(ins))
                 break;
         }
         return i;
--- a/js/src/ion/MIR.cpp
+++ b/js/src/ion/MIR.cpp
@@ -23,17 +23,17 @@
 using namespace js;
 using namespace js::ion;
 
 using mozilla::BitwiseCast;
 
 void
 MDefinition::PrintOpcodeName(FILE *fp, MDefinition::Opcode op)
 {
-    static const char *names[] =
+    static const char * const names[] =
     {
 #define NAME(x) #x,
         MIR_OPCODE_LIST(NAME)
 #undef NAME
     };
     const char *name = names[op];
     size_t len = strlen(name);
     for (size_t i = 0; i < len; i++)
--- a/js/src/ion/RegisterAllocator.h
+++ b/js/src/ion/RegisterAllocator.h
@@ -320,44 +320,44 @@ class RegisterAllocator
             allRegisters_.take(AnyRegister(NANReg));
         }
 #endif
     }
 
   protected:
     bool init();
 
-    CodePosition outputOf(uint32_t pos) {
+    CodePosition outputOf(uint32_t pos) const {
         return CodePosition(pos, CodePosition::OUTPUT);
     }
-    CodePosition outputOf(LInstruction *ins) {
+    CodePosition outputOf(const LInstruction *ins) const {
         return CodePosition(ins->id(), CodePosition::OUTPUT);
     }
-    CodePosition inputOf(uint32_t pos) {
+    CodePosition inputOf(uint32_t pos) const {
         return CodePosition(pos, CodePosition::INPUT);
     }
-    CodePosition inputOf(LInstruction *ins) {
+    CodePosition inputOf(const LInstruction *ins) const {
         return CodePosition(ins->id(), CodePosition::INPUT);
     }
 
     LMoveGroup *getInputMoveGroup(uint32_t ins);
     LMoveGroup *getMoveGroupAfter(uint32_t ins);
 
     LMoveGroup *getInputMoveGroup(CodePosition pos) {
         return getInputMoveGroup(pos.ins());
     }
     LMoveGroup *getMoveGroupAfter(CodePosition pos) {
         return getMoveGroupAfter(pos.ins());
     }
 
-    size_t findFirstNonCallSafepoint(CodePosition from)
+    size_t findFirstNonCallSafepoint(CodePosition from) const
     {
         size_t i = 0;
         for (; i < graph.numNonCallSafepoints(); i++) {
-            LInstruction *ins = graph.getNonCallSafepoint(i);
+            const LInstruction *ins = graph.getNonCallSafepoint(i);
             if (from <= inputOf(ins))
                 break;
         }
         return i;
     }
 };
 
 } // namespace ion
--- a/js/src/ion/VMFunctions.cpp
+++ b/js/src/ion/VMFunctions.cpp
@@ -557,17 +557,17 @@ FilterArguments(JSContext *cx, JSString 
     // getChars() is fallible, but cannot GC: it can only allocate a character
     // for the flattened string. If this call fails then the calling Ion code
     // will bailout, resume in the interpreter and likely fail again when
     // trying to flatten the string and unwind the stack.
     const jschar *chars = str->getChars(cx);
     if (!chars)
         return false;
 
-    static jschar arguments[] = {'a', 'r', 'g', 'u', 'm', 'e', 'n', 't', 's'};
+    static const jschar arguments[] = {'a', 'r', 'g', 'u', 'm', 'e', 'n', 't', 's'};
     return !StringHasPattern(chars, str->length(), arguments, mozilla::ArrayLength(arguments));
 }
 
 #ifdef JSGC_GENERATIONAL
 void
 PostWriteBarrier(JSRuntime *rt, JSObject *obj)
 {
 #ifdef JS_GC_ZEAL
--- a/js/src/ion/arm/Architecture-arm.h
+++ b/js/src/ion/arm/Architecture-arm.h
@@ -70,18 +70,18 @@ class Registers
         lr = r14,
         r15,
         pc = r15,
         invalid_reg
     } RegisterID;
     typedef RegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-                                       "r8", "r9", "r10", "r11", "r12", "sp", "r14", "pc"};
+        static const char * const Names[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+                                              "r8", "r9", "r10", "r11", "r12", "sp", "r14", "pc"};
         return Names[code];
     }
 
     static const Code StackPointer = sp;
     static const Code Invalid = invalid_reg;
 
     static const uint32_t Total = 16;
     static const uint32_t Allocatable = 13;
@@ -176,18 +176,18 @@ class FloatRegisters
         d28,
         d29,
         d30,
         invalid_freg
     } FPRegisterID;
     typedef FPRegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
-                                       "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15"};
+        static const char * const Names[] = { "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+                                              "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15"};
         return Names[code];
     }
 
     static const Code Invalid = invalid_freg;
 
     static const uint32_t Total = 16;
     static const uint32_t Allocatable = 15;
 
--- a/js/src/ion/x64/Architecture-x64.h
+++ b/js/src/ion/x64/Architecture-x64.h
@@ -31,20 +31,20 @@ static const uint32_t ShadowStackSpace =
 // An offset that is illegal for a local variable's stack allocation.
 static const int32_t INVALID_STACK_SLOT       = -1;
 
 class Registers {
   public:
     typedef JSC::X86Registers::RegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "rax", "rcx", "rdx", "rbx",
-                                       "rsp", "rbp", "rsi", "rdi",
-                                       "r8",  "r9",  "r10", "r11",
-                                       "r12", "r13", "r14", "r15" };
+        static const char * const Names[] = { "rax", "rcx", "rdx", "rbx",
+                                              "rsp", "rbp", "rsi", "rdi",
+                                              "r8",  "r9",  "r10", "r11",
+                                              "r12", "r13", "r14", "r15" };
         return Names[code];
     }
 
     static const Code StackPointer = JSC::X86Registers::esp;
     static const Code Invalid = JSC::X86Registers::invalid_reg;
 
     static const uint32_t Total = 16;
     static const uint32_t Allocatable = 14;
@@ -113,20 +113,20 @@ class Registers {
 // Smallest integer type that can hold a register bitmask.
 typedef uint16_t PackedRegisterMask;
 
 class FloatRegisters {
   public:
     typedef JSC::X86Registers::XMMRegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "xmm0",  "xmm1",  "xmm2",  "xmm3",
-                                       "xmm4",  "xmm5",  "xmm6",  "xmm7",
-                                       "xmm8",  "xmm9",  "xmm10", "xmm11",
-                                       "xmm12", "xmm13", "xmm14", "xmm15" };
+        static const char * const Names[] = { "xmm0",  "xmm1",  "xmm2",  "xmm3",
+                                              "xmm4",  "xmm5",  "xmm6",  "xmm7",
+                                              "xmm8",  "xmm9",  "xmm10", "xmm11",
+                                              "xmm12", "xmm13", "xmm14", "xmm15" };
         return Names[code];
     }
 
     static const Code Invalid = JSC::X86Registers::invalid_xmm;
 
     static const uint32_t Total = 16;
     static const uint32_t Allocatable = 15;
 
--- a/js/src/ion/x86/Architecture-x86.h
+++ b/js/src/ion/x86/Architecture-x86.h
@@ -38,18 +38,18 @@ static const int32_t NUNBOX32_PAYLOAD_OF
 // Size of each bailout table entry. On x86 this is a 5-byte relative call.
 static const uint32_t BAILOUT_TABLE_ENTRY_SIZE    = 5;
 
 class Registers {
   public:
     typedef JSC::X86Registers::RegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "eax", "ecx", "edx", "ebx",
-                                       "esp", "ebp", "esi", "edi" };
+        static const char * const Names[] = { "eax", "ecx", "edx", "ebx",
+                                              "esp", "ebp", "esi", "edi" };
         return Names[code];
     }
 
     static const Code StackPointer = JSC::X86Registers::esp;
     static const Code Invalid = JSC::X86Registers::invalid_reg;
 
     static const uint32_t Total = 8;
     static const uint32_t Allocatable = 7;
@@ -102,18 +102,18 @@ class Registers {
 // Smallest integer type that can hold a register bitmask.
 typedef uint8_t PackedRegisterMask;
 
 class FloatRegisters {
   public:
     typedef JSC::X86Registers::XMMRegisterID Code;
 
     static const char *GetName(Code code) {
-        static const char *Names[] = { "xmm0", "xmm1", "xmm2", "xmm3",
-                                       "xmm4", "xmm5", "xmm6", "xmm7" };
+        static const char * const Names[] = { "xmm0", "xmm1", "xmm2", "xmm3",
+                                              "xmm4", "xmm5", "xmm6", "xmm7" };
         return Names[code];
     }
 
     static const Code Invalid = JSC::X86Registers::invalid_xmm;
 
     static const uint32_t Total = 8;
     static const uint32_t Allocatable = 7;
 
--- a/js/src/jsapi-tests/testArgumentsObject.cpp
+++ b/js/src/jsapi-tests/testArgumentsObject.cpp
@@ -25,17 +25,17 @@ static const char STRICT_ZERO[] =
     "function f() { 'use strict'; return arguments; }";
 static const char STRICT_ONE[] =
     "function f() { 'use strict'; return arguments; }";
 static const char STRICT_TWO[] =
     "function f() { 'use strict'; return arguments; }";
 static const char STRICT_THREE[] =
     "function f() { 'use strict'; return arguments; }";
 
-static const char *CALL_CODES[] =
+static const char * const CALL_CODES[] =
     { "f()", "f(0)", "f(0, 1)", "f(0, 1, 2)", "f(0, 1, 2, 3)", "f(0, 1, 2, 3, 4)" };
 
 static const size_t MAX_ELEMS = 6;
 
 static void
 ClearElements(Value elems[MAX_ELEMS])
 {
     for (size_t i = 0; i < MAX_ELEMS - 1; i++)
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -164,18 +164,18 @@ class AutoVersionAPI
 
 #ifdef HAVE_VA_LIST_AS_ARRAY
 #define JS_ADDRESSOF_VA_LIST(ap) ((va_list *)(ap))
 #else
 #define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
 #endif
 
 #ifdef JS_USE_JSID_STRUCT_TYPES
-jsid JSID_VOID  = { size_t(JSID_TYPE_VOID) };
-jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) };
+const jsid JSID_VOID  = { size_t(JSID_TYPE_VOID) };
+const jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) };
 #endif
 
 const jsval JSVAL_NULL  = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_NULL,      0));
 const jsval JSVAL_ZERO  = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_INT32,     0));
 const jsval JSVAL_ONE   = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_INT32,     1));
 const jsval JSVAL_FALSE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN,   JS_FALSE));
 const jsval JSVAL_TRUE  = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN,   JS_TRUE));
 const jsval JSVAL_VOID  = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_UNDEFINED, 0));
@@ -1801,26 +1801,26 @@ JS_InitStandardClasses(JSContext *cx, JS
 
 typedef struct JSStdName {
     JSClassInitializerOp init;
     size_t      atomOffset;     /* offset of atom pointer in JSAtomState */
     Class       *clasp;
 } JSStdName;
 
 static Handle<PropertyName*>
-StdNameToPropertyName(JSContext *cx, JSStdName *stdn)
+StdNameToPropertyName(JSContext *cx, const JSStdName *stdn)
 {
     return OFFSET_TO_NAME(cx->runtime(), stdn->atomOffset);
 }
 
 /*
  * Table of class initializers and their atom offsets in rt->atomState.
  * If you add a "standard" class, remember to update this table.
  */
-static JSStdName standard_class_atoms[] = {
+static const JSStdName standard_class_atoms[] = {
     {js_InitFunctionClass,              EAGER_ATOM_AND_CLASP(Function)},
     {js_InitObjectClass,                EAGER_ATOM_AND_CLASP(Object)},
     {js_InitArrayClass,                 EAGER_ATOM_AND_CLASP(Array)},
     {js_InitBooleanClass,               EAGER_ATOM_AND_CLASP(Boolean)},
     {js_InitDateClass,                  EAGER_ATOM_AND_CLASP(Date)},
     {js_InitMathClass,                  EAGER_ATOM_AND_CLASP(Math)},
     {js_InitNumberClass,                EAGER_ATOM_AND_CLASP(Number)},
     {js_InitStringClass,                EAGER_ATOM_AND_CLASP(String)},
@@ -1844,17 +1844,17 @@ static JSStdName standard_class_atoms[] 
     {NULL,                              0, NULL}
 };
 
 /*
  * Table of top-level function and constant names and their init functions.
  * If you add a "standard" global function or property, remember to update
  * this table.
  */
-static JSStdName standard_class_names[] = {
+static const JSStdName standard_class_names[] = {
     {js_InitObjectClass,        EAGER_ATOM(eval), CLASP(Object)},
 
     /* Global properties and functions defined by the Number class. */
     {js_InitNumberClass,        EAGER_ATOM(NaN), CLASP(Number)},
     {js_InitNumberClass,        EAGER_ATOM(Infinity), CLASP(Number)},
     {js_InitNumberClass,        EAGER_ATOM(isNaN), CLASP(Number)},
     {js_InitNumberClass,        EAGER_ATOM(isFinite), CLASP(Number)},
     {js_InitNumberClass,        EAGER_ATOM(parseFloat), CLASP(Number)},
@@ -1895,17 +1895,17 @@ static JSStdName standard_class_names[] 
     {js_InitTypedArrayClasses,  EAGER_CLASS_ATOM(Float64Array), TYPED_ARRAY_CLASP(TYPE_FLOAT64)},
     {js_InitTypedArrayClasses,  EAGER_CLASS_ATOM(Uint8ClampedArray),
                                 TYPED_ARRAY_CLASP(TYPE_UINT8_CLAMPED)},
     {js_InitTypedArrayClasses,  EAGER_CLASS_ATOM(DataView),     &DataViewObject::class_},
 
     {NULL,                      0, NULL}
 };
 
-static JSStdName object_prototype_names[] = {
+static const JSStdName object_prototype_names[] = {
     /* Object.prototype properties (global delegates to Object.prototype). */
     {js_InitObjectClass,        EAGER_ATOM(proto), CLASP(Object)},
 #if JS_HAS_TOSOURCE
     {js_InitObjectClass,        EAGER_ATOM(toSource), CLASP(Object)},
 #endif
     {js_InitObjectClass,        EAGER_ATOM(toString), CLASP(Object)},
     {js_InitObjectClass,        EAGER_ATOM(toLocaleString), CLASP(Object)},
     {js_InitObjectClass,        EAGER_ATOM(valueOf), CLASP(Object)},
@@ -1927,17 +1927,17 @@ static JSStdName object_prototype_names[
 };
 
 JS_PUBLIC_API(JSBool)
 JS_ResolveStandardClass(JSContext *cx, JSObject *objArg, jsid id, JSBool *resolved)
 {
     RootedObject obj(cx, objArg);
     JSRuntime *rt;
     JSAtom *atom;
-    JSStdName *stdnm;
+    const JSStdName *stdnm;
     unsigned i;
 
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj, id);
     *resolved = false;
 
     rt = cx->runtime();
@@ -4042,17 +4042,17 @@ JS_DefineObject(JSContext *cx, JSObject 
     {
         return NULL;
     }
 
     return nobj;
 }
 
 JS_PUBLIC_API(JSBool)
-JS_DefineConstDoubles(JSContext *cx, JSObject *objArg, JSConstDoubleSpec *cds)
+JS_DefineConstDoubles(JSContext *cx, JSObject *objArg, const JSConstDoubleSpec *cds)
 {
     RootedObject obj(cx, objArg);
     JSBool ok;
     unsigned attrs;
 
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     JSPropertyOpWrapper noget = GetterWrapper(NULL);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1304,18 +1304,18 @@ static JS_ALWAYS_INLINE JSBool
 JSID_IS_EMPTY(const jsid id)
 {
     return ((size_t)JSID_BITS(id) == JSID_TYPE_OBJECT);
 }
 
 #undef id
 
 #ifdef JS_USE_JSID_STRUCT_TYPES
-extern JS_PUBLIC_DATA(jsid) JSID_VOID;
-extern JS_PUBLIC_DATA(jsid) JSID_EMPTY;
+extern JS_PUBLIC_DATA(const jsid) JSID_VOID;
+extern JS_PUBLIC_DATA(const jsid) JSID_EMPTY;
 #else
 # define JSID_VOID ((jsid)JSID_TYPE_VOID)
 # define JSID_EMPTY ((jsid)JSID_TYPE_OBJECT)
 #endif
 
 /*
  * Returns true iff the given jsval is immune to GC and can be used across
  * multiple JSRuntimes without requiring any conversion API.
@@ -3188,17 +3188,17 @@ JS_FreezeObject(JSContext *cx, JSObject 
 extern JS_PUBLIC_API(JSObject *)
 JS_New(JSContext *cx, JSObject *ctor, unsigned argc, jsval *argv);
 
 extern JS_PUBLIC_API(JSObject *)
 JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp,
                 JSObject *proto, unsigned attrs);
 
 extern JS_PUBLIC_API(JSBool)
-JS_DefineConstDoubles(JSContext *cx, JSObject *obj, JSConstDoubleSpec *cds);
+JS_DefineConstDoubles(JSContext *cx, JSObject *obj, const JSConstDoubleSpec *cds);
 
 extern JS_PUBLIC_API(JSBool)
 JS_DefineProperties(JSContext *cx, JSObject *obj, const JSPropertySpec *ps);
 
 extern JS_PUBLIC_API(JSBool)
 JS_DefineProperty(JSContext *cx, JSObject *obj, const char *name, jsval value,
                   JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
 
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -38,17 +38,17 @@ using mozilla::ArrayLength;
 using mozilla::RangedPtr;
 
 const char *
 js_AtomToPrintableString(JSContext *cx, JSAtom *atom, JSAutoByteString *bytes)
 {
     return js_ValueToPrintable(cx, StringValue(atom), bytes);
 }
 
-const char * js::TypeStrings[] = {
+const char * const js::TypeStrings[] = {
     js_undefined_str,
     js_object_str,
     js_function_str,
     js_string_str,
     js_number_str,
     js_boolean_str,
     js_null_str,
 };
--- a/js/src/jsatom.h
+++ b/js/src/jsatom.h
@@ -176,17 +176,17 @@ extern const char js_with_str[];
 extern const char js_yield_str[];
 #if JS_HAS_GENERATORS
 extern const char   js_close_str[];
 extern const char   js_send_str[];
 #endif
 
 namespace js {
 
-extern const char * TypeStrings[];
+extern const char * const TypeStrings[];
 
 /*
  * Initialize atom state. Return true on success, false on failure to allocate
  * memory. The caller must zero rt->atomState before calling this function and
  * only call it after js_InitGC successfully returns.
  */
 extern JSBool
 InitAtoms(JSRuntime *rt);
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -538,31 +538,31 @@ Class js::DateClass = {
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     date_convert
 };
 
 /* for use by date_parse */
 
-static const char* wtb[] = {
+static const char* const wtb[] = {
     "am", "pm",
     "monday", "tuesday", "wednesday", "thursday", "friday",
     "saturday", "sunday",
     "january", "february", "march", "april", "may", "june",
     "july", "august", "september", "october", "november", "december",
     "gmt", "ut", "utc",
     "est", "edt",
     "cst", "cdt",
     "mst", "mdt",
     "pst", "pdt"
     /* time zone table needs to be expanded */
 };
 
-static int ttb[] = {
+static const int ttb[] = {
     -1, -2, 0, 0, 0, 0, 0, 0, 0,       /* AM/PM */
     2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
     10000 + 0, 10000 + 0, 10000 + 0,   /* GMT/UT/UTC */
     10000 + 5 * 60, 10000 + 4 * 60,    /* EST/EDT */
     10000 + 6 * 60, 10000 + 5 * 60,    /* CST/CDT */
     10000 + 7 * 60, 10000 + 6 * 60,    /* MST/MDT */
     10000 + 8 * 60, 10000 + 7 * 60     /* PST/PDT */
 };
@@ -2454,22 +2454,22 @@ date_setYear_impl(JSContext *cx, CallArg
 static JSBool
 date_setYear(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setYear_impl>(cx, args);
 }
 
 /* constants for toString, toUTCString */
-static char js_NaN_date_str[] = "Invalid Date";
-static const char* days[] =
+static const char js_NaN_date_str[] = "Invalid Date";
+static const char * const days[] =
 {
    "Sun","Mon","Tue","Wed","Thu","Fri","Sat"
 };
-static const char* months[] =
+static const char * const months[] =
 {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
 
 
 // Avoid dependence on PRMJ_FormatTimeUSEnglish, because it
 // requires a PRMJTime... which only has 16-bit years.  Sub-ECMA.
 static void
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -887,17 +887,17 @@ js::GetErrorTypeName(JSContext* cx, int1
         return NULL;
     }
     JSProtoKey key = GetExceptionProtoKey(exnType);
     return ClassName(key, cx)->chars();
 }
 
 #if defined ( DEBUG_mccabe ) && defined ( PRINTNAMES )
 /* For use below... get character strings for error name and exception name */
-static struct exnname { char *name; char *exception; } errortoexnname[] = {
+static const struct exnname { char *name; char *exception; } errortoexnname[] = {
 #define MSG_DEF(name, number, count, exception, format) \
     {#name, #exception},
 #include "js.msg"
 #undef MSG_DEF
 };
 #endif /* DEBUG */
 
 JSBool
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -92,17 +92,17 @@ using mozilla::Maybe;
 
 /* Perform a Full GC every 20 seconds if MaybeGC is called */
 static const uint64_t GC_IDLE_FULL_SPAN = 20 * 1000 * 1000;
 
 /* Increase the IGC marking slice time if we are in highFrequencyGC mode. */
 static const int IGC_MARK_SLICE_MULTIPLIER = 2;
 
 /* This array should be const, but that doesn't link right under GCC. */
-AllocKind gc::slotsToThingKind[] = {
+const AllocKind gc::slotsToThingKind[] = {
     /* 0 */  FINALIZE_OBJECT0,  FINALIZE_OBJECT2,  FINALIZE_OBJECT2,  FINALIZE_OBJECT4,
     /* 4 */  FINALIZE_OBJECT4,  FINALIZE_OBJECT8,  FINALIZE_OBJECT8,  FINALIZE_OBJECT8,
     /* 8 */  FINALIZE_OBJECT8,  FINALIZE_OBJECT12, FINALIZE_OBJECT12, FINALIZE_OBJECT12,
     /* 12 */ FINALIZE_OBJECT12, FINALIZE_OBJECT16, FINALIZE_OBJECT16, FINALIZE_OBJECT16,
     /* 16 */ FINALIZE_OBJECT16
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(slotsToThingKind) == SLOTS_TO_THING_KIND_LIMIT);
@@ -171,17 +171,17 @@ static const AllocKind FinalizePhaseScri
     FINALIZE_SCRIPT,
     FINALIZE_LAZY_SCRIPT
 };
 
 static const AllocKind FinalizePhaseIonCode[] = {
     FINALIZE_IONCODE
 };
 
-static const AllocKind* FinalizePhases[] = {
+static const AllocKind * const FinalizePhases[] = {
     FinalizePhaseStrings,
     FinalizePhaseScripts,
     FinalizePhaseIonCode
 };
 static const int FinalizePhaseCount = sizeof(FinalizePhases) / sizeof(AllocKind*);
 
 static const int FinalizePhaseLength[] = {
     sizeof(FinalizePhaseStrings) / sizeof(AllocKind),
@@ -214,17 +214,17 @@ static const AllocKind BackgroundPhaseSt
 };
 
 static const AllocKind BackgroundPhaseShapes[] = {
     FINALIZE_SHAPE,
     FINALIZE_BASE_SHAPE,
     FINALIZE_TYPE_OBJECT
 };
 
-static const AllocKind* BackgroundPhases[] = {
+static const AllocKind * const BackgroundPhases[] = {
     BackgroundPhaseObjects,
     BackgroundPhaseStrings,
     BackgroundPhaseShapes
 };
 static const int BackgroundPhaseCount = sizeof(BackgroundPhases) / sizeof(AllocKind*);
 
 static const int BackgroundPhaseLength[] = {
     sizeof(BackgroundPhaseObjects) / sizeof(AllocKind),
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -46,17 +46,17 @@ struct AutoMarkInDeadZone
     bool scheduled;
 };
 
 namespace gc {
 
 /* Capacity for slotsToThingKind */
 const size_t SLOTS_TO_THING_KIND_LIMIT = 17;
 
-extern AllocKind slotsToThingKind[];
+extern const AllocKind slotsToThingKind[];
 
 /* Get the best kind to use when making an object with the given slot count. */
 static inline AllocKind
 GetGCObjectKind(size_t numSlots)
 {
     if (numSlots >= SLOTS_TO_THING_KIND_LIMIT)
         return FINALIZE_OBJECT16;
     return slotsToThingKind[numSlots];
@@ -72,35 +72,31 @@ GetGCObjectKind(Class *clasp)
         nslots++;
     return GetGCObjectKind(nslots);
 }
 
 /* As for GetGCObjectKind, but for dense array allocation. */
 static inline AllocKind
 GetGCArrayKind(size_t numSlots)
 {
-    extern AllocKind slotsToThingKind[];
-
     /*
      * Dense arrays can use their fixed slots to hold their elements array
      * (less two Values worth of ObjectElements header), but if more than the
      * maximum number of fixed slots is needed then the fixed slots will be
      * unused.
      */
     JS_STATIC_ASSERT(ObjectElements::VALUES_PER_HEADER == 2);
     if (numSlots > JSObject::NELEMENTS_LIMIT || numSlots + 2 >= SLOTS_TO_THING_KIND_LIMIT)
         return FINALIZE_OBJECT2;
     return slotsToThingKind[numSlots + 2];
 }
 
 static inline AllocKind
 GetGCObjectFixedSlotsKind(size_t numFixedSlots)
 {
-    extern AllocKind slotsToThingKind[];
-
     JS_ASSERT(numFixedSlots < SLOTS_TO_THING_KIND_LIMIT);
     return slotsToThingKind[numFixedSlots];
 }
 
 static inline AllocKind
 GetBackgroundAllocKind(AllocKind kind)
 {
     JS_ASSERT(!IsBackgroundFinalized(kind));
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -144,31 +144,31 @@ types::InferSpewColorReset()
         return "";
     return "\x1b[0m";
 }
 
 const char *
 types::InferSpewColor(TypeConstraint *constraint)
 {
     /* Type constraints are printed out using foreground colors. */
-    static const char *colors[] = { "\x1b[31m", "\x1b[32m", "\x1b[33m",
-                                    "\x1b[34m", "\x1b[35m", "\x1b[36m",
-                                    "\x1b[37m" };
+    static const char * const colors[] = { "\x1b[31m", "\x1b[32m", "\x1b[33m",
+                                           "\x1b[34m", "\x1b[35m", "\x1b[36m",
+                                           "\x1b[37m" };
     if (!InferSpewColorable())
         return "";
     return colors[DefaultHasher<TypeConstraint *>::hash(constraint) % 7];
 }
 
 const char *
 types::InferSpewColor(TypeSet *types)
 {
     /* Type sets are printed out using bold colors. */
-    static const char *colors[] = { "\x1b[1;31m", "\x1b[1;32m", "\x1b[1;33m",
-                                    "\x1b[1;34m", "\x1b[1;35m", "\x1b[1;36m",
-                                    "\x1b[1;37m" };
+    static const char * const colors[] = { "\x1b[1;31m", "\x1b[1;32m", "\x1b[1;33m",
+                                           "\x1b[1;34m", "\x1b[1;35m", "\x1b[1;36m",
+                                           "\x1b[1;37m" };
     if (!InferSpewColorable())
         return "";
     return colors[DefaultHasher<TypeSet *>::hash(types) % 7];
 }
 
 const char *
 types::TypeString(Type type)
 {
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -68,17 +68,17 @@ using mozilla::SpecificNaN;
 #endif
 #ifndef M_SQRT2
 #define M_SQRT2         1.41421356237309504880
 #endif
 #ifndef M_SQRT1_2
 #define M_SQRT1_2       0.70710678118654752440
 #endif
 
-static JSConstDoubleSpec math_constants[] = {
+static const JSConstDoubleSpec math_constants[] = {
     {M_E,       "E",            0, {0,0,0}},
     {M_LOG2E,   "LOG2E",        0, {0,0,0}},
     {M_LOG10E,  "LOG10E",       0, {0,0,0}},
     {M_LN2,     "LN2",          0, {0,0,0}},
     {M_LN10,    "LN10",         0, {0,0,0}},
     {M_PI,      "PI",           0, {0,0,0}},
     {M_SQRT2,   "SQRT2",        0, {0,0,0}},
     {M_SQRT1_2, "SQRT1_2",      0, {0,0,0}},
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -68,34 +68,34 @@ static const char js_for_each_str[]  = "
 
 const JSCodeSpec js_CodeSpec[] = {
 #define OPDEF(op,val,name,token,length,nuses,ndefs,format) \
     {length,nuses,ndefs,format},
 #include "jsopcode.tbl"
 #undef OPDEF
 };
 
-unsigned js_NumCodeSpecs = JS_ARRAY_LENGTH(js_CodeSpec);
+const unsigned js_NumCodeSpecs = JS_ARRAY_LENGTH(js_CodeSpec);
 
 /*
  * Each element of the array is either a source literal associated with JS
  * bytecode or null.
  */
-static const char *CodeToken[] = {
+static const char * const CodeToken[] = {
 #define OPDEF(op,val,name,token,length,nuses,ndefs,format) \
     token,
 #include "jsopcode.tbl"
 #undef OPDEF
 };
 
 /*
  * Array of JS bytecode names used by PC count JSON, DEBUG-only js_Disassemble
  * and JIT debug spew.
  */
-const char *js_CodeName[] = {
+const char * const js_CodeName[] = {
 #define OPDEF(op,val,name,token,length,nuses,ndefs,format) \
     name,
 #include "jsopcode.tbl"
 #undef OPDEF
 };
 
 /************************************************************************/
 
@@ -167,27 +167,27 @@ js::StackDefs(JSScript *script, jsbyteco
     const JSCodeSpec &cs = js_CodeSpec[op];
     if (cs.ndefs >= 0)
         return cs.ndefs;
 
     uint32_t n = NumBlockSlots(script, pc);
     return op == JSOP_ENTERLET1 ? n + 1 : n;
 }
 
-static const char * countBaseNames[] = {
+static const char * const countBaseNames[] = {
     "interp",
     "mjit",
     "mjit_calls",
     "mjit_code",
     "mjit_pics"
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) == PCCounts::BASE_LIMIT);
 
-static const char * countAccessNames[] = {
+static const char * const countAccessNames[] = {
     "infer_mono",
     "infer_di",
     "infer_poly",
     "infer_barrier",
     "infer_nobarrier",
     "observe_undefined",
     "observe_null",
     "observe_boolean",
@@ -195,42 +195,42 @@ static const char * countAccessNames[] =
     "observe_double",
     "observe_string",
     "observe_object"
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) +
                  JS_ARRAY_LENGTH(countAccessNames) == PCCounts::ACCESS_LIMIT);
 
-static const char * countElementNames[] = {
+static const char * const countElementNames[] = {
     "id_int",
     "id_double",
     "id_other",
     "id_unknown",
     "elem_typed",
     "elem_packed",
     "elem_dense",
     "elem_other"
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) +
                  JS_ARRAY_LENGTH(countAccessNames) +
                  JS_ARRAY_LENGTH(countElementNames) == PCCounts::ELEM_LIMIT);
 
-static const char * countPropertyNames[] = {
+static const char * const countPropertyNames[] = {
     "prop_static",
     "prop_definite",
     "prop_other"
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) +
                  JS_ARRAY_LENGTH(countAccessNames) +
                  JS_ARRAY_LENGTH(countPropertyNames) == PCCounts::PROP_LIMIT);
 
-static const char * countArithNames[] = {
+static const char * const countArithNames[] = {
     "arith_int",
     "arith_double",
     "arith_other",
     "arith_unknown",
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) +
                  JS_ARRAY_LENGTH(countArithNames) == PCCounts::ARITH_LIMIT);
@@ -2081,17 +2081,18 @@ AppendJSONProperty(StringBuffer &buf, co
 
     buf.append('\"');
     buf.appendInflated(name, strlen(name));
     buf.appendInflated("\":", 2);
 }
 
 static void
 AppendArrayJSONProperties(JSContext *cx, StringBuffer &buf,
-                          double *values, const char **names, unsigned count, MaybeComma &comma)
+                          double *values, const char * const *names, unsigned count,
+                          MaybeComma &comma)
 {
     for (unsigned i = 0; i < count; i++) {
         if (values[i]) {
             AppendJSONProperty(buf, names[i], comma);
             comma = COMMA;
             NumberValueToStringBuffer(cx, DoubleValue(values[i]), buf);
         }
     }
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -210,18 +210,18 @@ struct JSCodeSpec {
     int8_t              nuses;          /* arity, -1 if variadic */
     int8_t              ndefs;          /* number of stack results */
     uint32_t            format;         /* immediate operand format */
 
     uint32_t type() const { return JOF_TYPE(format); }
 };
 
 extern const JSCodeSpec js_CodeSpec[];
-extern unsigned            js_NumCodeSpecs;
-extern const char       *js_CodeName[];
+extern const unsigned   js_NumCodeSpecs;
+extern const char       * const js_CodeName[];
 extern const char       js_EscapeMap[];
 
 /* Silence unreferenced formal parameter warnings */
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4100)
 #endif
 
@@ -647,17 +647,17 @@ class PCCounts
         }
         if (arithOp(op))
             return ARITH_LIMIT;
         return BASE_LIMIT;
     }
 
     static const char *countName(JSOp op, size_t which);
 
-    double *rawCounts() { return counts; }
+    double *rawCounts() const { return counts; }
 
     double& get(size_t which) {
         JS_ASSERT(which < capacity);
         return counts[which];
     }
 
     /* Boolean conversion, for 'if (counters) ...' */
     operator void*() const {
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -27,32 +27,32 @@
 #include "jsobjinlines.h"
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::ArrayLength;
 using mozilla::DebugOnly;
 
-char const *js::aopNames[] = {
+char const * const js::aopNames[] = {
     "=",    /* AOP_ASSIGN */
     "+=",   /* AOP_PLUS */
     "-=",   /* AOP_MINUS */
     "*=",   /* AOP_STAR */
     "/=",   /* AOP_DIV */
     "%=",   /* AOP_MOD */
     "<<=",  /* AOP_LSH */
     ">>=",  /* AOP_RSH */
     ">>>=", /* AOP_URSH */
     "|=",   /* AOP_BITOR */
     "^=",   /* AOP_BITXOR */
     "&="    /* AOP_BITAND */
 };
 
-char const *js::binopNames[] = {
+char const * const js::binopNames[] = {
     "==",         /* BINOP_EQ */
     "!=",         /* BINOP_NE */
     "===",        /* BINOP_STRICTEQ */
     "!==",        /* BINOP_STRICTNE */
     "<",          /* BINOP_LT */
     "<=",         /* BINOP_LE */
     ">",          /* BINOP_GT */
     ">=",         /* BINOP_GE */
@@ -66,34 +66,34 @@ char const *js::binopNames[] = {
     "%",          /* BINOP_MOD */
     "|",          /* BINOP_BITOR */
     "^",          /* BINOP_BITXOR */
     "&",          /* BINOP_BITAND */
     "in",         /* BINOP_IN */
     "instanceof", /* BINOP_INSTANCEOF */
 };
 
-char const *js::unopNames[] = {
+char const * const js::unopNames[] = {
     "delete",  /* UNOP_DELETE */
     "-",       /* UNOP_NEG */
     "+",       /* UNOP_POS */
     "!",       /* UNOP_NOT */
     "~",       /* UNOP_BITNOT */
     "typeof",  /* UNOP_TYPEOF */
     "void"     /* UNOP_VOID */
 };
 
-char const *js::nodeTypeNames[] = {
+char const * const js::nodeTypeNames[] = {
 #define ASTDEF(ast, str, method) str,
 #include "jsast.tbl"
 #undef ASTDEF
     NULL
 };
 
-static char const *callbackNames[] = {
+static char const * const callbackNames[] = {
 #define ASTDEF(ast, str, method) method,
 #include "jsast.tbl"
 #undef ASTDEF
     NULL
 };
 
 typedef AutoValueVector NodeVector;
 
--- a/js/src/jsreflect.h
+++ b/js/src/jsreflect.h
@@ -83,16 +83,16 @@ enum VarDeclKind {
 enum PropKind {
     PROP_ERR = -1,
     PROP_INIT = 0,
     PROP_GETTER,
     PROP_SETTER,
     PROP_LIMIT
 };
 
-extern char const *aopNames[];
-extern char const *binopNames[];
-extern char const *unopNames[];
-extern char const *nodeTypeNames[];
+extern char const * const aopNames[];
+extern char const * const binopNames[];
+extern char const * const unopNames[];
+extern char const * const nodeTypeNames[];
 
 } /* namespace js */
 
 #endif /* jsreflect_h___ */
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -360,18 +360,18 @@ static const JSFunctionSpec string_funct
     JS_FN(js_decodeURI_str,          str_decodeURI,             1,0),
     JS_FN(js_encodeURI_str,          str_encodeURI,             1,0),
     JS_FN(js_decodeURIComponent_str, str_decodeURI_Component,   1,0),
     JS_FN(js_encodeURIComponent_str, str_encodeURI_Component,   1,0),
 
     JS_FS_END
 };
 
-jschar      js_empty_ucstr[]  = {0};
-JSSubString js_EmptySubString = {0, js_empty_ucstr};
+const jschar      js_empty_ucstr[]  = {0};
+const JSSubString js_EmptySubString = {0, js_empty_ucstr};
 
 static const unsigned STRING_ELEMENT_ATTRS = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
 
 static JSBool
 str_enumerate(JSContext *cx, HandleObject obj)
 {
     RootedString str(cx, obj->asString().unbox());
     RootedValue value(cx);
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -55,18 +55,18 @@ js_toLowerCase(JSContext *cx, JSString *
 extern JSString * JS_FASTCALL
 js_toUpperCase(JSContext *cx, JSString *str);
 
 struct JSSubString {
     size_t          length;
     const jschar    *chars;
 };
 
-extern jschar      js_empty_ucstr[];
-extern JSSubString js_EmptySubString;
+extern const jschar js_empty_ucstr[];
+extern const JSSubString js_EmptySubString;
 
 /*
  * Shorthands for ASCII (7-bit) decimal and hex conversion.
  * Manually inline isdigit for performance; MSVC doesn't do this for us.
  */
 #define JS7_ISDEC(c)    ((((unsigned)(c)) - '0') <= 9)
 #define JS7_UNDEC(c)    ((c) - '0')
 #define JS7_ISHEX(c)    ((c) < 128 && isxdigit(c))
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -2057,17 +2057,17 @@ DisassWithSrc(JSContext *cx, unsigned ar
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
 #define LINE_BUF_LEN 512
     unsigned len, line1, line2, bupline;
     FILE *file;
     char linebuf[LINE_BUF_LEN];
     jsbytecode *pc, *end;
-    static char sep[] = ";-------------------------";
+    static const char sep[] = ";-------------------------";
 
     bool ok = true;
     RootedScript script(cx);
     for (unsigned i = 0; ok && i < args.length(); i++) {
         script = ValueToScript(cx, args[i]);
         if (!script)
            return false;
 
@@ -3559,17 +3559,17 @@ GetSelfHostedValue(JSContext *cx, unsign
     }
     RootedAtom srcAtom(cx, ToAtom<CanGC>(cx, args.handleAt(0)));
     if (!srcAtom)
         return false;
     RootedPropertyName srcName(cx, srcAtom->asPropertyName());
     return cx->runtime()->cloneSelfHostedValue(cx, srcName, args.rval());
 }
 
-static JSFunctionSpecWithHelp shell_functions[] = {
+static const JSFunctionSpecWithHelp shell_functions[] = {
     JS_FN_HELP("version", Version, 0, 0,
 "version([number])",
 "  Get or force a script compilation version number."),
 
     JS_FN_HELP("revertVersion", RevertVersion, 0, 0,
 "revertVersion()",
 "  Revert previously set version number."),
 
@@ -3882,17 +3882,17 @@ static JSFunctionSpecWithHelp shell_func
     JS_FN_HELP("objectEmulatingUndefined", ObjectEmulatingUndefined, 0, 0,
 "objectEmulatingUndefined()",
 "  Return a new object obj for which typeof obj === \"undefined\", obj == null\n"
 "  and obj == undefined (and vice versa for !=), and ToBoolean(obj) === false.\n"),
 
     JS_FS_HELP_END
 };
 
-static JSFunctionSpecWithHelp self_hosting_functions[] = {
+static const JSFunctionSpecWithHelp self_hosting_functions[] = {
     JS_FN_HELP("getSelfHostedValue", GetSelfHostedValue, 1, 0,
 "getSelfHostedValue()",
 "  Get a self-hosted value by its name. Note that these values don't get \n"
 "  cached, so repeatedly getting the same value creates multiple distinct clones."),
 
     JS_FS_HELP_END
 };
 
--- a/js/src/shell/jsoptparse.cpp
+++ b/js/src/shell/jsoptparse.cpp
@@ -138,20 +138,20 @@ PrintParagraph(const char *text, unsigne
             JS_NOT_REACHED("unhandled token splitting character in text");
         }
     }
 }
 
 static const char *
 OptionFlagsToFormatInfo(char shortflag, bool isValued, size_t *length)
 {
-    static const char *fmt[4] = { "  -%c --%s ",
-                                  "  --%s ",
-                                  "  -%c --%s=%s ",
-                                  "  --%s=%s " };
+    static const char * const fmt[4] = { "  -%c --%s ",
+                                         "  --%s ",
+                                         "  -%c --%s=%s ",
+                                         "  --%s=%s " };
 
     /* How mny chars w/o longflag? */
     size_t lengths[4] = { strlen(fmt[0]) - 3,
                           strlen(fmt[1]) - 3,
                           strlen(fmt[2]) - 5,
                           strlen(fmt[3]) - 5 };
     int index = isValued ? 2 : 0;
     if (!shortflag)
--- a/js/src/yarr/YarrCanonicalizeUCS2.cpp
+++ b/js/src/yarr/YarrCanonicalizeUCS2.cpp
@@ -29,34 +29,34 @@
 
 #include "YarrCanonicalizeUCS2.h"
 
 namespace JSC { namespace Yarr {
 
 #include <stddef.h>
 #include "mozilla/StandardInteger.h"
 
-uint16_t ucs2CharacterSet0[] = { 0x01c4u, 0x01c5u, 0x01c6u, 0 };
-uint16_t ucs2CharacterSet1[] = { 0x01c7u, 0x01c8u, 0x01c9u, 0 };
-uint16_t ucs2CharacterSet2[] = { 0x01cau, 0x01cbu, 0x01ccu, 0 };
-uint16_t ucs2CharacterSet3[] = { 0x01f1u, 0x01f2u, 0x01f3u, 0 };
-uint16_t ucs2CharacterSet4[] = { 0x0392u, 0x03b2u, 0x03d0u, 0 };
-uint16_t ucs2CharacterSet5[] = { 0x0395u, 0x03b5u, 0x03f5u, 0 };
-uint16_t ucs2CharacterSet6[] = { 0x0398u, 0x03b8u, 0x03d1u, 0 };
-uint16_t ucs2CharacterSet7[] = { 0x0345u, 0x0399u, 0x03b9u, 0x1fbeu, 0 };
-uint16_t ucs2CharacterSet8[] = { 0x039au, 0x03bau, 0x03f0u, 0 };
-uint16_t ucs2CharacterSet9[] = { 0x00b5u, 0x039cu, 0x03bcu, 0 };
-uint16_t ucs2CharacterSet10[] = { 0x03a0u, 0x03c0u, 0x03d6u, 0 };
-uint16_t ucs2CharacterSet11[] = { 0x03a1u, 0x03c1u, 0x03f1u, 0 };
-uint16_t ucs2CharacterSet12[] = { 0x03a3u, 0x03c2u, 0x03c3u, 0 };
-uint16_t ucs2CharacterSet13[] = { 0x03a6u, 0x03c6u, 0x03d5u, 0 };
-uint16_t ucs2CharacterSet14[] = { 0x1e60u, 0x1e61u, 0x1e9bu, 0 };
+const uint16_t ucs2CharacterSet0[] = { 0x01c4u, 0x01c5u, 0x01c6u, 0 };
+const uint16_t ucs2CharacterSet1[] = { 0x01c7u, 0x01c8u, 0x01c9u, 0 };
+const uint16_t ucs2CharacterSet2[] = { 0x01cau, 0x01cbu, 0x01ccu, 0 };
+const uint16_t ucs2CharacterSet3[] = { 0x01f1u, 0x01f2u, 0x01f3u, 0 };
+const uint16_t ucs2CharacterSet4[] = { 0x0392u, 0x03b2u, 0x03d0u, 0 };
+const uint16_t ucs2CharacterSet5[] = { 0x0395u, 0x03b5u, 0x03f5u, 0 };
+const uint16_t ucs2CharacterSet6[] = { 0x0398u, 0x03b8u, 0x03d1u, 0 };
+const uint16_t ucs2CharacterSet7[] = { 0x0345u, 0x0399u, 0x03b9u, 0x1fbeu, 0 };
+const uint16_t ucs2CharacterSet8[] = { 0x039au, 0x03bau, 0x03f0u, 0 };
+const uint16_t ucs2CharacterSet9[] = { 0x00b5u, 0x039cu, 0x03bcu, 0 };
+const uint16_t ucs2CharacterSet10[] = { 0x03a0u, 0x03c0u, 0x03d6u, 0 };
+const uint16_t ucs2CharacterSet11[] = { 0x03a1u, 0x03c1u, 0x03f1u, 0 };
+const uint16_t ucs2CharacterSet12[] = { 0x03a3u, 0x03c2u, 0x03c3u, 0 };
+const uint16_t ucs2CharacterSet13[] = { 0x03a6u, 0x03c6u, 0x03d5u, 0 };
+const uint16_t ucs2CharacterSet14[] = { 0x1e60u, 0x1e61u, 0x1e9bu, 0 };
 
 static const size_t UCS2_CANONICALIZATION_SETS = 15;
-uint16_t* characterSetInfo[UCS2_CANONICALIZATION_SETS] = {
+const uint16_t* const characterSetInfo[UCS2_CANONICALIZATION_SETS] = {
     ucs2CharacterSet0,
     ucs2CharacterSet1,
     ucs2CharacterSet2,
     ucs2CharacterSet3,
     ucs2CharacterSet4,
     ucs2CharacterSet5,
     ucs2CharacterSet6,
     ucs2CharacterSet7,
@@ -65,17 +65,17 @@ uint16_t* characterSetInfo[UCS2_CANONICA
     ucs2CharacterSet10,
     ucs2CharacterSet11,
     ucs2CharacterSet12,
     ucs2CharacterSet13,
     ucs2CharacterSet14,
 };
 
 const size_t UCS2_CANONICALIZATION_RANGES = 364;
-UCS2CanonicalizationRange rangeInfo[UCS2_CANONICALIZATION_RANGES] = {
+const UCS2CanonicalizationRange rangeInfo[UCS2_CANONICALIZATION_RANGES] = {
     { 0x0000u, 0x0040u, 0x0000u, CanonicalizeUnique },
     { 0x0041u, 0x005au, 0x0020u, CanonicalizeRangeLo },
     { 0x005bu, 0x0060u, 0x0000u, CanonicalizeUnique },
     { 0x0061u, 0x007au, 0x0020u, CanonicalizeRangeHi },
     { 0x007bu, 0x00b4u, 0x0000u, CanonicalizeUnique },
     { 0x00b5u, 0x00b5u, 0x0009u, CanonicalizeSet },
     { 0x00b6u, 0x00bfu, 0x0000u, CanonicalizeUnique },
     { 0x00c0u, 0x00d6u, 0x0020u, CanonicalizeRangeLo },
@@ -433,17 +433,17 @@ UCS2CanonicalizationRange rangeInfo[UCS2
     { 0xa7aau, 0xff20u, 0x0000u, CanonicalizeUnique },
     { 0xff21u, 0xff3au, 0x0020u, CanonicalizeRangeLo },
     { 0xff3bu, 0xff40u, 0x0000u, CanonicalizeUnique },
     { 0xff41u, 0xff5au, 0x0020u, CanonicalizeRangeHi },
     { 0xff5bu, 0xffffu, 0x0000u, CanonicalizeUnique },
 };
 
 const size_t LATIN_CANONICALIZATION_RANGES = 20;
-LatinCanonicalizationRange latinRangeInfo[LATIN_CANONICALIZATION_RANGES] = {
+const LatinCanonicalizationRange latinRangeInfo[LATIN_CANONICALIZATION_RANGES] = {
     { 0x0000u, 0x0040u, 0x0000u, CanonicalizeLatinSelf },
     { 0x0041u, 0x005au, 0x0000u, CanonicalizeLatinMask0x20 },
     { 0x005bu, 0x0060u, 0x0000u, CanonicalizeLatinSelf },
     { 0x0061u, 0x007au, 0x0000u, CanonicalizeLatinMask0x20 },
     { 0x007bu, 0x00bfu, 0x0000u, CanonicalizeLatinSelf },
     { 0x00c0u, 0x00d6u, 0x0000u, CanonicalizeLatinMask0x20 },
     { 0x00d7u, 0x00d7u, 0x0000u, CanonicalizeLatinSelf },
     { 0x00d8u, 0x00deu, 0x0000u, CanonicalizeLatinMask0x20 },
--- a/js/src/yarr/YarrCanonicalizeUCS2.h
+++ b/js/src/yarr/YarrCanonicalizeUCS2.h
@@ -42,53 +42,53 @@ enum UCS2CanonicalizationType {
     CanonicalizeSet,                  // Value indicates a set in characterSetInfo.
     CanonicalizeRangeLo,              // Value is positive delta to pair, E.g. 0x41 has value 0x20, -> 0x61.
     CanonicalizeRangeHi,              // Value is positive delta to pair, E.g. 0x61 has value 0x20, -> 0x41.
     CanonicalizeAlternatingAligned,   // Aligned consequtive pair, e.g. 0x1f4,0x1f5.
     CanonicalizeAlternatingUnaligned  // Unaligned consequtive pair, e.g. 0x241,0x242.
 };
 struct UCS2CanonicalizationRange { uint16_t begin, end, value, type; };
 extern const size_t UCS2_CANONICALIZATION_RANGES;
-extern uint16_t* characterSetInfo[];
-extern UCS2CanonicalizationRange rangeInfo[];
+extern const uint16_t* const characterSetInfo[];
+extern const UCS2CanonicalizationRange rangeInfo[];
 
 // This table is similar to the full rangeInfo table, however this maps from UCS2 codepoints to
 // the set of Latin1 codepoints that could match.
 enum LatinCanonicalizationType {
     CanonicalizeLatinSelf,     // This character is in the Latin1 range, but has no canonical equivalent in the range.
     CanonicalizeLatinMask0x20, // One of a pair of characters, under the mask 0x20.
     CanonicalizeLatinOther,    // This character is not in the Latin1 range, but canonicalizes to another that is.
     CanonicalizeLatinInvalid   // Cannot match against Latin1 input.
 };
 struct LatinCanonicalizationRange { uint16_t begin, end, value, type; };
 extern const size_t LATIN_CANONICALIZATION_RANGES;
-extern LatinCanonicalizationRange latinRangeInfo[];
+extern const LatinCanonicalizationRange latinRangeInfo[];
 
 // This searches in log2 time over ~364 entries, so should typically result in 8 compares.
-inline UCS2CanonicalizationRange* rangeInfoFor(UChar ch)
+inline const UCS2CanonicalizationRange* rangeInfoFor(UChar ch)
 {
-    UCS2CanonicalizationRange* info = rangeInfo;
+    const UCS2CanonicalizationRange* info = rangeInfo;
     size_t entries = UCS2_CANONICALIZATION_RANGES;
 
     while (true) {
         size_t candidate = entries >> 1;
-        UCS2CanonicalizationRange* candidateInfo = info + candidate;
+        const UCS2CanonicalizationRange* candidateInfo = info + candidate;
         if (ch < candidateInfo->begin)
             entries = candidate;
         else if (ch <= candidateInfo->end)
             return candidateInfo;
         else {
             info = candidateInfo + 1;
             entries -= (candidate + 1);
         }
     }
 }
 
 // Should only be called for characters that have one canonically matching value.
-inline UChar getCanonicalPair(UCS2CanonicalizationRange* info, UChar ch)
+inline UChar getCanonicalPair(const UCS2CanonicalizationRange* info, UChar ch)
 {
     ASSERT(ch >= info->begin && ch <= info->end);
     switch (info->type) {
     case CanonicalizeRangeLo:
         return ch + info->value;
     case CanonicalizeRangeHi:
         return ch - info->value;
     case CanonicalizeAlternatingAligned:
@@ -106,22 +106,22 @@ inline UChar getCanonicalPair(UCS2Canoni
 inline bool isCanonicallyUnique(UChar ch)
 {
     return rangeInfoFor(ch)->type == CanonicalizeUnique;
 }
 
 // Returns true if values are equal, under the canonicalization rules.
 inline bool areCanonicallyEquivalent(UChar a, UChar b)
 {
-    UCS2CanonicalizationRange* info = rangeInfoFor(a);
+    const UCS2CanonicalizationRange* info = rangeInfoFor(a);
     switch (info->type) {
     case CanonicalizeUnique:
         return a == b;
     case CanonicalizeSet: {
-        for (uint16_t* set = characterSetInfo[info->value]; (a = *set); ++set) {
+        for (const uint16_t* set = characterSetInfo[info->value]; (a = *set); ++set) {
             if (a == b)
                 return true;
         }
         return false;
     }
     case CanonicalizeRangeLo:
         return (a == b) || (a + info->value == b);
     case CanonicalizeRangeHi:
--- a/js/src/yarr/YarrPattern.cpp
+++ b/js/src/yarr/YarrPattern.cpp
@@ -85,31 +85,31 @@ public:
 
         // Simple case, not a case-insensitive match.
         if (!m_isCaseInsensitive) {
             addSorted(m_matchesUnicode, ch);
             return;
         }
 
         // Add multiple matches, if necessary.
-        UCS2CanonicalizationRange* info = rangeInfoFor(ch);
+        const UCS2CanonicalizationRange* info = rangeInfoFor(ch);
         if (info->type == CanonicalizeUnique)
             addSorted(m_matchesUnicode, ch);
         else
             putUnicodeIgnoreCase(ch, info);
     }
 
-    void putUnicodeIgnoreCase(UChar ch, UCS2CanonicalizationRange* info)
+    void putUnicodeIgnoreCase(UChar ch, const UCS2CanonicalizationRange* info)
     {
         ASSERT(m_isCaseInsensitive);
         ASSERT(ch > 0x7f);
         ASSERT(ch >= info->begin && ch <= info->end);
         ASSERT(info->type != CanonicalizeUnique);
         if (info->type == CanonicalizeSet) {
-            for (uint16_t* set = characterSetInfo[info->value]; (ch = *set); ++set)
+            for (const uint16_t* set = characterSetInfo[info->value]; (ch = *set); ++set)
                 addSorted(m_matchesUnicode, ch);
         } else {
             addSorted(m_matchesUnicode, ch);
             addSorted(m_matchesUnicode, getCanonicalPair(info, ch));
         }
     }
 
     void putRange(UChar lo, UChar hi)
@@ -130,28 +130,28 @@ public:
             return;
 
         lo = std::max(lo, (UChar)0x80);
         addSortedRange(m_rangesUnicode, lo, hi);
         
         if (!m_isCaseInsensitive)
             return;
 
-        UCS2CanonicalizationRange* info = rangeInfoFor(lo);
+        const UCS2CanonicalizationRange* info = rangeInfoFor(lo);
         while (true) {
             // Handle the range [lo .. end]
             UChar end = std::min<UChar>(info->end, hi);
 
             switch (info->type) {
             case CanonicalizeUnique:
                 // Nothing to do - no canonical equivalents.
                 break;
             case CanonicalizeSet: {
                 UChar ch;
-                for (uint16_t* set = characterSetInfo[info->value]; (ch = *set); ++set)
+                for (const uint16_t* set = characterSetInfo[info->value]; (ch = *set); ++set)
                     addSorted(m_matchesUnicode, ch);
                 break;
             }
             case CanonicalizeRangeLo:
                 addSortedRange(m_rangesUnicode, lo + info->value, end + info->value);
                 break;
             case CanonicalizeRangeHi:
                 addSortedRange(m_rangesUnicode, lo - info->value, end - info->value);
@@ -321,17 +321,17 @@ public:
     {
         // We handle case-insensitive checking of unicode characters which do have both
         // cases by handling them as if they were defined using a CharacterClass.
         if (!m_pattern.m_ignoreCase || isASCII(ch)) {
             m_alternative->m_terms.append(PatternTerm(ch));
             return;
         }
 
-        UCS2CanonicalizationRange* info = rangeInfoFor(ch);
+        const UCS2CanonicalizationRange* info = rangeInfoFor(ch);
         if (info->type == CanonicalizeUnique) {
             m_alternative->m_terms.append(PatternTerm(ch));
             return;
         }
 
         m_characterClassConstructor.putUnicodeIgnoreCase(ch, info);
         CharacterClass* newCharacterClass = m_characterClassConstructor.charClass();
         m_pattern.m_userCharacterClasses.append(newCharacterClass);
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -77,22 +77,22 @@ JSValIsInterfaceOfType(JSContext *cx, Ha
 }
 
 char* xpc_CloneAllAccess()
 {
     static const char allAccess[] = "AllAccess";
     return (char*)nsMemory::Clone(allAccess, sizeof(allAccess));
 }
 
-char * xpc_CheckAccessList(const PRUnichar* wideName, const char* list[])
+char * xpc_CheckAccessList(const PRUnichar* wideName, const char* const list[])
 {
     nsAutoCString asciiName;
     CopyUTF16toUTF8(nsDependentString(wideName), asciiName);
 
-    for (const char** p = list; *p; p++)
+    for (const char* const* p = list; *p; p++)
         if (!strcmp(*p, asciiName.get()))
             return xpc_CloneAllAccess();
 
     return nullptr;
 }
 
 /***************************************************************************/
 /***************************************************************************/
@@ -1324,45 +1324,45 @@ NS_IMPL_THREADSAFE_RELEASE(nsXPCComponen
 
 /* bool newEnumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in uint32_t enum_op, in JSValPtr statep, out JSID idp); */
 NS_IMETHODIMP
 nsXPCComponents_Results::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
                                       JSContext * cx, JSObject * obj,
                                       uint32_t enum_op, jsval * statep,
                                       jsid * idp, bool *_retval)
 {
-    void** iter;
+    const void** iter;
 
     switch (enum_op) {
         case JSENUMERATE_INIT:
         case JSENUMERATE_INIT_ALL:
         {
             if (idp)
                 *idp = INT_TO_JSID(nsXPCException::GetNSResultCount());
 
             void** space = (void**) new char[sizeof(void*)];
             *space = nullptr;
             *statep = PRIVATE_TO_JSVAL(space);
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
             const char* name;
-            iter = (void**) JSVAL_TO_PRIVATE(*statep);
+            iter = (const void**) JSVAL_TO_PRIVATE(*statep);
             if (nsXPCException::IterateNSResults(nullptr, &name, nullptr, iter)) {
                 JSString* idstr = JS_NewStringCopyZ(cx, name);
                 if (idstr && JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp))
                     return NS_OK;
             }
             // else... FALL THROUGH
         }
 
         case JSENUMERATE_DESTROY:
         default:
-            iter = (void**) JSVAL_TO_PRIVATE(*statep);
+            iter = (const void**) JSVAL_TO_PRIVATE(*statep);
             delete [] (char*) iter;
             *statep = JSVAL_NULL;
             return NS_OK;
     }
 }
 
 
 /* bool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in uint32_t flags, out JSObjectPtr objp); */
@@ -1373,17 +1373,17 @@ nsXPCComponents_Results::NewResolve(nsIX
                                     JSObject * *objp, bool *_retval)
 {
     RootedObject obj(cx, objArg);
     RootedId id(cx, idArg);
     JSAutoByteString name;
 
     if (JSID_IS_STRING(id) && name.encodeLatin1(cx, JSID_TO_STRING(id))) {
         const char* rv_name;
-        void* iter = nullptr;
+        const void* iter = nullptr;
         nsresult rv;
         while (nsXPCException::IterateNSResults(&rv, &rv_name, nullptr, &iter)) {
             if (!strcmp(name.ptr(), rv_name)) {
                 jsval val = JS_NumberValue((double)rv);
 
                 *objp = obj;
                 if (!JS_DefinePropertyById(cx, obj, id, val,
                                            nullptr, nullptr,
@@ -4390,17 +4390,17 @@ nsXPCComponents_Utils::CanCreateWrapper(
     *_retval = xpc_CloneAllAccess();
     return NS_OK;
 }
 
 /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
 NS_IMETHODIMP
 nsXPCComponents_Utils::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
 {
-    static const char* allowed[] = { "lookupMethod", "evalInSandbox", nullptr };
+    static const char* const allowed[] = { "lookupMethod", "evalInSandbox", nullptr };
     *_retval = xpc_CheckAccessList(methodName, allowed);
     return NS_OK;
 }
 
 /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
 NS_IMETHODIMP
 nsXPCComponents_Utils::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
 {
@@ -4912,32 +4912,32 @@ nsXPCComponents::CanCreateWrapper(const 
     *_retval = xpc_CloneAllAccess();
     return NS_OK;
 }
 
 /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
 NS_IMETHODIMP
 nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
 {
-    static const char* allowed[] = { "isSuccessCode", "lookupMethod", nullptr };
+    static const char* const allowed[] = { "isSuccessCode", "lookupMethod", nullptr };
     *_retval = xpc_CheckAccessList(methodName, allowed);
     if (*_retval &&
         methodName[0] == 'l' &&
         !nsContentUtils::IsCallerXBL())
     {
         Telemetry::Accumulate(Telemetry::COMPONENTS_LOOKUPMETHOD_ACCESSED_BY_CONTENT, true);
     }
     return NS_OK;
 }
 
 /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
 NS_IMETHODIMP
 nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
 {
-    static const char* allowed[] = { "interfaces", "interfacesByID", "results", nullptr};
+    static const char* const allowed[] = { "interfaces", "interfacesByID", "results", nullptr};
     *_retval = xpc_CheckAccessList(propertyName, allowed);
     if (*_retval &&
         propertyName[0] == 'i' &&
         !nsContentUtils::IsCallerXBL())
     {
         Telemetry::Accumulate(Telemetry::COMPONENTS_INTERFACES_ACCESSED_BY_CONTENT, true);
     }
     return NS_OK;
--- a/js/xpconnect/src/XPCException.cpp
+++ b/js/xpconnect/src/XPCException.cpp
@@ -14,17 +14,17 @@
 /* Quick and dirty mapping of well known result codes to strings. We only
 *  call this when building an exception object, so iterating the short array
 *  is not too bad.
 *
 *  It sure would be nice to have exceptions declared in idl and available
 *  in some more global way at runtime.
 */
 
-static struct ResultMap
+static const struct ResultMap
 {nsresult rv; const char* name; const char* format;} map[] = {
 #define XPC_MSG_DEF(val, format) \
     {(val), #val, format},
 #include "xpc.msg"
 #undef XPC_MSG_DEF
     {NS_OK,0,0}   // sentinel to mark end of array
 };
 
@@ -32,34 +32,34 @@ static struct ResultMap
 
 // static
 JSBool
 nsXPCException::NameAndFormatForNSResult(nsresult rv,
                                          const char** name,
                                          const char** format)
 {
 
-    for (ResultMap* p = map; p->name; p++) {
+    for (const ResultMap* p = map; p->name; p++) {
         if (rv == p->rv) {
             if (name) *name = p->name;
             if (format) *format = p->format;
             return true;
         }
     }
     return false;
 }
 
 // static
-void*
+const void*
 nsXPCException::IterateNSResults(nsresult* rv,
                                  const char** name,
                                  const char** format,
-                                 void** iterp)
+                                 const void** iterp)
 {
-    ResultMap* p = (ResultMap*) *iterp;
+    const ResultMap* p = (const ResultMap*) *iterp;
     if (!p)
         p = map;
     else
         p++;
     if (!p->name)
         p = nullptr;
     else {
         if (rv)
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -560,27 +560,27 @@ nsJSIID::CanCreateWrapper(const nsIID * 
     *_retval = xpc_CloneAllAccess();
     return NS_OK;
 }
 
 /* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
 NS_IMETHODIMP
 nsJSIID::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
 {
-    static const char* allowed[] = {"equals", "toString", nullptr};
+    static const char* const allowed[] = {"equals", "toString", nullptr};
 
     *_retval = xpc_CheckAccessList(methodName, allowed);
     return NS_OK;
 }
 
 /* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
 NS_IMETHODIMP
 nsJSIID::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
 {
-    static const char* allowed[] = {"name", "number", "valid", nullptr};
+    static const char* const allowed[] = {"name", "number", "valid", nullptr};
     *_retval = xpc_CheckAccessList(propertyName, allowed);
     return NS_OK;
 }
 
 /* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
 NS_IMETHODIMP
 nsJSIID::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
 {
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -3270,17 +3270,17 @@ void DEBUG_ReportShadowedMembers(XPCNati
 
     XPCNativeScriptableInfo* si = wrapper ?
             wrapper->GetScriptableInfo() :
             proto->GetScriptableInfo();
 
     // We just want to skip some classes...
     if (si) {
         // Add any classnames to skip to this (null terminated) array...
-        static const char* skipClasses[] = {
+        static const char* const skipClasses[] = {
             "Window",
             "HTMLDocument",
             "HTMLCollection",
             "Event",
             "ChromeWindow",
             nullptr
         };
 
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -3095,20 +3095,20 @@ public:
                                  nsIStackFrame *aLocation,
                                  nsISupports *aData,
                                  nsIException** exception);
 
     static JSBool NameAndFormatForNSResult(nsresult rv,
                                            const char** name,
                                            const char** format);
 
-    static void* IterateNSResults(nsresult* rv,
-                                  const char** name,
-                                  const char** format,
-                                  void** iterp);
+    static const void* IterateNSResults(nsresult* rv,
+                                        const char** name,
+                                        const char** format,
+                                        const void** iterp);
 
     static uint32_t GetNSResultCount();
 
     nsXPCException();
     virtual ~nsXPCException();
 
     static void InitStatics() { sEverMadeOneFromFactory = false; }
 
@@ -3584,17 +3584,17 @@ typedef ArrayAutoMarkingPtr<XPCNativeInt
 
 /***************************************************************************/
 // Allocates a string that grants all access ("AllAccess")
 
 extern char* xpc_CloneAllAccess();
 /***************************************************************************/
 // Returns access if wideName is in list
 
-extern char * xpc_CheckAccessList(const PRUnichar* wideName, const char* list[]);
+extern char * xpc_CheckAccessList(const PRUnichar* wideName, const char* const list[]);
 
 /***************************************************************************/
 // in xpcvariant.cpp...
 
 // {1809FD50-91E8-11d5-90F9-0010A4E73D9A}
 #define XPCVARIANT_IID                                                        \
     {0x1809fd50, 0x91e8, 0x11d5,                                              \
       { 0x90, 0xf9, 0x0, 0x10, 0xa4, 0xe7, 0x3d, 0x9a } }