diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:09:45 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:10:13 +0100 |
commit | 470286ecfe79d59df14944e5b5d34630fc739391 (patch) | |
tree | 43983212872e06cebefd2ae474418fa2908ca54c /Source/JavaScriptCore/heap/MarkStack.h | |
parent | 23037105e948c2065da5a937d3a2396b0ff45c1e (diff) | |
download | qtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz |
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
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; }; |