Bug 915855 - SpiderMonkey: Clean up "const static" to "static const". r=terrence
authorDan Gohman <sunfish@google.com>
Thu, 12 Sep 2013 16:38:40 -0700
changeset 159861 a84f8558ca61ff44c2cad7c69474f421d40e1b22
parent 159860 32da64c564db95f72f0b6e7260e4d6e74954e90a
child 159862 23f0185620af555fa91008c4882705fbf9285fa1
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs915855
milestone26.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 915855 - SpiderMonkey: Clean up "const static" to "static const". r=terrence
js/src/gc/Nursery-inl.h
js/src/gc/Nursery.h
js/src/gc/Statistics.cpp
js/src/gc/StoreBuffer.h
js/src/gc/Verifier.cpp
js/src/jit/BaselineIC.h
js/src/jit/IonCompartment.h
js/src/jscrashformat.h
js/src/jscrashreport.cpp
js/src/jsgc.h
js/src/vm/ForkJoin.cpp
js/src/vm/Stack.h
--- a/js/src/gc/Nursery-inl.h
+++ b/js/src/gc/Nursery-inl.h
@@ -21,17 +21,17 @@ namespace gc {
  * This structure overlays a Cell in the Nursery and re-purposes its memory
  * for managing the Nursery collection process.
  */
 class RelocationOverlay
 {
     friend class MinorCollectionTracer;
 
     /* The low bit is set so this should never equal a normal pointer. */
-    const static uintptr_t Relocated = uintptr_t(0xbad0bad1);
+    static const uintptr_t Relocated = uintptr_t(0xbad0bad1);
 
     /* Set to Relocated when moved. */
     uintptr_t magic_;
 
     /* The location |this| was moved to. */
     Cell *newLocation_;
 
     /* A list entry to track all relocated things. */
--- a/js/src/gc/Nursery.h
+++ b/js/src/gc/Nursery.h
@@ -39,20 +39,20 @@ class CodeGenerator;
 class MacroAssembler;
 class ICStubCompiler;
 class BaselineCompiler;
 }
 
 class Nursery
 {
   public:
-    const static int NumNurseryChunks = 16;
-    const static int LastNurseryChunk = NumNurseryChunks - 1;
-    const static size_t Alignment = gc::ChunkSize;
-    const static size_t NurserySize = gc::ChunkSize * NumNurseryChunks;
+    static const int NumNurseryChunks = 16;
+    static const int LastNurseryChunk = NumNurseryChunks - 1;
+    static const size_t Alignment = gc::ChunkSize;
+    static const size_t NurserySize = gc::ChunkSize * NumNurseryChunks;
 
     explicit Nursery(JSRuntime *rt)
       : runtime_(rt),
         position_(0),
         currentEnd_(0),
         currentChunk_(0),
         numActiveChunks_(0)
     {}
@@ -133,35 +133,35 @@ class Nursery
      * The set of externally malloced slots potentially kept live by objects
      * stored in the nursery. Any external slots that do not belong to a
      * tenured thing at the end of a minor GC must be freed.
      */
     typedef HashSet<HeapSlot *, PointerHasher<HeapSlot *, 3>, SystemAllocPolicy> HugeSlotsSet;
     HugeSlotsSet hugeSlots;
 
     /* The marking bitmap for the fallback marker. */
-    const static size_t ThingAlignment = sizeof(JS::Value);
-    const static size_t FallbackBitmapBits = NurserySize / ThingAlignment;
+    static const size_t ThingAlignment = sizeof(JS::Value);
+    static const size_t FallbackBitmapBits = NurserySize / ThingAlignment;
     BitArray<FallbackBitmapBits> fallbackBitmap;
 
 #ifdef DEBUG
     /*
      * In DEBUG builds, these bytes indicate the state of an unused segment of
      * nursery-allocated memory.
      */
-    const static uint8_t FreshNursery = 0x2a;
-    const static uint8_t SweptNursery = 0x2b;
-    const static uint8_t AllocatedThing = 0x2c;
+    static const uint8_t FreshNursery = 0x2a;
+    static const uint8_t SweptNursery = 0x2b;
+    static const uint8_t AllocatedThing = 0x2c;
 #endif
 
     /* The maximum number of slots allowed to reside inline in the nursery. */
-    const static size_t MaxNurserySlots = 100;
+    static const size_t MaxNurserySlots = 100;
 
     /* The amount of space in the mapped nursery available to allocations. */
-    const static size_t NurseryChunkUsableSize = gc::ChunkSize - sizeof(JSRuntime *);
+    static const size_t NurseryChunkUsableSize = gc::ChunkSize - sizeof(JSRuntime *);
 
     struct NurseryChunkLayout {
         char data[NurseryChunkUsableSize];
         JSRuntime *runtime;
         uintptr_t start() { return uintptr_t(&data); }
         uintptr_t end() { return uintptr_t(&runtime); }
     };
     NurseryChunkLayout &chunk(int index) const {
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -31,17 +31,17 @@ static const int64_t SLICE_MIN_REPORT_TI
 class gcstats::StatisticsSerializer
 {
     typedef Vector<char, 128, SystemAllocPolicy> CharBuffer;
     CharBuffer buf_;
     bool asJSON_;
     bool needComma_;
     bool oom_;
 
-    const static int MaxFieldValueLength = 128;
+    static const int MaxFieldValueLength = 128;
 
   public:
     enum Mode {
         AsJSON = true,
         AsText = false
     };
 
     StatisticsSerializer(Mode asJSON)
--- a/js/src/gc/StoreBuffer.h
+++ b/js/src/gc/StoreBuffer.h
@@ -67,20 +67,20 @@ typedef HashSet<void *, PointerHasher<vo
 
 /*
  * The StoreBuffer observes all writes that occur in the system and performs
  * efficient filtering of them to derive a remembered set for nursery GC.
  */
 class StoreBuffer
 {
     /* The size of a single block of store buffer storage space. */
-    const static size_t ChunkSize = 1 << 16; /* 64KiB */
+    static const size_t ChunkSize = 1 << 16; /* 64KiB */
 
     /* The size at which a block is about to overflow. */
-    const static size_t MinAvailableSize = (size_t)(ChunkSize * 1.0 / 8.0);
+    static const size_t MinAvailableSize = (size_t)(ChunkSize * 1.0 / 8.0);
 
     /*
      * This buffer holds only a single type of edge. Using this buffer is more
      * efficient than the generic buffer when many writes will be to the same
      * type of edge: e.g. Value or Cell*.
      */
     template<typename T>
     class MonoTypeBuffer
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -523,17 +523,17 @@ oom:
 }
 
 static bool
 IsMarkedOrAllocated(Cell *cell)
 {
     return cell->isMarked() || cell->arenaHeader()->allocatedDuringIncremental;
 }
 
-const static uint32_t MAX_VERIFIER_EDGES = 1000;
+static const uint32_t MAX_VERIFIER_EDGES = 1000;
 
 /*
  * This function is called by EndVerifyBarriers for every heap edge. If the edge
  * already existed in the original snapshot, we "cancel it out" by overwriting
  * it with NULL. EndVerifyBarriers later asserts that the remaining non-NULL
  * edges (i.e., the ones from the original snapshot that must have been
  * modified) must point to marked objects.
  */
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -5353,17 +5353,17 @@ class ICCall_Native : public ICMonitored
 
 class ICCall_ScriptedApplyArray : public ICMonitoredStub
 {
     friend class ICStubSpace;
   public:
     // The maximum length of an inlineable funcall array.
     // Keep this small to avoid controllable stack overflows by attackers passing large
     // arrays to fun.apply.
-    const static uint32_t MAX_ARGS_ARRAY_LENGTH = 16;
+    static const uint32_t MAX_ARGS_ARRAY_LENGTH = 16;
 
   protected:
     uint32_t pcOffset_;
 
     ICCall_ScriptedApplyArray(IonCode *stubCode, ICStub *firstMonitorStub, uint32_t pcOffset)
       : ICMonitoredStub(ICStub::Call_ScriptedApplyArray, stubCode, firstMonitorStub),
         pcOffset_(pcOffset)
     {}
--- a/js/src/jit/IonCompartment.h
+++ b/js/src/jit/IonCompartment.h
@@ -88,33 +88,33 @@ class ICStubSpace
         return allocator_.sizeOfExcludingThis(mallocSizeOf);
     }
 };
 
 // Space for optimized stubs. Every IonCompartment has a single
 // OptimizedICStubSpace.
 struct OptimizedICStubSpace : public ICStubSpace
 {
-    const static size_t STUB_DEFAULT_CHUNK_SIZE = 4 * 1024;
+    static const size_t STUB_DEFAULT_CHUNK_SIZE = 4 * 1024;
 
   public:
     OptimizedICStubSpace()
       : ICStubSpace(STUB_DEFAULT_CHUNK_SIZE)
     {}
 
     void free() {
         allocator_.freeAll();
     }
 };
 
 // Space for fallback stubs. Every BaselineScript has a
 // FallbackICStubSpace.
 struct FallbackICStubSpace : public ICStubSpace
 {
-    const static size_t STUB_DEFAULT_CHUNK_SIZE = 256;
+    static const size_t STUB_DEFAULT_CHUNK_SIZE = 256;
 
   public:
     FallbackICStubSpace()
       : ICStubSpace(STUB_DEFAULT_CHUNK_SIZE)
     {}
 
     inline void adoptFrom(FallbackICStubSpace *other) {
         allocator_.steal(&(other->allocator_));
--- a/js/src/jscrashformat.h
+++ b/js/src/jscrashformat.h
@@ -5,18 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jscrashformat_h
 #define jscrashformat_h
 
 namespace js {
 namespace crash {
 
-const static int crash_cookie_len = 16;
-const static char crash_cookie[crash_cookie_len] = "*J*S*CRASHDATA*";
+static const int crash_cookie_len = 16;
+static const char crash_cookie[crash_cookie_len] = "*J*S*CRASHDATA*";
 
 /* These values are used for CrashHeader::id. */
 enum {
     JS_CRASH_STACK_GC = 0x400,
     JS_CRASH_STACK_ERROR = 0x401,
     JS_CRASH_RING = 0x800
 };
 
@@ -36,17 +36,17 @@ struct CrashHeader
     CrashHeader(uint64_t id) : id(id) { memcpy(cookie, crash_cookie, crash_cookie_len); }
 };
 
 struct CrashRegisters
 {
     uint64_t ip, sp, bp;
 };
 
-const static int crash_buffer_size = 32 * 1024;
+static const int crash_buffer_size = 32 * 1024;
 
 struct CrashStack
 {
     CrashStack(uint64_t id) : header(id) {}
 
     CrashHeader header;
     uint64_t snaptime;    /* Unix time when the stack was snapshotted. */
     CrashRegisters regs;  /* Register contents for the snapshot. */
--- a/js/src/jscrashreport.cpp
+++ b/js/src/jscrashreport.cpp
@@ -10,17 +10,17 @@
 
 #include "jsapi.h"
 #include "jscrashformat.h"
 #include "jsutil.h"
 
 using namespace js;
 using namespace js::crash;
 
-const static int stack_snapshot_max_size = 32768;
+static const int stack_snapshot_max_size = 32768;
 
 #if defined(XP_WIN)
 
 #include <windows.h>
 
 static bool
 GetStack(uint64_t *stack, uint64_t *stack_len, CrashRegisters *regs, char *buffer, size_t size)
 {
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -121,36 +121,36 @@ MapAllocToTraceKind(AllocKind kind)
         JSTRACE_STRING,     /* FINALIZE_EXTERNAL_STRING */
         JSTRACE_IONCODE,    /* FINALIZE_IONCODE */
     };
     JS_STATIC_ASSERT(JS_ARRAY_LENGTH(map) == FINALIZE_LIMIT);
     return map[kind];
 }
 
 template <typename T> struct MapTypeToTraceKind {};
-template <> struct MapTypeToTraceKind<JSObject>         { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<JSFunction>       { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<ArgumentsObject>  { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<ArrayBufferObject>{ const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<ArrayBufferViewObject>{ const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<DebugScopeObject> { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<GlobalObject>     { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<ScopeObject>      { const static JSGCTraceKind kind = JSTRACE_OBJECT; };
-template <> struct MapTypeToTraceKind<JSScript>         { const static JSGCTraceKind kind = JSTRACE_SCRIPT; };
-template <> struct MapTypeToTraceKind<LazyScript>       { const static JSGCTraceKind kind = JSTRACE_LAZY_SCRIPT; };
-template <> struct MapTypeToTraceKind<Shape>            { const static JSGCTraceKind kind = JSTRACE_SHAPE; };
-template <> struct MapTypeToTraceKind<BaseShape>        { const static JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
-template <> struct MapTypeToTraceKind<UnownedBaseShape> { const static JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
-template <> struct MapTypeToTraceKind<types::TypeObject>{ const static JSGCTraceKind kind = JSTRACE_TYPE_OBJECT; };
-template <> struct MapTypeToTraceKind<JSAtom>           { const static JSGCTraceKind kind = JSTRACE_STRING; };
-template <> struct MapTypeToTraceKind<JSString>         { const static JSGCTraceKind kind = JSTRACE_STRING; };
-template <> struct MapTypeToTraceKind<JSFlatString>     { const static JSGCTraceKind kind = JSTRACE_STRING; };
-template <> struct MapTypeToTraceKind<JSLinearString>   { const static JSGCTraceKind kind = JSTRACE_STRING; };
-template <> struct MapTypeToTraceKind<PropertyName>     { const static JSGCTraceKind kind = JSTRACE_STRING; };
-template <> struct MapTypeToTraceKind<jit::IonCode>     { const static JSGCTraceKind kind = JSTRACE_IONCODE; };
+template <> struct MapTypeToTraceKind<JSObject>         { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<JSFunction>       { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<ArgumentsObject>  { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<ArrayBufferObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<ArrayBufferViewObject>{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<DebugScopeObject> { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<GlobalObject>     { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<ScopeObject>      { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
+template <> struct MapTypeToTraceKind<JSScript>         { static const JSGCTraceKind kind = JSTRACE_SCRIPT; };
+template <> struct MapTypeToTraceKind<LazyScript>       { static const JSGCTraceKind kind = JSTRACE_LAZY_SCRIPT; };
+template <> struct MapTypeToTraceKind<Shape>            { static const JSGCTraceKind kind = JSTRACE_SHAPE; };
+template <> struct MapTypeToTraceKind<BaseShape>        { static const JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
+template <> struct MapTypeToTraceKind<UnownedBaseShape> { static const JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
+template <> struct MapTypeToTraceKind<types::TypeObject>{ static const JSGCTraceKind kind = JSTRACE_TYPE_OBJECT; };
+template <> struct MapTypeToTraceKind<JSAtom>           { static const JSGCTraceKind kind = JSTRACE_STRING; };
+template <> struct MapTypeToTraceKind<JSString>         { static const JSGCTraceKind kind = JSTRACE_STRING; };
+template <> struct MapTypeToTraceKind<JSFlatString>     { static const JSGCTraceKind kind = JSTRACE_STRING; };
+template <> struct MapTypeToTraceKind<JSLinearString>   { static const JSGCTraceKind kind = JSTRACE_STRING; };
+template <> struct MapTypeToTraceKind<PropertyName>     { static const JSGCTraceKind kind = JSTRACE_STRING; };
+template <> struct MapTypeToTraceKind<jit::IonCode>     { static const JSGCTraceKind kind = JSTRACE_IONCODE; };
 
 #if defined(JSGC_GENERATIONAL) || defined(DEBUG)
 static inline bool
 IsNurseryAllocable(AllocKind kind)
 {
     JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT);
     static const bool map[] = {
         false,     /* FINALIZE_OBJECT0 */
--- a/js/src/vm/ForkJoin.cpp
+++ b/js/src/vm/ForkJoin.cpp
@@ -206,17 +206,17 @@ enum ForkJoinMode {
 
 unsigned ForkJoinSlice::ThreadPrivateIndex;
 bool ForkJoinSlice::TLSInitialized;
 
 class ParallelDo
 {
   public:
     // For tests, make sure to keep this in sync with minItemsTestingThreshold.
-    const static uint32_t MAX_BAILOUTS = 3;
+    static const uint32_t MAX_BAILOUTS = 3;
     uint32_t bailouts;
 
     // Information about the bailout:
     ParallelBailoutCause bailoutCause;
     RootedScript bailoutScript;
     jsbytecode *bailoutBytecode;
 
     ParallelDo(JSContext *cx, HandleObject fun, ForkJoinMode mode);
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -1053,17 +1053,17 @@ class FrameRegs
 
 /*****************************************************************************/
 
 class InterpreterStack
 {
     friend class FrameGuard;
     friend class InterpreterActivation;
 
-    const static size_t DEFAULT_CHUNK_SIZE = 4 * 1024;
+    static const size_t DEFAULT_CHUNK_SIZE = 4 * 1024;
     LifoAlloc allocator_;
 
     // Number of interpreter frames on the stack, for over-recursion checks.
     static const size_t MAX_FRAMES = 50 * 1000;
     static const size_t MAX_FRAMES_TRUSTED = MAX_FRAMES + 1000;
     size_t frameCount_;
 
     inline uint8_t *allocateFrame(JSContext *cx, size_t size);