Commit 13bb8583 authored by ggaren@apple.com's avatar ggaren@apple.com

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c3a8b438
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.
2011-01-29 Geoffrey Garen <ggaren@apple.com> 2011-01-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak. Reviewed by Maciej Stachowiak.
......
...@@ -196,7 +196,6 @@ __ZN3JSC19SourceProviderCacheD1Ev ...@@ -196,7 +196,6 @@ __ZN3JSC19SourceProviderCacheD1Ev
__ZN3JSC19initializeThreadingEv __ZN3JSC19initializeThreadingEv
__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC22globalMemoryStatisticsEv
__ZN3JSC23AbstractSamplingCounter4dumpEv __ZN3JSC23AbstractSamplingCounter4dumpEv
__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
...@@ -519,7 +518,6 @@ __ZNK3JSC18PropertyDescriptor8writableEv ...@@ -519,7 +518,6 @@ __ZNK3JSC18PropertyDescriptor8writableEv
__ZNK3JSC19SourceProviderCache8byteSizeEv __ZNK3JSC19SourceProviderCache8byteSizeEv
__ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv __ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv
__ZNK3JSC4Heap11objectCountEv __ZNK3JSC4Heap11objectCountEv
__ZNK3JSC4Heap4sizeEv
__ZNK3JSC4Heap8capacityEv __ZNK3JSC4Heap8capacityEv
__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE __ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE __ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
......
...@@ -72,9 +72,7 @@ void Heap::destroy() ...@@ -72,9 +72,7 @@ void Heap::destroy()
delete m_markListSet; delete m_markListSet;
m_markListSet = 0; m_markListSet = 0;
ProtectCountSet protectedValuesCopy = m_protectedValues; m_markedSpace.destroy();
m_markedSpace.destroy(protectedValuesCopy);
ASSERT(!protectedObjectCount());
m_globalData = 0; m_globalData = 0;
} }
......
...@@ -44,6 +44,7 @@ namespace JSC { ...@@ -44,6 +44,7 @@ namespace JSC {
class WeakGCHandlePool; class WeakGCHandlePool;
typedef std::pair<JSValue, UString> ValueStringPair; typedef std::pair<JSValue, UString> ValueStringPair;
typedef HashCountedSet<JSCell*> ProtectCountSet;
enum OperationInProgress { NoOperation, Allocation, Collection }; enum OperationInProgress { NoOperation, Allocation, Collection };
......
...@@ -48,27 +48,10 @@ MarkedSpace::MarkedSpace(JSGlobalData* globalData) ...@@ -48,27 +48,10 @@ MarkedSpace::MarkedSpace(JSGlobalData* globalData)
allocateBlock(); allocateBlock();
} }
void MarkedSpace::destroy(ProtectCountSet& protectedValuesCopy) void MarkedSpace::destroy()
{ {
clearMarkBits();
ProtectCountSet::iterator protectedValuesEnd = protectedValuesCopy.end();
for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
markCell(it->first);
m_heap.nextCell = 0;
m_heap.nextBlock = 0;
DeadObjectIterator it(m_heap, m_heap.nextBlock, m_heap.nextCell);
DeadObjectIterator end(m_heap, m_heap.usedBlocks);
for ( ; it != end; ++it)
(*it)->~JSCell();
protectedValuesEnd = protectedValuesCopy.end();
for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
it->first->~JSCell();
for (size_t block = 0; block < m_heap.usedBlocks; ++block) for (size_t block = 0; block < m_heap.usedBlocks; ++block)
m_heap.blocks[block].deallocate(); freeBlock(block);
fastFree(m_heap.blocks); fastFree(m_heap.blocks);
memset(&m_heap, 0, sizeof(CollectorHeap)); memset(&m_heap, 0, sizeof(CollectorHeap));
......
...@@ -46,8 +46,6 @@ namespace JSC { ...@@ -46,8 +46,6 @@ namespace JSC {
const size_t BLOCK_SIZE = 256 * 1024; // 256k const size_t BLOCK_SIZE = 256 * 1024; // 256k
#endif #endif
typedef HashCountedSet<JSCell*> ProtectCountSet;
struct CollectorHeap { struct CollectorHeap {
size_t nextBlock; size_t nextBlock;
size_t nextCell; size_t nextCell;
...@@ -72,7 +70,7 @@ namespace JSC { ...@@ -72,7 +70,7 @@ namespace JSC {
static void markCell(JSCell*); static void markCell(JSCell*);
MarkedSpace(JSGlobalData*); MarkedSpace(JSGlobalData*);
void destroy(ProtectCountSet&); void destroy();
JSGlobalData* globalData() { return m_globalData; } JSGlobalData* globalData() { return m_globalData; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment