Changeset 77081 in webkit


Ignore:
Timestamp:
Jan 29, 2011 10:11:07 PM (13 years ago)
Author:
ggaren@apple.com
Message:

2011-01-29 Geoffrey Garen <ggaren@apple.com>

Reviewed by Cameron Zwarich.

Simplified heap destruction
https://bugs.webkit.org/show_bug.cgi?id=53392

  • JavaScriptCore.exp:
  • runtime/Heap.cpp: (JSC::Heap::destroy):
  • runtime/Heap.h:
  • runtime/MarkedSpace.cpp: (JSC::MarkedSpace::destroy):
  • runtime/MarkedSpace.h: Don't go out of our way to destroy GC-protected cells last -- the difficult contortions required to do so just don't seem justified. We make no guarantees about GC protection after the client throws away JSGlobalData, and it doesn't seem like any meaningful guarantee is even possible.
Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r77080 r77081  
     12011-01-29  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Simplified heap destruction
     6        https://bugs.webkit.org/show_bug.cgi?id=53392
     7
     8        * JavaScriptCore.exp:
     9        * runtime/Heap.cpp:
     10        (JSC::Heap::destroy):
     11        * runtime/Heap.h:
     12        * runtime/MarkedSpace.cpp:
     13        (JSC::MarkedSpace::destroy):
     14        * runtime/MarkedSpace.h: Don't go out of our way to destroy GC-protected
     15        cells last -- the difficult contortions required to do so just don't seem
     16        justified. We make no guarantees about GC protection after the client
     17        throws away JSGlobalData, and it doesn't seem like any meaningful
     18        guarantee is even possible.
     19
    1202011-01-29  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r77077 r77081  
    197197__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
    198198__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
    199 __ZN3JSC22globalMemoryStatisticsEv
    200199__ZN3JSC23AbstractSamplingCounter4dumpEv
    201200__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
     
    520519__ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv
    521520__ZNK3JSC4Heap11objectCountEv
    522 __ZNK3JSC4Heap4sizeEv
    523521__ZNK3JSC4Heap8capacityEv
    524522__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
  • trunk/Source/JavaScriptCore/runtime/Heap.cpp

    r77077 r77081  
    7373    m_markListSet = 0;
    7474
    75     ProtectCountSet protectedValuesCopy = m_protectedValues;
    76     m_markedSpace.destroy(protectedValuesCopy);
    77     ASSERT(!protectedObjectCount());
     75    m_markedSpace.destroy();
    7876
    7977    m_globalData = 0;
  • trunk/Source/JavaScriptCore/runtime/Heap.h

    r77077 r77081  
    4545
    4646    typedef std::pair<JSValue, UString> ValueStringPair;
     47    typedef HashCountedSet<JSCell*> ProtectCountSet;
    4748
    4849    enum OperationInProgress { NoOperation, Allocation, Collection };
  • trunk/Source/JavaScriptCore/runtime/MarkedSpace.cpp

    r77080 r77081  
    4949}
    5050
    51 void MarkedSpace::destroy(ProtectCountSet& protectedValuesCopy)
    52 {
    53     clearMarkBits();
    54     ProtectCountSet::iterator protectedValuesEnd = protectedValuesCopy.end();
    55     for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
    56         markCell(it->first);
    57 
    58     m_heap.nextCell = 0;
    59     m_heap.nextBlock = 0;
    60     DeadObjectIterator it(m_heap, m_heap.nextBlock, m_heap.nextCell);
    61     DeadObjectIterator end(m_heap, m_heap.usedBlocks);
    62     for ( ; it != end; ++it)
    63         (*it)->~JSCell();
    64 
    65     protectedValuesEnd = protectedValuesCopy.end();
    66     for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
    67         it->first->~JSCell();
    68 
     51void MarkedSpace::destroy()
     52{
    6953    for (size_t block = 0; block < m_heap.usedBlocks; ++block)
    70         m_heap.blocks[block].deallocate();
    71 
     54        freeBlock(block);
    7255    fastFree(m_heap.blocks);
    7356
  • trunk/Source/JavaScriptCore/runtime/MarkedSpace.h

    r77080 r77081  
    4747#endif
    4848
    49     typedef HashCountedSet<JSCell*> ProtectCountSet;
    50 
    5149    struct CollectorHeap {
    5250        size_t nextBlock;
     
    7371
    7472        MarkedSpace(JSGlobalData*);
    75         void destroy(ProtectCountSet&);
     73        void destroy();
    7674
    7775        JSGlobalData* globalData() { return m_globalData; }
Note: See TracChangeset for help on using the changeset viewer.