Changeset 155632 in webkit


Ignore:
Timestamp:
Sep 12, 2013 11:13:25 AM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

MarkedBlocks shouldn't be put in Allocated state if they didn't produce a FreeList
https://bugs.webkit.org/show_bug.cgi?id=121236

Reviewed by Geoffrey Garen.

Right now, after a collection all MarkedBlocks are in the Marked block state. When lazy sweeping
happens, if a block returns an empty free list after being swept, we call didConsumeFreeList(),
which moves the block into the Allocated block state. This happens to both the block that was
just being allocated out of (i.e. m_currentBlock) as well as any blocks who are completely full.
We should distinguish between these two cases: m_currentBlock should transition to
Allocated (because we were just allocating out of it) and any subsequent block that returns an
empty free list should transition back to the Marked state. This will make the block state more
consistent with the actual state the block is in, and it will also allow us to speed up moving
all blocks to the Marked state during generational collection.

  • heap/MarkedAllocator.cpp:

(JSC::MarkedAllocator::tryAllocateHelper):

  • heap/MarkedBlock.h:

(JSC::MarkedBlock::didConsumeEmptyFreeList):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r155622 r155632  
     12013-09-12  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        MarkedBlocks shouldn't be put in Allocated state if they didn't produce a FreeList
     4        https://bugs.webkit.org/show_bug.cgi?id=121236
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Right now, after a collection all MarkedBlocks are in the Marked block state. When lazy sweeping
     9        happens, if a block returns an empty free list after being swept, we call didConsumeFreeList(),
     10        which moves the block into the Allocated block state. This happens to both the block that was
     11        just being allocated out of (i.e. m_currentBlock) as well as any blocks who are completely full.
     12        We should distinguish between these two cases: m_currentBlock should transition to
     13        Allocated (because we were just allocating out of it) and any subsequent block that returns an
     14        empty free list should transition back to the Marked state. This will make the block state more
     15        consistent with the actual state the block is in, and it will also allow us to speed up moving
     16        all blocks to the Marked state during generational collection.
     17
     18        * heap/MarkedAllocator.cpp:
     19        (JSC::MarkedAllocator::tryAllocateHelper):
     20        * heap/MarkedBlock.h:
     21        (JSC::MarkedBlock::didConsumeEmptyFreeList):
     22
    1232013-09-12  Mark Lam  <mark.lam@apple.com>
    224
  • trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp

    r153357 r155632  
    3131{
    3232    if (!m_freeList.head) {
     33        if (m_currentBlock) {
     34            ASSERT(m_currentBlock == m_blocksToSweep);
     35            m_currentBlock->didConsumeFreeList();
     36            m_blocksToSweep = m_currentBlock->next();
     37        }
     38
    3339        for (MarkedBlock*& block = m_blocksToSweep; block; block = block->next()) {
    3440            MarkedBlock::FreeList freeList = block->sweep(MarkedBlock::SweepToFreeList);
    3541            if (!freeList.head) {
    36                 block->didConsumeFreeList();
     42                block->didConsumeEmptyFreeList();
    3743                continue;
    3844            }
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.h

    r155316 r155632  
    134134        void didConsumeFreeList(); // Call this once you've allocated all the items in the free list.
    135135        void canonicalizeCellLivenessData(const FreeList&);
     136        void didConsumeEmptyFreeList(); // Call this if you sweep a block, but the returned FreeList is empty.
    136137
    137138        // Returns true if the "newly allocated" bitmap was non-null
     
    278279    }
    279280
     281    inline void MarkedBlock::didConsumeEmptyFreeList()
     282    {
     283        HEAP_LOG_BLOCK_STATE_TRANSITION(this);
     284
     285        ASSERT(m_state == FreeListed);
     286        m_state = Marked;
     287    }
     288
    280289    inline void MarkedBlock::clearMarks()
    281290    {
Note: See TracChangeset for help on using the changeset viewer.