no bug - Minor clean-up. r=jonco,nbp
authorGuillaume Turri <guillaume.turri@gmail.com>
Thu, 03 Jul 2014 04:34:22 -0700
changeset 192186 94f150f5b21fb3e1a4266a0f333751f0c932ab9b
parent 192185 a133199d09e2c9cc834ebbc51c92c07ff399bcbe
child 192187 1022c98a62d29d3ce9ee3dc1cb0276b79ad09bf3
push idunknown
push userunknown
push dateunknown
reviewersjonco, nbp
milestone33.0a1
no bug - Minor clean-up. r=jonco,nbp * removed a code duplication * improved consistence (between Cell::chunk & eg Cell::arenaHeader) * removed obsolete comment
js/src/gc/Heap.h
js/src/jsgc.cpp
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -177,18 +177,17 @@ class FreeSpan
 
     // This sets |first| and |last|, and also sets the next span stored at
     // |last| as empty. (As a result, |firstArg| and |lastArg| cannot represent
     // an empty span.)
     void initFinal(uintptr_t firstArg, uintptr_t lastArg, size_t thingSize) {
         first = firstArg;
         last = lastArg;
         FreeSpan *lastSpan = reinterpret_cast<FreeSpan*>(last);
-        lastSpan->first = 0;
-        lastSpan->last = 0;
+        lastSpan->initAsEmpty();
         JS_ASSERT(!isEmpty());
         checkSpan(thingSize);
     }
 
     bool isEmpty() const {
         checkSpan();
         return !first;
     }
@@ -1105,17 +1104,17 @@ Cell::address() const
     return addr;
 }
 
 Chunk *
 Cell::chunk() const
 {
     uintptr_t addr = uintptr_t(this);
     JS_ASSERT(addr % CellSize == 0);
-    addr &= ~(ChunkSize - 1);
+    addr &= ~ChunkMask;
     return reinterpret_cast<Chunk *>(addr);
 }
 
 inline StoreBuffer *
 Cell::storeBuffer() const
 {
     return chunk()->info.trailer.storeBuffer;
 }
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -222,18 +222,16 @@
 #include "jsscriptinlines.h"
 
 #include "vm/Stack-inl.h"
 #include "vm/String-inl.h"
 
 using namespace js;
 using namespace js::gc;
 
-using mozilla::ArrayEnd;
-using mozilla::DebugOnly;
 using mozilla::Maybe;
 using mozilla::Swap;
 
 using JS::AutoGCRooter;
 
 /* Perform a Full GC every 20 seconds if MaybeGC is called */
 static const uint64_t GC_IDLE_FULL_SPAN = 20 * 1000 * 1000;
 
@@ -241,17 +239,16 @@ static const uint64_t GC_IDLE_FULL_SPAN 
 static const int IGC_MARK_SLICE_MULTIPLIER = 2;
 
 #if defined(ANDROID) || defined(MOZ_B2G)
 static const int MAX_EMPTY_CHUNK_COUNT = 2;
 #else
 static const int MAX_EMPTY_CHUNK_COUNT = 30;
 #endif
 
-/* This array should be const, but that doesn't link right under GCC. */
 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
 };
 
@@ -425,17 +422,17 @@ ArenaHeader::checkSynchronizedWithFreeLi
     if (firstSpan.isEmpty())
         return;
     const FreeList *freeList = zone->allocator.arenas.getFreeList(getAllocKind());
     if (freeList->isEmpty() || firstSpan.arenaAddress() != freeList->arenaAddress())
         return;
 
     /*
      * Here this arena has free things, FreeList::lists[thingKind] is not
-     * empty and also points to this arena. Thus they must the same.
+     * empty and also points to this arena. Thus they must be the same.
      */
     JS_ASSERT(freeList->isSameNonEmptySpan(firstSpan));
 }
 #endif
 
 /* static */ void
 Arena::staticAsserts()
 {