diff options
Diffstat (limited to 'Source/JavaScriptCore/heap')
-rw-r--r-- | Source/JavaScriptCore/heap/BlockAllocator.cpp | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/BlockAllocator.h | 14 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopiedBlock.h | 64 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopiedBlockInlines.h | 54 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopiedSpace.h | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopiedSpaceInlines.h | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopyVisitor.cpp | 28 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopyVisitor.h | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopyVisitorInlines.h | 28 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/CopyWorkList.h | 165 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/GCThreadSharedData.cpp | 3 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/GCThreadSharedData.h | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/Heap.h | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/SlotVisitor.h | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/SlotVisitorInlines.h | 8 |
15 files changed, 307 insertions, 69 deletions
diff --git a/Source/JavaScriptCore/heap/BlockAllocator.cpp b/Source/JavaScriptCore/heap/BlockAllocator.cpp index 2d7b57f9a..f94025c1a 100644 --- a/Source/JavaScriptCore/heap/BlockAllocator.cpp +++ b/Source/JavaScriptCore/heap/BlockAllocator.cpp @@ -27,6 +27,7 @@ #include "BlockAllocator.h" #include "CopiedBlock.h" +#include "CopyWorkList.h" #include "MarkedBlock.h" #include "WeakBlock.h" #include <wtf/CurrentTime.h> @@ -37,6 +38,7 @@ BlockAllocator::BlockAllocator() : m_copiedRegionSet(CopiedBlock::blockSize) , m_markedRegionSet(MarkedBlock::blockSize) , m_weakAndMarkStackRegionSet(WeakBlock::blockSize) + , m_workListRegionSet(CopyWorkListSegment::blockSize) , m_numberOfEmptyRegions(0) , m_isCurrentlyAllocating(false) , m_blockFreeingThreadShouldQuit(false) diff --git a/Source/JavaScriptCore/heap/BlockAllocator.h b/Source/JavaScriptCore/heap/BlockAllocator.h index 75c59b783..417f81da0 100644 --- a/Source/JavaScriptCore/heap/BlockAllocator.h +++ b/Source/JavaScriptCore/heap/BlockAllocator.h @@ -37,6 +37,7 @@ namespace JSC { class BlockAllocator; class CopiedBlock; +class CopyWorkListSegment; class MarkStackSegment; class MarkedBlock; class Region; @@ -188,6 +189,7 @@ private: RegionSet m_markedRegionSet; // WeakBlocks and MarkStackSegments use the same RegionSet since they're the same size. RegionSet m_weakAndMarkStackRegionSet; + RegionSet m_workListRegionSet; DoublyLinkedList<Region> m_emptyRegions; size_t m_numberOfEmptyRegions; @@ -327,6 +329,12 @@ inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor<MarkStackSegment> } template <> +inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor<CopyWorkListSegment>() +{ + return m_workListRegionSet; +} + +template <> inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor<HeapBlock<CopiedBlock> >() { return m_copiedRegionSet; @@ -350,6 +358,12 @@ inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor<HeapBlock<MarkSta return m_weakAndMarkStackRegionSet; } +template <> +inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor<HeapBlock<CopyWorkListSegment> >() +{ + return m_workListRegionSet; +} + template <typename T> inline BlockAllocator::RegionSet& BlockAllocator::regionSetFor() { diff --git a/Source/JavaScriptCore/heap/CopiedBlock.h b/Source/JavaScriptCore/heap/CopiedBlock.h index 83fdb08da..7f585585c 100644 --- a/Source/JavaScriptCore/heap/CopiedBlock.h +++ b/Source/JavaScriptCore/heap/CopiedBlock.h @@ -27,11 +27,14 @@ #define CopiedBlock_h #include "BlockAllocator.h" +#include "CopyWorkList.h" #include "HeapBlock.h" #include "JSValue.h" #include "JSValueInlines.h" #include "Options.h" #include <wtf/Atomics.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace JSC { @@ -44,12 +47,13 @@ public: static CopiedBlock* create(DeadBlock*); static CopiedBlock* createNoZeroFill(DeadBlock*); + void pin(); bool isPinned(); unsigned liveBytes(); - void reportLiveBytes(unsigned); + void reportLiveBytes(JSCell*, unsigned); void didSurviveGC(); - bool didEvacuateBytes(unsigned); + void didEvacuateBytes(unsigned); bool shouldEvacuate(); bool canBeRecycled(); @@ -74,10 +78,18 @@ public: static const size_t blockSize = 32 * KB; + bool hasWorkList(); + CopyWorkList& workList(); + private: CopiedBlock(Region*); void zeroFillWilderness(); // Can be called at any time to zero-fill to the end of the block. +#if ENABLE(PARALLEL_GC) + SpinLock m_workListLock; +#endif + OwnPtr<CopyWorkList> m_workList; + size_t m_remaining; uintptr_t m_isPinned; unsigned m_liveBytes; @@ -114,45 +126,24 @@ inline CopiedBlock::CopiedBlock(Region* region) , m_isPinned(false) , m_liveBytes(0) { - ASSERT(is8ByteAligned(reinterpret_cast<void*>(m_remaining))); -} - -inline void CopiedBlock::reportLiveBytes(unsigned bytes) -{ #if ENABLE(PARALLEL_GC) - unsigned oldValue = 0; - unsigned newValue = 0; - do { - oldValue = m_liveBytes; - newValue = oldValue + bytes; - } while (!WTF::weakCompareAndSwap(&m_liveBytes, oldValue, newValue)); -#else - m_liveBytes += bytes; + m_workListLock.Init(); #endif + ASSERT(is8ByteAligned(reinterpret_cast<void*>(m_remaining))); } inline void CopiedBlock::didSurviveGC() { m_liveBytes = 0; m_isPinned = false; + if (m_workList) + m_workList.clear(); } -inline bool CopiedBlock::didEvacuateBytes(unsigned bytes) +inline void CopiedBlock::didEvacuateBytes(unsigned bytes) { ASSERT(m_liveBytes >= bytes); -#if ENABLE(PARALLEL_GC) - unsigned oldValue = 0; - unsigned newValue = 0; - do { - oldValue = m_liveBytes; - newValue = oldValue - bytes; - } while (!WTF::weakCompareAndSwap(&m_liveBytes, oldValue, newValue)); - ASSERT(m_liveBytes < oldValue); - return !newValue; -#else m_liveBytes -= bytes; - return !m_liveBytes; -#endif } inline bool CopiedBlock::canBeRecycled() @@ -165,6 +156,13 @@ inline bool CopiedBlock::shouldEvacuate() return static_cast<double>(m_liveBytes) / static_cast<double>(payloadCapacity()) <= Options::minCopiedBlockUtilization(); } +inline void CopiedBlock::pin() +{ + m_isPinned = true; + if (m_workList) + m_workList.clear(); +} + inline bool CopiedBlock::isPinned() { return m_isPinned; @@ -230,6 +228,16 @@ inline size_t CopiedBlock::capacity() return region()->blockSize(); } +inline bool CopiedBlock::hasWorkList() +{ + return !!m_workList; +} + +inline CopyWorkList& CopiedBlock::workList() +{ + return *m_workList; +} + } // namespace JSC #endif diff --git a/Source/JavaScriptCore/heap/CopiedBlockInlines.h b/Source/JavaScriptCore/heap/CopiedBlockInlines.h new file mode 100644 index 000000000..0068abcdd --- /dev/null +++ b/Source/JavaScriptCore/heap/CopiedBlockInlines.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CopiedBlockInlines_h +#define CopiedBlockInlines_h + +#include "CopiedBlock.h" +#include "Heap.h" + +namespace JSC { + +inline void CopiedBlock::reportLiveBytes(JSCell* owner, unsigned bytes) +{ +#if ENABLE(PARALLEL_GC) + SpinLockHolder locker(&m_workListLock); +#endif + m_liveBytes += bytes; + + if (!shouldEvacuate()) { + pin(); + return; + } + + if (!m_workList) + m_workList = adoptPtr(new CopyWorkList(Heap::heap(owner)->blockAllocator())); + + m_workList->append(owner); +} + +} // namespace JSC + +#endif // CopiedBlockInlines_h diff --git a/Source/JavaScriptCore/heap/CopiedSpace.h b/Source/JavaScriptCore/heap/CopiedSpace.h index 3a698e8dc..e3727100e 100644 --- a/Source/JavaScriptCore/heap/CopiedSpace.h +++ b/Source/JavaScriptCore/heap/CopiedSpace.h @@ -47,6 +47,7 @@ class CopiedBlock; class CopiedSpace { friend class CopyVisitor; + friend class GCThreadSharedData; friend class SlotVisitor; friend class JIT; public: diff --git a/Source/JavaScriptCore/heap/CopiedSpaceInlines.h b/Source/JavaScriptCore/heap/CopiedSpaceInlines.h index 9d222f549..41f94dd74 100644 --- a/Source/JavaScriptCore/heap/CopiedSpaceInlines.h +++ b/Source/JavaScriptCore/heap/CopiedSpaceInlines.h @@ -54,7 +54,7 @@ inline bool CopiedSpace::contains(void* ptr, CopiedBlock*& result) inline void CopiedSpace::pin(CopiedBlock* block) { - block->m_isPinned = true; + block->pin(); } inline void CopiedSpace::pinIfNecessary(void* opaquePointer) diff --git a/Source/JavaScriptCore/heap/CopyVisitor.cpp b/Source/JavaScriptCore/heap/CopyVisitor.cpp index 22ab57882..281d4bd3b 100644 --- a/Source/JavaScriptCore/heap/CopyVisitor.cpp +++ b/Source/JavaScriptCore/heap/CopyVisitor.cpp @@ -27,6 +27,7 @@ #include "CopyVisitor.h" #include "CopyVisitorInlines.h" +#include "CopyWorkList.h" #include "GCThreadSharedData.h" #include "JSCell.h" #include "JSObject.h" @@ -41,17 +42,24 @@ CopyVisitor::CopyVisitor(GCThreadSharedData& shared) void CopyVisitor::copyFromShared() { - GCCopyPhaseFunctor functor(*this); - Vector<MarkedBlock*>& blocksToCopy = m_shared.m_blocksToCopy; - size_t startIndex, endIndex; - - m_shared.getNextBlocksToCopy(startIndex, endIndex); - while (startIndex < endIndex) { - for (size_t i = startIndex; i < endIndex; i++) - blocksToCopy[i]->forEachLiveCell(functor); - m_shared.getNextBlocksToCopy(startIndex, endIndex); + size_t next, end; + m_shared.getNextBlocksToCopy(next, end); + while (next < end) { + for (; next < end; ++next) { + CopiedBlock* block = m_shared.m_blocksToCopy[next]; + if (!block->hasWorkList()) + continue; + + CopyWorkList& workList = block->workList(); + for (CopyWorkList::iterator it = workList.begin(); it != workList.end(); ++it) + visitCell(*it); + + ASSERT(!block->liveBytes()); + m_shared.m_copiedSpace->recycleEvacuatedBlock(block); + } + m_shared.getNextBlocksToCopy(next, end); } - ASSERT(startIndex == endIndex); + ASSERT(next == end); } } // namespace JSC diff --git a/Source/JavaScriptCore/heap/CopyVisitor.h b/Source/JavaScriptCore/heap/CopyVisitor.h index 45a2e0ad9..c5f7272a9 100644 --- a/Source/JavaScriptCore/heap/CopyVisitor.h +++ b/Source/JavaScriptCore/heap/CopyVisitor.h @@ -31,6 +31,7 @@ namespace JSC { class GCThreadSharedData; +class JSCell; class CopyVisitor { public: @@ -50,6 +51,7 @@ public: private: void* allocateNewSpaceSlow(size_t); + void visitCell(JSCell*); GCThreadSharedData& m_shared; CopiedAllocator m_copiedAllocator; diff --git a/Source/JavaScriptCore/heap/CopyVisitorInlines.h b/Source/JavaScriptCore/heap/CopyVisitorInlines.h index bd7879429..1557af93d 100644 --- a/Source/JavaScriptCore/heap/CopyVisitorInlines.h +++ b/Source/JavaScriptCore/heap/CopyVisitorInlines.h @@ -34,25 +34,11 @@ namespace JSC { -class GCCopyPhaseFunctor : public MarkedBlock::VoidFunctor { -public: - GCCopyPhaseFunctor(CopyVisitor& visitor) - : m_visitor(visitor) - { - } - - void operator()(JSCell* cell) - { - Structure* structure = cell->structure(); - if (!structure->outOfLineCapacity() && !hasIndexedProperties(structure->indexingType())) - return; - ASSERT(structure->classInfo()->methodTable.copyBackingStore == JSObject::copyBackingStore); - JSObject::copyBackingStore(cell, m_visitor); - } - -private: - CopyVisitor& m_visitor; -}; +inline void CopyVisitor::visitCell(JSCell* cell) +{ + ASSERT(cell->structure()->classInfo()->methodTable.copyBackingStore == JSObject::copyBackingStore); + JSObject::copyBackingStore(cell, *this); +} inline bool CopyVisitor::checkIfShouldCopy(void* oldPtr, size_t bytes) { @@ -110,8 +96,8 @@ inline void CopyVisitor::didCopy(void* ptr, size_t bytes) CopiedBlock* block = CopiedSpace::blockFor(ptr); ASSERT(!block->isPinned()); - if (block->didEvacuateBytes(bytes)) - m_shared.m_copiedSpace->recycleEvacuatedBlock(block); + block->didEvacuateBytes(bytes); + } } // namespace JSC diff --git a/Source/JavaScriptCore/heap/CopyWorkList.h b/Source/JavaScriptCore/heap/CopyWorkList.h new file mode 100644 index 000000000..164e2ddce --- /dev/null +++ b/Source/JavaScriptCore/heap/CopyWorkList.h @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CopyWorkList_h +#define CopyWorkList_h + +#include <wtf/Vector.h> + +namespace JSC { + +class JSCell; + +class CopyWorkListSegment : public HeapBlock<CopyWorkListSegment> { +public: + static CopyWorkListSegment* create(DeadBlock* block) + { + return new (NotNull, block) CopyWorkListSegment(block->region()); + } + + size_t size() { return m_size; } + bool isFull() { return reinterpret_cast<char*>(&data()[size()]) >= endOfBlock(); } + JSCell* get(size_t index) { return data()[index]; } + + void append(JSCell* cell) + { + ASSERT(!isFull()); + data()[m_size] = cell; + m_size += 1; + } + + static const size_t blockSize = 512; + +private: + CopyWorkListSegment(Region* region) + : HeapBlock<CopyWorkListSegment>(region) + , m_size(0) + { + } + + JSCell** data() { return reinterpret_cast<JSCell**>(this + 1); } + char* endOfBlock() { return reinterpret_cast<char*>(this) + blockSize; } + + size_t m_size; +}; + +class CopyWorkListIterator { + friend class CopyWorkList; +public: + JSCell* get() { return m_currentSegment->get(m_currentIndex); } + JSCell* operator*() { return get(); } + JSCell* operator->() { return get(); } + + CopyWorkListIterator& operator++() + { + m_currentIndex++; + + if (m_currentIndex >= m_currentSegment->size()) { + m_currentIndex = 0; + m_currentSegment = m_currentSegment->next(); + + ASSERT(!m_currentSegment || m_currentSegment->size()); + } + + return *this; + } + + bool operator==(const CopyWorkListIterator& other) const + { + return m_currentSegment == other.m_currentSegment && m_currentIndex == other.m_currentIndex; + } + + bool operator!=(const CopyWorkListIterator& other) const + { + return !(*this == other); + } + + CopyWorkListIterator() + : m_currentSegment(0) + , m_currentIndex(0) + { + } + +private: + CopyWorkListIterator(CopyWorkListSegment* startSegment, size_t startIndex) + : m_currentSegment(startSegment) + , m_currentIndex(startIndex) + { + } + + CopyWorkListSegment* m_currentSegment; + size_t m_currentIndex; +}; + +class CopyWorkList { +public: + typedef CopyWorkListIterator iterator; + + CopyWorkList(BlockAllocator&); + ~CopyWorkList(); + + void append(JSCell*); + iterator begin(); + iterator end(); + +private: + DoublyLinkedList<CopyWorkListSegment> m_segments; + BlockAllocator& m_blockAllocator; +}; + +inline CopyWorkList::CopyWorkList(BlockAllocator& blockAllocator) + : m_blockAllocator(blockAllocator) +{ +} + +inline CopyWorkList::~CopyWorkList() +{ + while (!m_segments.isEmpty()) + m_blockAllocator.deallocate(CopyWorkListSegment::destroy(m_segments.removeHead())); +} + +inline void CopyWorkList::append(JSCell* cell) +{ + if (m_segments.isEmpty() || m_segments.tail()->isFull()) + m_segments.append(CopyWorkListSegment::create(m_blockAllocator.allocate<CopyWorkListSegment>())); + + ASSERT(!m_segments.tail()->isFull()); + + m_segments.tail()->append(cell); +} + +inline CopyWorkList::iterator CopyWorkList::begin() +{ + return CopyWorkListIterator(m_segments.head(), 0); +} + +inline CopyWorkList::iterator CopyWorkList::end() +{ + return CopyWorkListIterator(); +} + +} // namespace JSC + +#endif // CopyWorkList_h diff --git a/Source/JavaScriptCore/heap/GCThreadSharedData.cpp b/Source/JavaScriptCore/heap/GCThreadSharedData.cpp index f513fafab..5d2e908f1 100644 --- a/Source/JavaScriptCore/heap/GCThreadSharedData.cpp +++ b/Source/JavaScriptCore/heap/GCThreadSharedData.cpp @@ -59,7 +59,6 @@ GCThreadSharedData::GCThreadSharedData(JSGlobalData* globalData) , m_sharedMarkStack(globalData->heap.blockAllocator()) , m_numberOfActiveParallelMarkers(0) , m_parallelMarkersShouldExit(false) - , m_blocksToCopy(globalData->heap.m_blockSnapshot) , m_copyIndex(0) , m_numberOfActiveGCThreads(0) , m_gcThreadsShouldWait(false) @@ -166,7 +165,7 @@ void GCThreadSharedData::didStartCopying() { { SpinLockHolder locker(&m_copyLock); - m_blocksToCopy = m_globalData->heap.m_blockSnapshot; + WTF::copyToVector(m_copiedSpace->m_blockSet, m_blocksToCopy); m_copyIndex = 0; } diff --git a/Source/JavaScriptCore/heap/GCThreadSharedData.h b/Source/JavaScriptCore/heap/GCThreadSharedData.h index b80cc5af2..dbc11b552 100644 --- a/Source/JavaScriptCore/heap/GCThreadSharedData.h +++ b/Source/JavaScriptCore/heap/GCThreadSharedData.h @@ -94,7 +94,7 @@ private: HashSet<void*> m_opaqueRoots; SpinLock m_copyLock; - Vector<MarkedBlock*>& m_blocksToCopy; + Vector<CopiedBlock*> m_blocksToCopy; size_t m_copyIndex; static const size_t s_blockFragmentLength = 32; diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h index 90c9f2ab1..2df365643 100644 --- a/Source/JavaScriptCore/heap/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h @@ -179,6 +179,7 @@ namespace JSC { private: friend class CodeBlock; + friend class CopiedBlock; friend class GCAwareJITStubRoutine; friend class JITStubRoutine; friend class LLIntOffsetsExtractor; diff --git a/Source/JavaScriptCore/heap/SlotVisitor.h b/Source/JavaScriptCore/heap/SlotVisitor.h index 53c7de64f..7d16dc2ed 100644 --- a/Source/JavaScriptCore/heap/SlotVisitor.h +++ b/Source/JavaScriptCore/heap/SlotVisitor.h @@ -82,7 +82,7 @@ public: void harvestWeakReferences(); void finalizeUnconditionalFinalizers(); - void copyLater(void*, size_t); + void copyLater(JSCell*, void*, size_t); #if ENABLE(SIMPLE_HEAP_PROFILING) VTableSpectrum m_visitedTypeCounts; diff --git a/Source/JavaScriptCore/heap/SlotVisitorInlines.h b/Source/JavaScriptCore/heap/SlotVisitorInlines.h index ea8126f87..d76ac552a 100644 --- a/Source/JavaScriptCore/heap/SlotVisitorInlines.h +++ b/Source/JavaScriptCore/heap/SlotVisitorInlines.h @@ -26,6 +26,7 @@ #ifndef SlotVisitorInlines_h #define SlotVisitorInlines_h +#include "CopiedBlockInlines.h" #include "CopiedSpaceInlines.h" #include "Options.h" #include "SlotVisitor.h" @@ -160,7 +161,7 @@ inline void SlotVisitor::donateAndDrain() drain(); } -inline void SlotVisitor::copyLater(void* ptr, size_t bytes) +inline void SlotVisitor::copyLater(JSCell* owner, void* ptr, size_t bytes) { if (CopiedSpace::isOversize(bytes)) { m_shared.m_copiedSpace->pin(CopiedSpace::oversizeBlockFor(ptr)); @@ -171,10 +172,7 @@ inline void SlotVisitor::copyLater(void* ptr, size_t bytes) if (block->isPinned()) return; - block->reportLiveBytes(bytes); - - if (!block->shouldEvacuate()) - m_shared.m_copiedSpace->pin(block); + block->reportLiveBytes(owner, bytes); } } // namespace JSC |