Removed ENABLE_LAZY_BLOCK_FREEING and related #ifdefs
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 04:05:28 +0000 (04:05 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 04:05:28 +0000 (04:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68424

As discussed on webkit-dev. All ports build with threads enabled in JSC now.

This may break WinCE and other ports that have not built and tested with
this configuration. I've filed bugs for port maintainers. It's time for
WebKit to move forward.

Reviewed by Mark Rowe.

* heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::~Heap):
(JSC::Heap::destroy):
(JSC::Heap::blockFreeingThreadMain):
(JSC::Heap::allocateBlock):
(JSC::Heap::freeBlocks):
(JSC::Heap::releaseFreeBlocks):
* heap/Heap.h:
* wtf/Platform.h:

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/heap/Heap.h
Source/JavaScriptCore/wtf/Platform.h

index cd385b8..d6fa922 100644 (file)
@@ -1,5 +1,29 @@
 2011-09-19  Geoffrey Garen  <ggaren@apple.com>
 
+        Removed ENABLE_LAZY_BLOCK_FREEING and related #ifdefs
+        https://bugs.webkit.org/show_bug.cgi?id=68424
+
+        As discussed on webkit-dev. All ports build with threads enabled in JSC now.
+        
+        This may break WinCE and other ports that have not built and tested with
+        this configuration. I've filed bugs for port maintainers. It's time for
+        WebKit to move forward.
+
+        Reviewed by Mark Rowe.
+
+        * heap/Heap.cpp:
+        (JSC::Heap::Heap):
+        (JSC::Heap::~Heap):
+        (JSC::Heap::destroy):
+        (JSC::Heap::blockFreeingThreadMain):
+        (JSC::Heap::allocateBlock):
+        (JSC::Heap::freeBlocks):
+        (JSC::Heap::releaseFreeBlocks):
+        * heap/Heap.h:
+        * wtf/Platform.h:
+
+2011-09-19  Geoffrey Garen  <ggaren@apple.com>
+
         Removed ENABLE_WTF_MULTIPLE_THREADS and related #ifdefs
         https://bugs.webkit.org/show_bug.cgi?id=68423
 
index 8a95cb7..26e4ef4 100644 (file)
@@ -261,16 +261,13 @@ Heap::Heap(JSGlobalData* globalData, HeapSize heapSize)
 {
     m_markedSpace.setHighWaterMark(m_minBytesPerCycle);
     (*m_activityCallback)();
-#if ENABLE(LAZY_BLOCK_FREEING)
     m_numberOfFreeBlocks = 0;
     m_blockFreeingThread = createThread(blockFreeingThreadStartFunc, this, "JavaScriptCore::BlockFree");
     ASSERT(m_blockFreeingThread);
-#endif
 }
 
 Heap::~Heap()
 {
-#if ENABLE(LAZY_BLOCK_FREEING)
     // destroy our thread
     {
         MutexLocker locker(m_freeBlockLock);
@@ -278,7 +275,6 @@ Heap::~Heap()
         m_freeBlockCondition.broadcast();
     }
     waitForThreadCompletion(m_blockFreeingThread, 0);
-#endif
     
     // The destroy function must already have been called, so assert this.
     ASSERT(!m_globalData);
@@ -317,14 +313,11 @@ void Heap::destroy()
     m_destroyedTypeCounts.dump(stderr, "Destroyed Type Counts");
 #endif
     
-#if ENABLE(LAZY_BLOCK_FREEING)
     releaseFreeBlocks();
-#endif
 
     m_globalData = 0;
 }
 
-#if ENABLE(LAZY_BLOCK_FREEING)
 void Heap::waitForRelativeTimeWhileHoldingLock(double relative)
 {
     if (m_blockFreeingThreadShouldQuit)
@@ -386,7 +379,6 @@ void Heap::blockFreeingThreadMain()
         }
     }
 }
-#endif // ENABLE(LAZY_BLOCK_FREEING)
 
 void Heap::reportExtraMemoryCostSlowCase(size_t cost)
 {
@@ -736,12 +728,6 @@ MarkedBlock* Heap::allocateBlock(size_t cellSize, Heap::AllocationEffort allocat
 {
     MarkedBlock* block;
     
-#if !ENABLE(LAZY_BLOCK_FREEING)
-    if (allocationEffort == AllocationCanFail)
-        return 0;
-    
-    block = MarkedBlock::create(this, cellSize);
-#else
     {
         MutexLocker locker(m_freeBlockLock);
         if (m_numberOfFreeBlocks) {
@@ -757,7 +743,6 @@ MarkedBlock* Heap::allocateBlock(size_t cellSize, Heap::AllocationEffort allocat
         return 0;
     else
         block = MarkedBlock::create(this, cellSize);
-#endif
     
     m_blocks.add(block);
 
@@ -772,13 +757,9 @@ void Heap::freeBlocks(MarkedBlock* head)
 
         m_blocks.remove(block);
         block->reset();
-#if !ENABLE(LAZY_BLOCK_FREEING)
-        MarkedBlock::destroy(block);
-#else
         MutexLocker locker(m_freeBlockLock);
         m_freeBlocks.append(block);
         m_numberOfFreeBlocks++;
-#endif
     }
 }
 
@@ -789,7 +770,6 @@ void Heap::shrink()
     freeBlocks(forEachBlock(takeIfEmpty));
 }
 
-#if ENABLE(LAZY_BLOCK_FREEING)
 void Heap::releaseFreeBlocks()
 {
     while (true) {
@@ -811,7 +791,6 @@ void Heap::releaseFreeBlocks()
         MarkedBlock::destroy(block);
     }
 }
-#endif
 
 #if ENABLE(GGC)
 void Heap::writeBarrierSlowCase(const JSCell* owner, JSCell* cell)
index 3d308b3..3d59259 100644 (file)
@@ -164,12 +164,10 @@ namespace JSC {
 
         static void writeBarrierSlowCase(const JSCell*, JSCell*);
 
-#if ENABLE(LAZY_BLOCK_FREEING)
         void waitForRelativeTimeWhileHoldingLock(double relative);
         void waitForRelativeTime(double relative);
         void blockFreeingThreadMain();
         static void* blockFreeingThreadStartFunc(void* heap);
-#endif
 
         const HeapSize m_heapSize;
         const size_t m_minBytesPerCycle;
@@ -178,7 +176,6 @@ namespace JSC {
         MarkedSpace m_markedSpace;
         MarkedBlockSet m_blocks;
 
-#if ENABLE(LAZY_BLOCK_FREEING)
         DoublyLinkedList<MarkedBlock> m_freeBlocks;
         size_t m_numberOfFreeBlocks;
         
@@ -186,7 +183,6 @@ namespace JSC {
         Mutex m_freeBlockLock;
         ThreadCondition m_freeBlockCondition;
         bool m_blockFreeingThreadShouldQuit;
-#endif
 
 #if ENABLE(SIMPLE_HEAP_PROFILING)
         VTableSpectrum m_destroyedTypeCounts;
index dda5885..ee8eabd 100644 (file)
 #endif
 #endif
 
-#if !defined(ENABLE_LAZY_BLOCK_FREEING)
-#define ENABLE_LAZY_BLOCK_FREEING 1
-#endif
-
 #ifndef ENABLE_LARGE_HEAP
 #if CPU(X86) || CPU(X86_64)
 #define ENABLE_LARGE_HEAP 1