Changeset 167772 in webkit


Ignore:
Timestamp:
Apr 24, 2014 2:12:56 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Make slowPathAllocsBetweenGCs a runtime option.
<https://webkit.org/b/132137>

Reviewed by Mark Hahnenberg.

This will make it easier to more casually run tests with this configuration
as well as to reproduce issues (instead of requiring a code mod and rebuild).
We will now take --slowPathAllocsBetweenGCs=N where N is the number of
slow path allocations before we trigger a collection.

The option defaults to 0, which is reserved to mean that we will not trigger
any collections there.

  • heap/Heap.h:
  • heap/MarkedAllocator.cpp:

(JSC::MarkedAllocator::doTestCollectionsIfNeeded):
(JSC::MarkedAllocator::allocateSlowCase):

  • heap/MarkedAllocator.h:
  • runtime/Options.h:
Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r167733 r167772  
     12014-04-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Make slowPathAllocsBetweenGCs a runtime option.
     4        <https://webkit.org/b/132137>
     5
     6        Reviewed by Mark Hahnenberg.
     7
     8        This will make it easier to more casually run tests with this configuration
     9        as well as to reproduce issues (instead of requiring a code mod and rebuild).
     10        We will now take --slowPathAllocsBetweenGCs=N where N is the number of
     11        slow path allocations before we trigger a collection.
     12
     13        The option defaults to 0, which is reserved to mean that we will not trigger
     14        any collections there.
     15
     16        * heap/Heap.h:
     17        * heap/MarkedAllocator.cpp:
     18        (JSC::MarkedAllocator::doTestCollectionsIfNeeded):
     19        (JSC::MarkedAllocator::allocateSlowCase):
     20        * heap/MarkedAllocator.h:
     21        * runtime/Options.h:
     22
    1232014-04-23  Mark Lam  <mark.lam@apple.com>
    224
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r167733 r167772  
    4545#include <wtf/HashCountedSet.h>
    4646#include <wtf/HashSet.h>
    47 
    48 #define COLLECT_ON_EVERY_ALLOCATION 0
    4947
    5048namespace JSC {
  • trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp

    r165486 r167772  
    144144    return result;
    145145}
    146    
     146
     147ALWAYS_INLINE void MarkedAllocator::doTestCollectionsIfNeeded()
     148{
     149    if (!Options::slowPathAllocsBetweenGCs())
     150        return;
     151
     152    static unsigned allocationCount = 0;
     153    if (!allocationCount) {
     154        if (!m_heap->isDeferred())
     155            m_heap->collectAllGarbage();
     156        ASSERT(m_heap->m_operationInProgress == NoOperation);
     157    }
     158    if (++allocationCount >= Options::slowPathAllocsBetweenGCs())
     159        allocationCount = 0;
     160}
     161
    147162void* MarkedAllocator::allocateSlowCase(size_t bytes)
    148163{
    149164    ASSERT(m_heap->vm()->currentThreadIsHoldingAPILock());
    150 #if COLLECT_ON_EVERY_ALLOCATION
    151     if (!m_heap->isDeferred())
    152         m_heap->collectAllGarbage();
    153     ASSERT(m_heap->m_operationInProgress == NoOperation);
    154 #endif
    155    
     165    doTestCollectionsIfNeeded();
     166
    156167    ASSERT(!m_markedSpace->isIterating());
    157168    ASSERT(!m_freeList.head);
  • trunk/Source/JavaScriptCore/heap/MarkedAllocator.h

    r165486 r167772  
    5151    void* tryPopFreeList(size_t);
    5252    MarkedBlock* allocateBlock(size_t);
     53    ALWAYS_INLINE void doTestCollectionsIfNeeded();
    5354   
    5455    MarkedBlock::FreeList m_freeList;
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r167515 r167772  
    251251    v(double, minCopiedBlockUtilization, 0.9) \
    252252    v(double, minMarkedBlockUtilization, 0.9) \
     253    v(unsigned, slowPathAllocsBetweenGCs, 0) \
    253254    \
    254255    v(double, percentCPUPerMBForFullTimer, 0.0003125) \
Note: See TracChangeset for help on using the changeset viewer.