Some Heap cleanup.
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 04:19:36 +0000 (04:19 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 04:19:36 +0000 (04:19 +0000)
Reviewed by Beth Dakin.

* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::blessNewBlock): Removed blessNewBlockForSlowPath()
because it was unused; renamed blessNewBlockForFastPath() to blessNewBlock()
since there is only one now.

* heap/MarkedBlock.h: Removed ownerSet-related stuff since it was unused.
Updated mark bit overhead calculation. Deployed atomsPerBlock in one
place where we were recalculating it.

* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::addBlock): Updated for rename.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95596 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/MarkedBlock.cpp
Source/JavaScriptCore/heap/MarkedBlock.h
Source/JavaScriptCore/heap/MarkedSpace.cpp

index ffb7e61..4e60eb4 100644 (file)
@@ -1,3 +1,21 @@
+2011-09-20  Geoffrey Garen  <ggaren@apple.com>
+
+        Some Heap cleanup.
+
+        Reviewed by Beth Dakin.
+
+        * heap/MarkedBlock.cpp:
+        (JSC::MarkedBlock::blessNewBlock): Removed blessNewBlockForSlowPath()
+        because it was unused; renamed blessNewBlockForFastPath() to blessNewBlock()
+        since there is only one now.
+
+        * heap/MarkedBlock.h: Removed ownerSet-related stuff since it was unused.
+        Updated mark bit overhead calculation. Deployed atomsPerBlock in one
+        place where we were recalculating it.
+
+        * heap/MarkedSpace.cpp:
+        (JSC::MarkedSpace::addBlock): Updated for rename.
+
 2011-09-20  Filip Pizlo  <fpizlo@apple.com>
 
         DFG JIT always speculates integer on modulo
index 4e307fd..ad6fd0a 100644 (file)
@@ -187,7 +187,7 @@ MarkedBlock::FreeCell* MarkedBlock::lazySweep()
     }
 }
 
-MarkedBlock::FreeCell* MarkedBlock::blessNewBlockForFastPath()
+MarkedBlock::FreeCell* MarkedBlock::blessNewBlock()
 {
     // This returns a free list that is ordered in reverse through the block,
     // as in lazySweep() above.
@@ -210,17 +210,6 @@ MarkedBlock::FreeCell* MarkedBlock::blessNewBlockForFastPath()
     return result;
 }
 
-void MarkedBlock::blessNewBlockForSlowPath()
-{
-    HEAP_DEBUG_BLOCK(this);
-
-    m_marks.clearAll();
-    for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell)
-        reinterpret_cast<FreeCell*>(&atoms()[i])->setNoObject();
-    
-    setDestructorState(FreeCellsDontHaveObjects);
-}
-
 void MarkedBlock::canonicalizeBlock(FreeCell* firstFreeCell)
 {
     HEAP_DEBUG_BLOCK(this);
index 6a8550b..4483ee7 100644 (file)
@@ -65,9 +65,7 @@ namespace JSC {
         // object the heap will commonly allocate is four words.
         static const size_t atomSize = 4 * sizeof(void*);
         static const size_t blockSize = 16 * KB;
-
-        static const size_t atomsPerBlock = blockSize / atomSize; // ~1.5% overhead
-        static const size_t ownerSetsPerBlock = 8; // ~2% overhead.
+        static const size_t atomsPerBlock = blockSize / atomSize; // ~0.4% overhead for mark bits.
 
         struct FreeCell {
             FreeCell* next;
@@ -112,8 +110,7 @@ namespace JSC {
         // These should be called immediately after a block is created.
         // Blessing for fast path creates a linked list, while blessing for
         // slow path creates dummy cells.
-        FreeCell* blessNewBlockForFastPath();
-        void blessNewBlockForSlowPath();
+        FreeCell* blessNewBlock();
         
         void reset();
         
@@ -150,7 +147,6 @@ namespace JSC {
         Atom* atoms();
 
         size_t atomNumber(const void*);
-        size_t ownerSetNumber(const JSCell*);
         
         template<DestructorState destructorState>
         void callDestructor(JSCell*, void* jsFinalObjectVPtr);
@@ -176,7 +172,7 @@ namespace JSC {
         
         size_t m_endAtom; // This is a fuzzy end. Always test for < m_endAtom.
         size_t m_atomsPerCell;
-        WTF::Bitmap<blockSize / atomSize> m_marks;
+        WTF::Bitmap<atomsPerBlock> m_marks;
         bool m_inNewSpace;
         int8_t m_destructorState; // use getters/setters for this, particularly since we may want to compact this (effectively log(3)/log(2)-bit) field into other fields
         PageAllocationAligned m_allocation;
@@ -305,11 +301,6 @@ namespace JSC {
         }
     }
     
-    inline size_t MarkedBlock::ownerSetNumber(const JSCell* cell)
-    {
-        return (reinterpret_cast<Bits>(cell) - reinterpret_cast<Bits>(this)) * ownerSetsPerBlock / blockSize;
-    }
-
 } // namespace JSC
 
 namespace WTF {
index 176496d..2bfd1eb 100644 (file)
@@ -50,7 +50,7 @@ void MarkedSpace::addBlock(SizeClass& sizeClass, MarkedBlock* block)
     ASSERT(!sizeClass.currentBlock);
     ASSERT(!sizeClass.firstFreeCell);
     sizeClass.currentBlock = block;
-    sizeClass.firstFreeCell = block->blessNewBlockForFastPath();
+    sizeClass.firstFreeCell = block->blessNewBlock();
 }
 
 void MarkedSpace::removeBlock(MarkedBlock* block)