Changeset 204387 in webkit


Ignore:
Timestamp:
Aug 11, 2016, 2:18:14 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

Disallow synchronous sweeping for eden GCs.
https://bugs.webkit.org/show_bug.cgi?id=160716

Reviewed by Geoffrey Garen.

JSTests:

  • stress/eden-gc-with-retired-blocks.js: Added.
  • This test is just in case we add back support for eden GCs with synchronous sweeping in the future.

Source/JavaScriptCore:

  • heap/Heap.cpp:

(JSC::Heap::collectAllGarbage):
(JSC::Heap::collectAndSweep): Deleted.

  • heap/Heap.h:

(JSC::Heap::collectAllGarbage): Deleted.

  • No need for a separate collectAndSweep() anymore since we only call it for FullCollections.
  • Since we've already swept all the blocks, I cleared m_blockSnapshot so that the IncrementalSweeper can bail earlier when it runs later.
  • heap/MarkedBlock.cpp:

(JSC::MarkedBlock::sweepHelper):

  • Removed the unreachable return statement.
  • heap/MarkedBlock.h:
  • Document what "Retired" means.
  • tools/JSDollarVMPrototype.cpp:

(JSC::JSDollarVMPrototype::edenGC):

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r204362 r204387  
     12016-08-10  Mark Lam  <mark.lam@apple.com>
     2
     3        Disallow synchronous sweeping for eden GCs.
     4        https://bugs.webkit.org/show_bug.cgi?id=160716
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * stress/eden-gc-with-retired-blocks.js: Added.
     9        - This test is just in case we add back support for eden GCs with synchronous
     10          sweeping in the future.
     11
    1122016-08-10  Michael Saboff  <msaboff@apple.com>
    213
  • trunk/Source/JavaScriptCore/ChangeLog

    r204373 r204387  
     12016-08-10  Mark Lam  <mark.lam@apple.com>
     2
     3        Disallow synchronous sweeping for eden GCs.
     4        https://bugs.webkit.org/show_bug.cgi?id=160716
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * heap/Heap.cpp:
     9        (JSC::Heap::collectAllGarbage):
     10        (JSC::Heap::collectAndSweep): Deleted.
     11        * heap/Heap.h:
     12        (JSC::Heap::collectAllGarbage): Deleted.
     13        - No need for a separate collectAndSweep() anymore since we only call it for
     14          FullCollections.
     15        - Since we've already swept all the blocks, I cleared m_blockSnapshot so that the
     16          IncrementalSweeper can bail earlier when it runs later.
     17
     18        * heap/MarkedBlock.cpp:
     19        (JSC::MarkedBlock::sweepHelper):
     20        - Removed the unreachable return statement.
     21
     22        * heap/MarkedBlock.h:
     23        - Document what "Retired" means.
     24
     25        * tools/JSDollarVMPrototype.cpp:
     26        (JSC::JSDollarVMPrototype::edenGC):
     27
    1282016-08-11  Per Arne Vollan  <pvollan@apple.com>
    229
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r203375 r204387  
    10721072}
    10731073
    1074 void Heap::collectAndSweep(HeapOperation collectionType)
     1074void Heap::collectAllGarbage()
    10751075{
    10761076    if (!m_isSafeToCollect)
    10771077        return;
    10781078
    1079     collect(collectionType);
     1079    collect(FullCollection);
    10801080
    10811081    DeferGCForAWhile deferGC(*this);
    10821082    m_objectSpace.sweep();
    10831083    m_objectSpace.shrink();
     1084    m_blockSnapshot.clear();
    10841085
    10851086    sweepAllLogicallyEmptyWeakBlocks();
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r203621 r204387  
    166166
    167167    JS_EXPORT_PRIVATE void collectAllGarbageIfNotDoneRecently();
    168     void collectAllGarbage() { collectAndSweep(FullCollection); }
    169     JS_EXPORT_PRIVATE void collectAndSweep(HeapOperation collectionType = AnyCollection);
     168    JS_EXPORT_PRIVATE void collectAllGarbage();
     169
    170170    bool shouldCollect();
    171171    JS_EXPORT_PRIVATE void collect(HeapOperation collectionType = AnyCollection);
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp

    r203621 r204387  
    164164            : specializedSweep<Marked, SweepOnly, callDestructors>();
    165165    }
    166 
    167     RELEASE_ASSERT_NOT_REACHED();
    168     return FreeList();
    169166}
    170167
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.h

    r203621 r204387  
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2009, 2011, 2016 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    184184        static const size_t atomAlignmentMask = atomSize - 1;
    185185
     186        // During allocation, we look for available space in free lists in blocks.
     187        // If a block's utilization is sufficiently high (i.e. it's almost full),
     188        // we want to remove that block as a candidate for allocating to reduce
     189        // the likelihood of allocation having to take a slow path. When the
     190        // block is in this state, we say that it is "Retired".
     191        //
     192        // A full GC can take a Retired blocks out of retirement. An eden GC
     193        // will simply ignore Retired blocks (i.e. they will not be swept even
     194        // if they no longer have live objects).
     195
    186196        enum BlockState { New, FreeListed, Allocated, Marked, Retired };
    187197        template<bool callDestructors> FreeList sweepHelper(SweepMode = SweepOnly);
  • trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp

    r203375 r204387  
    130130    if (!ensureCurrentThreadOwnsJSLock(exec))
    131131        return;
    132     exec->heap()->collectAndSweep(EdenCollection);
     132    exec->heap()->collect(EdenCollection);
    133133}
    134134
Note: See TracChangeset for help on using the changeset viewer.