2011-01-29 Geoffrey Garen <ggaren@apple.com>
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Jan 2011 06:11:07 +0000 (06:11 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Jan 2011 06:11:07 +0000 (06:11 +0000)
        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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/runtime/Heap.cpp
Source/JavaScriptCore/runtime/Heap.h
Source/JavaScriptCore/runtime/MarkedSpace.cpp
Source/JavaScriptCore/runtime/MarkedSpace.h

index d52f914afac80b1584574eabb5dbc20ca7a05122..29a475ca8ccf42e5efa0fe6632bfe31f4d3b7b05 100644 (file)
@@ -1,3 +1,22 @@
+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>
 
         Reviewed by Maciej Stachowiak.
index 95474437e100bac9ea5803001b3ab7ddf8dd249a..5f2eea1ef149bf3345e1874ae9c00915540166f1 100644 (file)
@@ -196,7 +196,6 @@ __ZN3JSC19SourceProviderCacheD1Ev
 __ZN3JSC19initializeThreadingEv
 __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
 __ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
-__ZN3JSC22globalMemoryStatisticsEv
 __ZN3JSC23AbstractSamplingCounter4dumpEv
 __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
 __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
@@ -519,7 +518,6 @@ __ZNK3JSC18PropertyDescriptor8writableEv
 __ZNK3JSC19SourceProviderCache8byteSizeEv
 __ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv
 __ZNK3JSC4Heap11objectCountEv
-__ZNK3JSC4Heap4sizeEv
 __ZNK3JSC4Heap8capacityEv
 __ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
 __ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
index 7af0d3de08d4fdecbc4591a07460c5060d15ea52..bdde63d525782700dbc1b027cf080ca550d1d98d 100644 (file)
@@ -72,9 +72,7 @@ void Heap::destroy()
     delete m_markListSet;
     m_markListSet = 0;
 
-    ProtectCountSet protectedValuesCopy = m_protectedValues;
-    m_markedSpace.destroy(protectedValuesCopy);
-    ASSERT(!protectedObjectCount());
+    m_markedSpace.destroy();
 
     m_globalData = 0;
 }
index bf8c31741e9c1d49794105865dfad07ef20fba26..42b5030622304474400e52baee546fbecfcd2bef 100644 (file)
@@ -44,6 +44,7 @@ namespace JSC {
     class WeakGCHandlePool;
 
     typedef std::pair<JSValue, UString> ValueStringPair;
+    typedef HashCountedSet<JSCell*> ProtectCountSet;
 
     enum OperationInProgress { NoOperation, Allocation, Collection };
 
index f26e4f2d25ab1127d768ef23f1efca27940c1fe6..9cf8deaffa0731c9cc9819d2c723a62f86f96cce 100644 (file)
@@ -48,27 +48,10 @@ MarkedSpace::MarkedSpace(JSGlobalData* globalData)
     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)
-        m_heap.blocks[block].deallocate();
-
+        freeBlock(block);
     fastFree(m_heap.blocks);
 
     memset(&m_heap, 0, sizeof(CollectorHeap));
index a51e697b4921cf5ea059f3d3e50fb99e335d6ebf..5f1633b4cf2670c869edf1711e295d392f255f57 100644 (file)
@@ -46,8 +46,6 @@ namespace JSC {
     const size_t BLOCK_SIZE = 256 * 1024; // 256k
 #endif
 
-    typedef HashCountedSet<JSCell*> ProtectCountSet;
-
     struct CollectorHeap {
         size_t nextBlock;
         size_t nextCell;
@@ -72,7 +70,7 @@ namespace JSC {
         static void markCell(JSCell*);
 
         MarkedSpace(JSGlobalData*);
-        void destroy(ProtectCountSet&);
+        void destroy();
 
         JSGlobalData* globalData() { return m_globalData; }