⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276155 in webkit


Ignore:
Timestamp:
Apr 16, 2021, 12:24:22 PM (5 years ago)
Author:
keith_miller@apple.com
Message:

Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
https://bugs.webkit.org/show_bug.cgi?id=224677

Reviewed by Yusuke Suzuki.

Right now when we are about to free a MarkedBlock we clear the
m_directory pointer in the MarkedBlock's Handle. This has the
downside, however, of potentially paging in the footer from disk /
the compressor, which some data we have seen shows is happening.
This patch prevents this uncessary store to hopefully reduce the
number of pageins/decompressions caused by Safari web content.

  • heap/BlockDirectory.cpp:

(JSC::BlockDirectory::removeBlock):
(JSC::BlockDirectory::removeBlockForDeletion):

  • heap/BlockDirectory.h:
  • heap/MarkedBlock.cpp:

(JSC::MarkedBlock::Handle::~Handle):

  • heap/MarkedSpace.cpp:

(JSC::MarkedSpace::freeBlock):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r276121 r276155  
     12021-04-16  Keith Miller  <keith_miller@apple.com>
     2
     3        Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
     4        https://bugs.webkit.org/show_bug.cgi?id=224677
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Right now when we are about to free a MarkedBlock we clear the
     9        m_directory pointer in the MarkedBlock's Handle. This has the
     10        downside, however, of potentially paging in the footer from disk /
     11        the compressor, which some data we have seen shows is happening.
     12        This patch prevents this uncessary store to hopefully reduce the
     13        number of pageins/decompressions caused by Safari web content.
     14
     15        * heap/BlockDirectory.cpp:
     16        (JSC::BlockDirectory::removeBlock):
     17        (JSC::BlockDirectory::removeBlockForDeletion):
     18        * heap/BlockDirectory.h:
     19        * heap/MarkedBlock.cpp:
     20        (JSC::MarkedBlock::Handle::~Handle):
     21        * heap/MarkedSpace.cpp:
     22        (JSC::MarkedSpace::freeBlock):
     23
    1242021-04-16  Mark Lam  <mark.lam@apple.com>
    225
  • trunk/Source/JavaScriptCore/heap/BlockDirectory.cpp

    r261755 r276155  
    141141}
    142142
    143 void BlockDirectory::removeBlock(MarkedBlock::Handle* block)
     143void BlockDirectory::removeBlock(MarkedBlock::Handle* block, WillDeleteBlock willDelete)
    144144{
    145145    ASSERT(block->directory() == this);
     
    156156            vectorRef[block->index()] = false;
    157157        });
    158    
    159     block->didRemoveFromDirectory();
     158
     159    if (willDelete == WillDeleteBlock::No)
     160        block->didRemoveFromDirectory();
    160161}
    161162
  • trunk/Source/JavaScriptCore/heap/BlockDirectory.h

    r254023 r276155  
    8484   
    8585    void addBlock(MarkedBlock::Handle*);
    86     void removeBlock(MarkedBlock::Handle*);
     86    enum class WillDeleteBlock { No, Yes };
     87    // If WillDeleteBlock::Yes is passed then the block will be left in an invalid state. We do this, however, to avoid potentially paging in / decompressing old blocks to update their handle just before freeing them.
     88    void removeBlock(MarkedBlock::Handle*, WillDeleteBlock = WillDeleteBlock::No);
    8789
    8890    bool isPagedOut(MonotonicTime deadline);
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp

    r261895 r276155  
    7777            dataLog("MarkedBlock Balance: ", balance, "\n");
    7878    }
    79     removeFromDirectory();
     79    m_directory->removeBlock(this, BlockDirectory::WillDeleteBlock::Yes);
    8080    m_block->~MarkedBlock();
    8181    m_alignedMemoryAllocator->freeAlignedMemory(m_block);
  • trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp

    r275588 r276155  
    376376void MarkedSpace::freeBlock(MarkedBlock::Handle* block)
    377377{
    378     block->directory()->removeBlock(block);
    379378    m_capacity -= MarkedBlock::blockSize;
    380379    m_blocks.remove(&block->block());
Note: See TracChangeset for help on using the changeset viewer.