diff options
Diffstat (limited to 'Source/JavaScriptCore/heap/MarkStack.h')
-rw-r--r-- | Source/JavaScriptCore/heap/MarkStack.h | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/Source/JavaScriptCore/heap/MarkStack.h b/Source/JavaScriptCore/heap/MarkStack.h index 0245e4be5..2a7f04450 100644 --- a/Source/JavaScriptCore/heap/MarkStack.h +++ b/Source/JavaScriptCore/heap/MarkStack.h @@ -27,19 +27,19 @@ #define MarkStack_h #if ENABLE(OBJECT_MARK_LOGGING) -#define MARK_LOG_MESSAGE0(message) dataLog(message) -#define MARK_LOG_MESSAGE1(message, arg1) dataLog(message, arg1) -#define MARK_LOG_MESSAGE2(message, arg1, arg2) dataLog(message, arg1, arg2) +#define MARK_LOG_MESSAGE0(message) dataLogF(message) +#define MARK_LOG_MESSAGE1(message, arg1) dataLogF(message, arg1) +#define MARK_LOG_MESSAGE2(message, arg1, arg2) dataLogF(message, arg1, arg2) #define MARK_LOG_ROOT(visitor, rootName) \ - dataLog("\n%s: ", rootName); \ + dataLogF("\n%s: ", rootName); \ (visitor).resetChildCount() #define MARK_LOG_PARENT(visitor, parent) \ - dataLog("\n%p (%s): ", parent, parent->className() ? parent->className() : "unknown"); \ + dataLogF("\n%p (%s): ", parent, parent->className() ? parent->className() : "unknown"); \ (visitor).resetChildCount() #define MARK_LOG_CHILD(visitor, child) \ if ((visitor).childCount()) \ - dataLogString(", "); \ - dataLog("%p", child); \ + dataLogFString(", "); \ + dataLogF("%p", child); \ (visitor).incrementChildCount() #else #define MARK_LOG_MESSAGE0(message) do { } while (false) @@ -50,19 +50,27 @@ #define MARK_LOG_CHILD(visitor, child) do { } while (false) #endif +#include "HeapBlock.h" #include <wtf/StdLibExtras.h> -#include <wtf/TCSpinLock.h> namespace JSC { +class BlockAllocator; +class DeadBlock; class JSCell; -struct MarkStackSegment { - MarkStackSegment* m_previous; +class MarkStackSegment : public HeapBlock<MarkStackSegment> { +public: + MarkStackSegment(Region* region) + : HeapBlock<MarkStackSegment>(region) #if !ASSERT_DISABLED - size_t m_top; + , m_top(0) #endif - + { + } + + static MarkStackSegment* create(DeadBlock*); + const JSCell** data() { return bitwise_cast<const JSCell**>(this + 1); @@ -77,26 +85,17 @@ struct MarkStackSegment { { return sizeof(MarkStackSegment) + capacity * sizeof(const JSCell*); } -}; -class MarkStackSegmentAllocator { -public: - MarkStackSegmentAllocator(); - ~MarkStackSegmentAllocator(); - - MarkStackSegment* allocate(); - void release(MarkStackSegment*); - - void shrinkReserve(); - -private: - SpinLock m_lock; - MarkStackSegment* m_nextFreeSegment; + static const size_t blockSize = 4 * KB; + +#if !ASSERT_DISABLED + size_t m_top; +#endif }; class MarkStackArray { public: - MarkStackArray(MarkStackSegmentAllocator&); + MarkStackArray(BlockAllocator&); ~MarkStackArray(); void append(const JSCell*); @@ -122,12 +121,12 @@ private: void validatePrevious(); - MarkStackSegment* m_topSegment; - MarkStackSegmentAllocator& m_allocator; + DoublyLinkedList<MarkStackSegment> m_segments; + BlockAllocator& m_blockAllocator; size_t m_segmentCapacity; size_t m_top; - size_t m_numberOfPreviousSegments; + size_t m_numberOfSegments; }; |