2011-06-08 Geoffrey Garen <ggaren@apple.com>
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2011 20:16:23 +0000 (20:16 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2011 20:16:23 +0000 (20:16 +0000)
        Reviewed by Oliver Hunt.

        Some more MarkedSpace => NewSpace renaming
        https://bugs.webkit.org/show_bug.cgi?id=62305

        * JavaScriptCore.exp:
        * JavaScriptCore.order:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
        * heap/Heap.cpp:
        (JSC::Heap::Heap):
        (JSC::Heap::destroy):
        (JSC::Heap::reportExtraMemoryCostSlowCase):
        (JSC::Heap::allocate):
        (JSC::Heap::markRoots):
        (JSC::Heap::objectCount):
        (JSC::Heap::size):
        (JSC::Heap::capacity):
        (JSC::Heap::collect):
        (JSC::Heap::isValidAllocation):
        * heap/Heap.h:
        (JSC::Heap::markedSpace):
        (JSC::Heap::contains):
        (JSC::Heap::forEach):
        (JSC::Heap::allocate):
        * runtime/JSCell.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88379 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.order
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/heap/Heap.h
Source/JavaScriptCore/heap/NewSpace.cpp
Source/JavaScriptCore/heap/NewSpace.h
Source/JavaScriptCore/runtime/JSCell.h

index 9594c85..4bda7b3 100755 (executable)
@@ -1,3 +1,31 @@
+2011-06-08  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Some more MarkedSpace => NewSpace renaming
+        https://bugs.webkit.org/show_bug.cgi?id=62305
+
+        * JavaScriptCore.exp:
+        * JavaScriptCore.order:
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+        * heap/Heap.cpp:
+        (JSC::Heap::Heap):
+        (JSC::Heap::destroy):
+        (JSC::Heap::reportExtraMemoryCostSlowCase):
+        (JSC::Heap::allocate):
+        (JSC::Heap::markRoots):
+        (JSC::Heap::objectCount):
+        (JSC::Heap::size):
+        (JSC::Heap::capacity):
+        (JSC::Heap::collect):
+        (JSC::Heap::isValidAllocation):
+        * heap/Heap.h:
+        (JSC::Heap::markedSpace):
+        (JSC::Heap::contains):
+        (JSC::Heap::forEach):
+        (JSC::Heap::allocate):
+        * runtime/JSCell.h:
+
 2011-06-08  Kevin Ollivier  <kevino@theolliviers.com>
 
         Reviewed by Eric Seidel.
index 2c94c1b..284a14b 100644 (file)
@@ -233,7 +233,7 @@ __ZN3JSC4Heap26protectedGlobalObjectCountEv
 __ZN3JSC4Heap29reportExtraMemoryCostSlowCaseEm
 __ZN3JSC4Heap7destroyEv
 __ZN3JSC4Heap7protectENS_7JSValueE
-__ZN3JSC4Heap8allocateERNS_11MarkedSpace9SizeClassE
+__ZN3JSC4Heap8allocateERNS_8NewSpace9SizeClassE
 __ZN3JSC4Heap9unprotectENS_7JSValueE
 __ZN3JSC4Yarr11YarrPatternC1ERKNS_7UStringEbbPPKc
 __ZN3JSC4Yarr11byteCompileERNS0_11YarrPatternEPN3WTF20BumpPointerAllocatorE
index 275f35c..fd55798 100644 (file)
@@ -160,7 +160,6 @@ __ZN3JSC11ParserArenaC2Ev
 __ZN3JSC14TimeoutCheckerC1Ev
 __ZN3JSC4HeapC1EPNS_12JSGlobalDataE
 __ZN3JSC4HeapC2EPNS_12JSGlobalDataE
-__ZN3JSC11MarkedSpaceC1EPNS_12JSGlobalDataE
 __ZN3JSC25DefaultGCActivityCallbackC1EPNS_4HeapE
 __ZN3JSC25DefaultGCActivityCallback17commonConstructorEPNS_4HeapEP11__CFRunLoop
 __ZN3JSC14MachineThreadsC1EPNS_4HeapE
@@ -177,8 +176,6 @@ __ZN3JSC11RegExpCacheC1EPNS_12JSGlobalDataE
 __ZN3JSC11InterpreterC1ERNS_12JSGlobalDataE
 __ZN3JSC10HandleHeap12writeBarrierEPNS_7JSValueERKS1_
 __ZN3JSC12RegisterFile23addToCommittedByteCountEl
-__ZN3JSC11MarkedSpace21allocateFromSizeClassERNS0_9SizeClassE
-__ZN3JSC11MarkedSpace13allocateBlockERNS0_9SizeClassE
 __ZN3JSC11MarkedBlock6createEPNS_12JSGlobalDataEm
 __ZN3WTF21PageAllocationAligned8allocateEmmNS_11OSAllocator5UsageEbb
 __ZN3WTF9HashTableIPN3JSC11MarkedBlockES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
@@ -395,7 +392,6 @@ __ZN3JSC14MachineThreads23gatherConservativeRootsERNS_17ConservativeRootsEPv
 __ZN3JSC14MachineThreads23gatherFromCurrentThreadERNS_17ConservativeRootsEPv
 __ZN3JSC17ConservativeRoots3addEPvS1_
 __ZN3JSC12RegisterFile23gatherConservativeRootsERNS_17ConservativeRootsE
-__ZN3JSC11MarkedSpace10clearMarksEv
 __ZN3JSC9MarkStack6appendERNS_17ConservativeRootsE
 __ZN3JSC9MarkStack5drainEv
 __ZN3JSC4Heap20markProtectedObjectsERNS_15HeapRootVisitorE
@@ -408,8 +404,6 @@ __ZN3JSC12SmallStrings13visitChildrenERNS_15HeapRootVisitorE
 __ZN3JSC10HandleHeap15markWeakHandlesERNS_15HeapRootVisitorE
 __ZN3JSC9MarkStack5resetEv
 __ZN3JSC10HandleHeap19finalizeWeakHandlesEv
-__ZN3JSC11MarkedSpace5resetEv
-__ZN3JSC11MarkedSpace5sweepEv
 __ZN3JSC11MarkedBlock5sweepEv
 __ZN3JSC9StructureD1Ev
 __ZN3JSC8JSStringD1Ev
@@ -447,11 +441,8 @@ __ZN3JSC14JSGlobalObjectD1Ev
 __ZN3JSC14JSGlobalObjectD2Ev
 __ZN3WTF9HashTableINS_6RefPtrI21OpaqueJSWeakObjectMapEES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E15deallocateTableEPS3_i
 __ZN3WTF9HashTableINS_6RefPtrI21OpaqueJSWeakObjectMapEES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
-__ZN3JSC11MarkedSpace6shrinkEv
-__ZN3JSC11MarkedSpace10freeBlocksERN3WTF16DoublyLinkedListINS_11MarkedBlockEEE
 __ZN3JSC11MarkedBlock7destroyEPS0_
 __ZN3WTF21PageAllocationAligned10deallocateEv
-__ZNK3JSC11MarkedSpace4sizeEv
 __Z22TCMalloc_SystemReleasePvm
 __Z21TCMalloc_SystemCommitPvm
 __ZN3WTFL10timerFiredEP16__CFRunLoopTimerPv
@@ -1471,7 +1462,6 @@ __ZN3JSC12JSGlobalData18createContextGroupENS_15ThreadStackTypeE
 __ZN3JSC12JSGlobalData22clearBuiltinStructuresEv
 __ZN3JSC4Heap7destroyEv
 __ZN3JSC9JITThunks22clearHostFunctionStubsEv
-__ZN3JSC11MarkedSpace7destroyEv
 __ZN3JSC12JSGlobalDataD1Ev
 __ZN3JSC12JSGlobalDataD2Ev
 __ZN3JSC12RegisterFileD1Ev
index 45c3b69..95e48bf 100644 (file)
@@ -56,7 +56,7 @@ EXPORTS
     ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@IPAVJSCell@2@@Z
     ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z
     ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z
-    ?allocate@Heap@JSC@@QAEPAXAAUSizeClass@MarkedSpace@2@@Z
+    ?allocate@Heap@JSC@@QAEPAXAAUSizeClass@NewSpace@2@@Z
     ?allocate@Heap@JSC@@QAEPAXI@Z
     ?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z
     ?append@StringBuilder@WTF@@QAEXPBDI@Z
index a9aa29b..01ac59a 100644 (file)
@@ -65,7 +65,7 @@ static inline bool isValidThreadState(JSGlobalData* globalData)
 
 Heap::Heap(JSGlobalData* globalData)
     : m_operationInProgress(NoOperation)
-    , m_markedSpace(this)
+    , m_newSpace(this)
     , m_markListSet(0)
     , m_activityCallback(DefaultGCActivityCallback::create(this))
     , m_globalData(globalData)
@@ -74,7 +74,7 @@ Heap::Heap(JSGlobalData* globalData)
     , m_handleHeap(globalData)
     , m_extraCost(0)
 {
-    m_markedSpace.setHighWaterMark(minBytesPerCycle);
+    m_newSpace.setHighWaterMark(minBytesPerCycle);
     (*m_activityCallback)();
 }
 
@@ -104,10 +104,10 @@ void Heap::destroy()
 
     delete m_markListSet;
     m_markListSet = 0;
-    m_markedSpace.clearMarks();
+    m_newSpace.clearMarks();
     m_handleHeap.finalizeWeakHandles();
     m_globalData->smallStrings.finalizeSmallStrings();
-    m_markedSpace.destroy();
+    m_newSpace.destroy();
 
     m_globalData = 0;
 }
@@ -125,26 +125,26 @@ void Heap::reportExtraMemoryCostSlowCase(size_t cost)
     // if a large value survives one garbage collection, there is not much point to
     // collecting more frequently as long as it stays alive.
 
-    if (m_extraCost > maxExtraCost && m_extraCost > m_markedSpace.highWaterMark() / 2)
+    if (m_extraCost > maxExtraCost && m_extraCost > m_newSpace.highWaterMark() / 2)
         collectAllGarbage();
     m_extraCost += cost;
 }
 
-void* Heap::allocate(MarkedSpace::SizeClass& sizeClass)
+void* Heap::allocate(NewSpace::SizeClass& sizeClass)
 {
 #if COLLECT_ON_EVERY_ALLOCATION
     collectAllGarbage();
     ASSERT(m_operationInProgress == NoOperation);
 #endif
 
-    void* result = m_markedSpace.allocate(sizeClass);
+    void* result = m_newSpace.allocate(sizeClass);
     if (result)
         return result;
 
     collect(DoNotSweep);
 
     m_operationInProgress = Allocation;
-    result = m_markedSpace.allocate(sizeClass);
+    result = m_newSpace.allocate(sizeClass);
     m_operationInProgress = NoOperation;
 
     ASSERT(result);
@@ -232,7 +232,7 @@ void Heap::markRoots()
     ConservativeRoots registerFileRoots(this);
     registerFile().gatherConservativeRoots(registerFileRoots);
 
-    m_markedSpace.clearMarks();
+    m_newSpace.clearMarks();
 
     visitor.append(machineThreadRoots);
     visitor.drain();
@@ -275,17 +275,17 @@ void Heap::markRoots()
 
 size_t Heap::objectCount() const
 {
-    return m_markedSpace.objectCount();
+    return m_newSpace.objectCount();
 }
 
 size_t Heap::size() const
 {
-    return m_markedSpace.size();
+    return m_newSpace.size();
 }
 
 size_t Heap::capacity() const
 {
-    return m_markedSpace.capacity();
+    return m_newSpace.capacity();
 }
 
 size_t Heap::globalObjectCount()
@@ -405,7 +405,7 @@ void Heap::collect(SweepToggle sweepToggle)
 
     JAVASCRIPTCORE_GC_MARKED();
 
-    m_markedSpace.resetAllocator();
+    m_newSpace.resetAllocator();
     m_extraCost = 0;
 
 #if ENABLE(JSC_ZOMBIES)
@@ -413,16 +413,16 @@ void Heap::collect(SweepToggle sweepToggle)
 #endif
 
     if (sweepToggle == DoSweep) {
-        m_markedSpace.sweep();
-        m_markedSpace.shrink();
+        m_newSpace.sweep();
+        m_newSpace.shrink();
     }
 
     // To avoid pathological GC churn in large heaps, we set the allocation high
     // water mark to be proportional to the current size of the heap. The exact
     // proportion is a bit arbitrary. A 2X multiplier gives a 1:1 (heap size :
     // new bytes allocated) proportion, and seems to work well in benchmarks.
-    size_t proportionalBytes = 2 * m_markedSpace.size();
-    m_markedSpace.setHighWaterMark(max(proportionalBytes, minBytesPerCycle));
+    size_t proportionalBytes = 2 * m_newSpace.size();
+    m_newSpace.setHighWaterMark(max(proportionalBytes, minBytesPerCycle));
 
     JAVASCRIPTCORE_GC_END();
 
@@ -444,7 +444,7 @@ bool Heap::isValidAllocation(size_t bytes)
     if (!isValidThreadState(m_globalData))
         return false;
 
-    if (bytes > MarkedSpace::maxCellSize)
+    if (bytes > NewSpace::maxCellSize)
         return false;
 
     if (m_operationInProgress != NoOperation)
index 68e3b33..d66ffc4 100644 (file)
@@ -71,7 +71,7 @@ namespace JSC {
         void destroy(); // JSGlobalData must call destroy() before ~Heap().
 
         JSGlobalData* globalData() const { return m_globalData; }
-        MarkedSpace& markedSpace() { return m_markedSpace; }
+        NewSpace& markedSpace() { return m_newSpace; }
         MachineThreads& machineThreads() { return m_machineThreads; }
 
         GCActivityCallback* activityCallback();
@@ -81,7 +81,7 @@ namespace JSC {
         inline bool isBusy();
 
         void* allocate(size_t);
-        void* allocate(MarkedSpace::SizeClass&);
+        void* allocate(NewSpace::SizeClass&);
         void collectAllGarbage();
 
         void reportExtraMemoryCost(size_t cost);
@@ -130,7 +130,7 @@ namespace JSC {
         RegisterFile& registerFile();
 
         OperationInProgress m_operationInProgress;
-        MarkedSpace m_markedSpace;
+        NewSpace m_newSpace;
 
         ProtectCountSet m_protectedValues;
         Vector<Vector<ValueStringPair>* > m_tempSortingVectors;
@@ -196,7 +196,7 @@ namespace JSC {
 
     inline bool Heap::contains(void* p)
     {
-        return m_markedSpace.contains(p);
+        return m_newSpace.contains(p);
     }
 
     inline void Heap::reportExtraMemoryCost(size_t cost)
@@ -207,13 +207,13 @@ namespace JSC {
 
     template <typename Functor> inline void Heap::forEach(Functor& functor)
     {
-        m_markedSpace.forEach(functor);
+        m_newSpace.forEach(functor);
     }
 
     inline void* Heap::allocate(size_t bytes)
     {
         ASSERT(isValidAllocation(bytes));
-        MarkedSpace::SizeClass& sizeClass = m_markedSpace.sizeClassFor(bytes);
+        NewSpace::SizeClass& sizeClass = m_newSpace.sizeClassFor(bytes);
         return allocate(sizeClass);
     }
 
index c13e975..5741fd7 100644 (file)
@@ -31,7 +31,7 @@ namespace JSC {
 
 class Structure;
 
-MarkedSpace::MarkedSpace(Heap* heap)
+NewSpace::NewSpace(Heap* heap)
     : m_waterMark(0)
     , m_highWaterMark(0)
     , m_heap(heap)
@@ -43,7 +43,7 @@ MarkedSpace::MarkedSpace(Heap* heap)
         sizeClassFor(cellSize).cellSize = cellSize;
 }
 
-void MarkedSpace::destroy()
+void NewSpace::destroy()
 {
     /* Keep our precious zombies! */
 #if !ENABLE(JSC_ZOMBIES)
@@ -53,7 +53,7 @@ void MarkedSpace::destroy()
 #endif
 }
 
-MarkedBlock* MarkedSpace::allocateBlock(SizeClass& sizeClass)
+MarkedBlock* NewSpace::allocateBlock(SizeClass& sizeClass)
 {
     MarkedBlock* block = MarkedBlock::create(m_heap, sizeClass.cellSize);
     sizeClass.blockList.append(block);
@@ -63,7 +63,7 @@ MarkedBlock* MarkedSpace::allocateBlock(SizeClass& sizeClass)
     return block;
 }
 
-void MarkedSpace::freeBlocks(DoublyLinkedList<MarkedBlock>& blocks)
+void NewSpace::freeBlocks(DoublyLinkedList<MarkedBlock>& blocks)
 {
     MarkedBlock* next;
     for (MarkedBlock* block = blocks.head(); block; block = next) {
@@ -75,7 +75,7 @@ void MarkedSpace::freeBlocks(DoublyLinkedList<MarkedBlock>& blocks)
     }
 }
 
-void MarkedSpace::shrink()
+void NewSpace::shrink()
 {
     // We record a temporary list of empties to avoid modifying m_blocks while iterating it.
     DoublyLinkedList<MarkedBlock> empties;
@@ -95,21 +95,21 @@ void MarkedSpace::shrink()
     ASSERT(empties.isEmpty());
 }
 
-void MarkedSpace::clearMarks()
+void NewSpace::clearMarks()
 {
     BlockIterator end = m_blocks.end();
     for (BlockIterator it = m_blocks.begin(); it != end; ++it)
         (*it)->clearMarks();
 }
 
-void MarkedSpace::sweep()
+void NewSpace::sweep()
 {
     BlockIterator end = m_blocks.end();
     for (BlockIterator it = m_blocks.begin(); it != end; ++it)
         (*it)->sweep();
 }
 
-size_t MarkedSpace::objectCount() const
+size_t NewSpace::objectCount() const
 {
     size_t result = 0;
     BlockIterator end = m_blocks.end();
@@ -118,7 +118,7 @@ size_t MarkedSpace::objectCount() const
     return result;
 }
 
-size_t MarkedSpace::size() const
+size_t NewSpace::size() const
 {
     size_t result = 0;
     BlockIterator end = m_blocks.end();
@@ -127,7 +127,7 @@ size_t MarkedSpace::size() const
     return result;
 }
 
-size_t MarkedSpace::capacity() const
+size_t NewSpace::capacity() const
 {
     size_t result = 0;
     BlockIterator end = m_blocks.end();
@@ -136,7 +136,7 @@ size_t MarkedSpace::capacity() const
     return result;
 }
 
-void MarkedSpace::resetAllocator()
+void NewSpace::resetAllocator()
 {
     m_waterMark = 0;
 
index 3b9d6c3..cfa9a18 100644 (file)
@@ -32,7 +32,7 @@
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
-#define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) < MarkedSpace::maxCellSize, class_fits_in_cell)
+#define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) < NewSpace::maxCellSize, class_fits_in_cell)
 
 namespace JSC {
 
@@ -43,8 +43,8 @@ namespace JSC {
     class WeakGCHandle;
     typedef MarkStack SlotVisitor;
 
-    class MarkedSpace {
-        WTF_MAKE_NONCOPYABLE(MarkedSpace);
+    class NewSpace {
+        WTF_MAKE_NONCOPYABLE(NewSpace);
     public:
         static const size_t maxCellSize = 1024;
 
@@ -57,7 +57,7 @@ namespace JSC {
             size_t cellSize;
         };
 
-        MarkedSpace(Heap*);
+        NewSpace(Heap*);
         void destroy();
 
         size_t highWaterMark();
@@ -106,7 +106,7 @@ namespace JSC {
         Heap* m_heap;
     };
 
-    inline bool MarkedSpace::contains(const void* x)
+    inline bool NewSpace::contains(const void* x)
     {
         if (!MarkedBlock::isAtomAligned(x))
             return false;
@@ -118,24 +118,24 @@ namespace JSC {
         return true;
     }
 
-    template <typename Functor> inline void MarkedSpace::forEach(Functor& functor)
+    template <typename Functor> inline void NewSpace::forEach(Functor& functor)
     {
         BlockIterator end = m_blocks.end();
         for (BlockIterator it = m_blocks.begin(); it != end; ++it)
             (*it)->forEach(functor);
     }
 
-    inline size_t MarkedSpace::highWaterMark()
+    inline size_t NewSpace::highWaterMark()
     {
         return m_highWaterMark;
     }
 
-    inline void MarkedSpace::setHighWaterMark(size_t highWaterMark)
+    inline void NewSpace::setHighWaterMark(size_t highWaterMark)
     {
         m_highWaterMark = highWaterMark;
     }
 
-    inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes)
+    inline NewSpace::SizeClass& NewSpace::sizeClassFor(size_t bytes)
     {
         ASSERT(bytes && bytes < maxCellSize);
         if (bytes < preciseCutoff)
@@ -143,7 +143,7 @@ namespace JSC {
         return m_impreciseSizeClasses[(bytes - 1) / impreciseStep];
     }
 
-    inline void* MarkedSpace::allocate(SizeClass& sizeClass)
+    inline void* NewSpace::allocate(SizeClass& sizeClass)
     {
         for (MarkedBlock*& block = sizeClass.nextBlock ; block; block = block->next()) {
             if (void* result = block->allocate())
@@ -158,13 +158,13 @@ namespace JSC {
         return 0;
     }
 
-    inline MarkedSpace::SizeClass::SizeClass()
+    inline NewSpace::SizeClass::SizeClass()
         : nextBlock(0)
         , cellSize(0)
     {
     }
 
-    inline void MarkedSpace::SizeClass::resetAllocator()
+    inline void NewSpace::SizeClass::resetAllocator()
     {
         nextBlock = blockList.head();
     }
index 22cc628..2241d58 100644 (file)
@@ -66,7 +66,7 @@ namespace JSC {
         friend class JSAPIValueWrapper;
         friend class JSZombie;
         friend class JSGlobalData;
-        friend class MarkedSpace;
+        friend class NewSpace;
         friend class MarkedBlock;
         friend class ScopeChainNode;
         friend class Structure;