Title: [167772] trunk/Source/_javascript_Core
- Revision
- 167772
- Author
- mark....@apple.com
- Date
- 2014-04-24 14:12:56 -0700 (Thu, 24 Apr 2014)
Log Message
Make slowPathAllocsBetweenGCs a runtime option.
<https://webkit.org/b/132137>
Reviewed by Mark Hahnenberg.
This will make it easier to more casually run tests with this configuration
as well as to reproduce issues (instead of requiring a code mod and rebuild).
We will now take --slowPathAllocsBetweenGCs=N where N is the number of
slow path allocations before we trigger a collection.
The option defaults to 0, which is reserved to mean that we will not trigger
any collections there.
* heap/Heap.h:
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::doTestCollectionsIfNeeded):
(JSC::MarkedAllocator::allocateSlowCase):
* heap/MarkedAllocator.h:
* runtime/Options.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (167771 => 167772)
--- trunk/Source/_javascript_Core/ChangeLog 2014-04-24 20:46:26 UTC (rev 167771)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-04-24 21:12:56 UTC (rev 167772)
@@ -1,3 +1,25 @@
+2014-04-24 Mark Lam <mark....@apple.com>
+
+ Make slowPathAllocsBetweenGCs a runtime option.
+ <https://webkit.org/b/132137>
+
+ Reviewed by Mark Hahnenberg.
+
+ This will make it easier to more casually run tests with this configuration
+ as well as to reproduce issues (instead of requiring a code mod and rebuild).
+ We will now take --slowPathAllocsBetweenGCs=N where N is the number of
+ slow path allocations before we trigger a collection.
+
+ The option defaults to 0, which is reserved to mean that we will not trigger
+ any collections there.
+
+ * heap/Heap.h:
+ * heap/MarkedAllocator.cpp:
+ (JSC::MarkedAllocator::doTestCollectionsIfNeeded):
+ (JSC::MarkedAllocator::allocateSlowCase):
+ * heap/MarkedAllocator.h:
+ * runtime/Options.h:
+
2014-04-23 Mark Lam <mark....@apple.com>
The GC should only resume compiler threads that it suspended in the same GC pass.
Modified: trunk/Source/_javascript_Core/heap/Heap.h (167771 => 167772)
--- trunk/Source/_javascript_Core/heap/Heap.h 2014-04-24 20:46:26 UTC (rev 167771)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2014-04-24 21:12:56 UTC (rev 167772)
@@ -45,8 +45,6 @@
#include <wtf/HashCountedSet.h>
#include <wtf/HashSet.h>
-#define COLLECT_ON_EVERY_ALLOCATION 0
-
namespace JSC {
class CopiedSpace;
Modified: trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp (167771 => 167772)
--- trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp 2014-04-24 20:46:26 UTC (rev 167771)
+++ trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp 2014-04-24 21:12:56 UTC (rev 167772)
@@ -143,16 +143,27 @@
ASSERT(result || !m_currentBlock);
return result;
}
-
+
+ALWAYS_INLINE void MarkedAllocator::doTestCollectionsIfNeeded()
+{
+ if (!Options::slowPathAllocsBetweenGCs())
+ return;
+
+ static unsigned allocationCount = 0;
+ if (!allocationCount) {
+ if (!m_heap->isDeferred())
+ m_heap->collectAllGarbage();
+ ASSERT(m_heap->m_operationInProgress == NoOperation);
+ }
+ if (++allocationCount >= Options::slowPathAllocsBetweenGCs())
+ allocationCount = 0;
+}
+
void* MarkedAllocator::allocateSlowCase(size_t bytes)
{
ASSERT(m_heap->vm()->currentThreadIsHoldingAPILock());
-#if COLLECT_ON_EVERY_ALLOCATION
- if (!m_heap->isDeferred())
- m_heap->collectAllGarbage();
- ASSERT(m_heap->m_operationInProgress == NoOperation);
-#endif
-
+ doTestCollectionsIfNeeded();
+
ASSERT(!m_markedSpace->isIterating());
ASSERT(!m_freeList.head);
m_heap->didAllocate(m_freeList.bytes);
Modified: trunk/Source/_javascript_Core/heap/MarkedAllocator.h (167771 => 167772)
--- trunk/Source/_javascript_Core/heap/MarkedAllocator.h 2014-04-24 20:46:26 UTC (rev 167771)
+++ trunk/Source/_javascript_Core/heap/MarkedAllocator.h 2014-04-24 21:12:56 UTC (rev 167772)
@@ -50,6 +50,7 @@
void* tryAllocateHelper(size_t);
void* tryPopFreeList(size_t);
MarkedBlock* allocateBlock(size_t);
+ ALWAYS_INLINE void doTestCollectionsIfNeeded();
MarkedBlock::FreeList m_freeList;
MarkedBlock* m_currentBlock;
Modified: trunk/Source/_javascript_Core/runtime/Options.h (167771 => 167772)
--- trunk/Source/_javascript_Core/runtime/Options.h 2014-04-24 20:46:26 UTC (rev 167771)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2014-04-24 21:12:56 UTC (rev 167772)
@@ -250,6 +250,7 @@
v(double, minHeapUtilization, 0.8) \
v(double, minCopiedBlockUtilization, 0.9) \
v(double, minMarkedBlockUtilization, 0.9) \
+ v(unsigned, slowPathAllocsBetweenGCs, 0) \
\
v(double, percentCPUPerMBForFullTimer, 0.0003125) \
v(double, percentCPUPerMBForEdenTimer, 0.0025) \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes