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

Changeset 276175 in webkit


Ignore:
Timestamp:
Apr 16, 2021, 3:28:44 PM (5 years ago)
Author:
Ruben Turcios
Message:

Cherry-pick r276155. rdar://problem/76781047

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):

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

Location:
branches/safari-611-branch/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/Source/JavaScriptCore/ChangeLog

    r276096 r276175  
     12021-04-16  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r276155. rdar://problem/76781047
     4
     5    Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
     6    https://bugs.webkit.org/show_bug.cgi?id=224677
     7   
     8    Reviewed by Yusuke Suzuki.
     9   
     10    Right now when we are about to free a MarkedBlock we clear the
     11    m_directory pointer in the MarkedBlock's Handle. This has the
     12    downside, however, of potentially paging in the footer from disk /
     13    the compressor, which some data we have seen shows is happening.
     14    This patch prevents this uncessary store to hopefully reduce the
     15    number of pageins/decompressions caused by Safari web content.
     16   
     17    * heap/BlockDirectory.cpp:
     18    (JSC::BlockDirectory::removeBlock):
     19    (JSC::BlockDirectory::removeBlockForDeletion):
     20    * heap/BlockDirectory.h:
     21    * heap/MarkedBlock.cpp:
     22    (JSC::MarkedBlock::Handle::~Handle):
     23    * heap/MarkedSpace.cpp:
     24    (JSC::MarkedSpace::freeBlock):
     25   
     26   
     27    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     28
     29    2021-04-16  Keith Miller  <keith_miller@apple.com>
     30
     31            Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
     32            https://bugs.webkit.org/show_bug.cgi?id=224677
     33
     34            Reviewed by Yusuke Suzuki.
     35
     36            Right now when we are about to free a MarkedBlock we clear the
     37            m_directory pointer in the MarkedBlock's Handle. This has the
     38            downside, however, of potentially paging in the footer from disk /
     39            the compressor, which some data we have seen shows is happening.
     40            This patch prevents this uncessary store to hopefully reduce the
     41            number of pageins/decompressions caused by Safari web content.
     42
     43            * heap/BlockDirectory.cpp:
     44            (JSC::BlockDirectory::removeBlock):
     45            (JSC::BlockDirectory::removeBlockForDeletion):
     46            * heap/BlockDirectory.h:
     47            * heap/MarkedBlock.cpp:
     48            (JSC::MarkedBlock::Handle::~Handle):
     49            * heap/MarkedSpace.cpp:
     50            (JSC::MarkedSpace::freeBlock):
     51
    1522021-04-15  Russell Epstein  <repstein@apple.com>
    253
  • branches/safari-611-branch/Source/JavaScriptCore/heap/BlockDirectory.cpp

    r261755 r276175  
    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
  • branches/safari-611-branch/Source/JavaScriptCore/heap/BlockDirectory.h

    r254023 r276175  
    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);
  • branches/safari-611-branch/Source/JavaScriptCore/heap/MarkedBlock.cpp

    r261895 r276175  
    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);
  • branches/safari-611-branch/Source/JavaScriptCore/heap/MarkedSpace.cpp

    r262786 r276175  
    372372void MarkedSpace::freeBlock(MarkedBlock::Handle* block)
    373373{
    374     block->directory()->removeBlock(block);
    375374    m_capacity -= MarkedBlock::blockSize;
    376375    m_blocks.remove(&block->block());
Note: See TracChangeset for help on using the changeset viewer.