WebKit Bugzilla
Attachment 359603 Details for
Bug 193612
: [JSC] Shrink data structure size in JSC/heap
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193612-20190119040149.patch (text/plain), 29.44 KB, created by
Yusuke Suzuki
on 2019-01-19 04:01:50 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-01-19 04:01:50 PST
Size:
29.44 KB
patch
obsolete
>Subversion Revision: 240200 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 19a250df1e8669b8ab2a7fafd36f316209b112f9..fd1a82068b13d7ff7556e67046ba604a281cc431 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,57 @@ >+2019-01-19 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [JSC] Shrink data structure size in JSC/heap >+ https://bugs.webkit.org/show_bug.cgi?id=193612 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch reduces the size of data structures in JSC/heap. Basically, we reorder the members to remove paddings. >+ >+ For Subspace, we drop CellAttributes `m_attributes`. Instead, we use `heapCellType->attributes()`. And we use >+ FreeList::cellSize() instead of holding m_cellSize in LocalAllocator. >+ >+ This change reduces the size of JSC::VM too since it includes JSC::Heap. The size of VM becomes from 78208 to 76696. >+ >+ * heap/BlockDirectory.cpp: >+ * heap/BlockDirectory.h: >+ * heap/CollectionScope.h: >+ * heap/CompleteSubspace.cpp: >+ (JSC::CompleteSubspace::allocatorForSlow): >+ * heap/FreeList.h: >+ (JSC::FreeList::offsetOfCellSize): >+ (JSC::FreeList::cellSize const): >+ * heap/Heap.cpp: >+ (JSC::Heap::Heap): >+ (JSC::Heap::updateObjectCounts): >+ (JSC::Heap::addToRememberedSet): >+ (JSC::Heap::runBeginPhase): >+ (JSC::Heap::willStartCollection): >+ (JSC::Heap::pruneStaleEntriesFromWeakGCMaps): >+ (JSC::Heap::deleteSourceProviderCaches): >+ (JSC::Heap::notifyIncrementalSweeper): >+ (JSC::Heap::updateAllocationLimits): >+ * heap/Heap.h: >+ * heap/IsoAlignedMemoryAllocator.h: >+ * heap/LargeAllocation.cpp: >+ * heap/LocalAllocator.cpp: >+ (JSC::LocalAllocator::LocalAllocator): >+ * heap/LocalAllocator.h: >+ (JSC::LocalAllocator::cellSize const): >+ (JSC::LocalAllocator::offsetOfCellSize): >+ * heap/MarkedSpace.cpp: >+ (JSC::MarkedSpace::MarkedSpace): >+ * heap/MarkedSpace.h: >+ * heap/MarkingConstraint.h: >+ * heap/Subspace.cpp: >+ (JSC::Subspace::initialize): >+ * heap/Subspace.h: >+ (JSC::Subspace::attributes const): Deleted. >+ * heap/SubspaceInlines.h: >+ (JSC::Subspace::forEachMarkedCell): >+ (JSC::Subspace::forEachMarkedCellInParallel): >+ (JSC::Subspace::forEachLiveCell): >+ (JSC::Subspace::attributes const): >+ > 2019-01-18 Keith Miller <keith_miller@apple.com> > > JSScript API should only take ascii files. >diff --git a/Source/JavaScriptCore/heap/BlockDirectory.cpp b/Source/JavaScriptCore/heap/BlockDirectory.cpp >index f5f2b3eb4d3aa31e0b4898576ca5f21870f4f1e4..8c1a9343c7b4c8f98d475eb968d6fd9756bc2b12 100644 >--- a/Source/JavaScriptCore/heap/BlockDirectory.cpp >+++ b/Source/JavaScriptCore/heap/BlockDirectory.cpp >@@ -32,6 +32,7 @@ > #include "IncrementalSweeper.h" > #include "JSCInlines.h" > #include "MarkedBlockInlines.h" >+#include "SubspaceInlines.h" > #include "SuperSampler.h" > #include "VM.h" > >diff --git a/Source/JavaScriptCore/heap/BlockDirectory.h b/Source/JavaScriptCore/heap/BlockDirectory.h >index a12b433cef34d2f2dc685f2a6bac2720b393c1cc..a7bcaa6b9ebd4bad63d7e78110918e3e436387d1 100644 >--- a/Source/JavaScriptCore/heap/BlockDirectory.h >+++ b/Source/JavaScriptCore/heap/BlockDirectory.h >@@ -173,19 +173,21 @@ class BlockDirectory { > > // Mutator uses this to guard resizing the bitvectors. Those things in the GC that may run > // concurrently to the mutator must lock this when accessing the bitvectors. >- Lock m_bitvectorLock; > #define BLOCK_DIRECTORY_BIT_DECLARATION(lowerBitName, capitalBitName) \ > FastBitVector m_ ## lowerBitName; > FOR_EACH_BLOCK_DIRECTORY_BIT(BLOCK_DIRECTORY_BIT_DECLARATION) > #undef BLOCK_DIRECTORY_BIT_DECLARATION >+ Lock m_bitvectorLock; >+ Lock m_localAllocatorsLock; >+ CellAttributes m_attributes; >+ >+ unsigned m_cellSize; > > // After you do something to a block based on one of these cursors, you clear the bit in the > // corresponding bitvector and leave the cursor where it was. > size_t m_emptyCursor { 0 }; > size_t m_unsweptCursor { 0 }; // Points to the next block that is a candidate for incremental sweeping. > >- unsigned m_cellSize; >- CellAttributes m_attributes; > // FIXME: All of these should probably be references. > // https://bugs.webkit.org/show_bug.cgi?id=166988 > Heap* m_heap { nullptr }; >@@ -194,7 +196,6 @@ class BlockDirectory { > BlockDirectory* m_nextDirectoryInSubspace { nullptr }; > BlockDirectory* m_nextDirectoryInAlignedMemoryAllocator { nullptr }; > >- Lock m_localAllocatorsLock; > SentinelLinkedList<LocalAllocator, BasicRawSentinelNode<LocalAllocator>> m_localAllocators; > }; > >diff --git a/Source/JavaScriptCore/heap/CollectionScope.h b/Source/JavaScriptCore/heap/CollectionScope.h >index 9b4f48703fe87fb22f1881c46a21a33db77d296a..590924cd5c2c3ef4d3acdc49a8a2896f1f2fe283 100644 >--- a/Source/JavaScriptCore/heap/CollectionScope.h >+++ b/Source/JavaScriptCore/heap/CollectionScope.h >@@ -27,7 +27,7 @@ > > namespace JSC { > >-enum class CollectionScope { Eden, Full }; >+enum class CollectionScope : uint8_t { Eden, Full }; > > const char* collectionScopeName(CollectionScope); > >diff --git a/Source/JavaScriptCore/heap/CompleteSubspace.cpp b/Source/JavaScriptCore/heap/CompleteSubspace.cpp >index bd4b81bfdd2f15ffc1bfa570ee41629b3e3764d2..cd4ebafc72f0234253814d4e82223b8d79aabe96 100644 >--- a/Source/JavaScriptCore/heap/CompleteSubspace.cpp >+++ b/Source/JavaScriptCore/heap/CompleteSubspace.cpp >@@ -77,7 +77,7 @@ Allocator CompleteSubspace::allocatorForSlow(size_t size) > return allocator; > > if (false) >- dataLog("Creating BlockDirectory/LocalAllocator for ", m_name, ", ", m_attributes, ", ", sizeClass, ".\n"); >+ dataLog("Creating BlockDirectory/LocalAllocator for ", m_name, ", ", attributes(), ", ", sizeClass, ".\n"); > > std::unique_ptr<BlockDirectory> uniqueDirectory = > std::make_unique<BlockDirectory>(m_space.heap(), sizeClass); >diff --git a/Source/JavaScriptCore/heap/FreeList.h b/Source/JavaScriptCore/heap/FreeList.h >index e3ecfb875b8fd5f6a6a8c0eb8eb74ab193365c76..d4ab8b7f319da3df96a6d9b2cfd0a281e78b1918 100644 >--- a/Source/JavaScriptCore/heap/FreeList.h >+++ b/Source/JavaScriptCore/heap/FreeList.h >@@ -84,8 +84,11 @@ class FreeList { > static ptrdiff_t offsetOfPayloadEnd() { return OBJECT_OFFSETOF(FreeList, m_payloadEnd); } > static ptrdiff_t offsetOfRemaining() { return OBJECT_OFFSETOF(FreeList, m_remaining); } > static ptrdiff_t offsetOfOriginalSize() { return OBJECT_OFFSETOF(FreeList, m_originalSize); } >+ static ptrdiff_t offsetOfCellSize() { return OBJECT_OFFSETOF(FreeList, m_cellSize); } > > void dump(PrintStream&) const; >+ >+ unsigned cellSize() const { return m_cellSize; } > > private: > FreeCell* head() const { return FreeCell::descramble(m_scrambledHead, m_secret); } >diff --git a/Source/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp >index 5b71f08138d77fa00c5814d8d9cc767172962e59..d1667037ac5cdc9ab128613822e87dee3020f307 100644 >--- a/Source/JavaScriptCore/heap/Heap.cpp >+++ b/Source/JavaScriptCore/heap/Heap.cpp >@@ -274,20 +274,9 @@ Heap::Heap(VM* vm, HeapType heapType) > : m_heapType(heapType) > , m_ramSize(Options::forceRAMSize() ? Options::forceRAMSize() : ramSize()) > , m_minBytesPerCycle(minHeapSize(m_heapType, m_ramSize)) >- , m_sizeAfterLastCollect(0) >- , m_sizeAfterLastFullCollect(0) >- , m_sizeBeforeLastFullCollect(0) >- , m_sizeAfterLastEdenCollect(0) >- , m_sizeBeforeLastEdenCollect(0) >- , m_bytesAllocatedThisCycle(0) >- , m_bytesAbandonedSinceLastFullCollect(0) > , m_maxEdenSize(m_minBytesPerCycle) > , m_maxHeapSize(m_minBytesPerCycle) >- , m_shouldDoFullCollection(false) >- , m_totalBytesVisited(0) > , m_objectSpace(this) >- , m_extraMemorySize(0) >- , m_deprecatedExtraMemorySize(0) > , m_machineThreads(std::make_unique<MachineThreads>()) > , m_collectorSlotVisitor(std::make_unique<SlotVisitor>(*this, "C")) > , m_mutatorSlotVisitor(std::make_unique<SlotVisitor>(*this, "M")) >@@ -297,20 +286,13 @@ Heap::Heap(VM* vm, HeapType heapType) > , m_handleSet(vm) > , m_codeBlocks(std::make_unique<CodeBlockSet>()) > , m_jitStubRoutines(std::make_unique<JITStubRoutineSet>()) >- , m_isSafeToCollect(false) > , m_vm(vm) > // We seed with 10ms so that GCActivityCallback::didAllocate doesn't continuously > // schedule the timer if we've never done a collection. >- , m_lastFullGCLength(0.01) >- , m_lastEdenGCLength(0.01) > , m_fullActivityCallback(GCActivityCallback::tryCreateFullTimer(this)) > , m_edenActivityCallback(GCActivityCallback::tryCreateEdenTimer(this)) > , m_sweeper(adoptRef(*new IncrementalSweeper(this))) > , m_stopIfNecessaryTimer(adoptRef(*new StopIfNecessaryTimer(vm))) >- , m_deferralDepth(0) >-#if USE(FOUNDATION) >- , m_delayedReleaseRecursionCount(0) >-#endif > , m_sharedCollectorMarkStack(std::make_unique<MarkStackArray>()) > , m_sharedMutatorMarkStack(std::make_unique<MarkStackArray>()) > , m_helperClient(&heapHelperPool()) >@@ -767,7 +749,7 @@ void Heap::removeDeadHeapSnapshotNodes(HeapProfiler& heapProfiler) > > void Heap::updateObjectCounts() > { >- if (m_collectionScope == CollectionScope::Full) >+ if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) > m_totalBytesVisited = 0; > > m_totalBytesVisitedThisCycle = bytesVisited(); >@@ -963,7 +945,7 @@ void Heap::addToRememberedSet(const JSCell* constCell) > // path. So, we don't have to remember this object. We could return here. But we go > // further and attempt to re-white the object. > >- RELEASE_ASSERT(m_collectionScope == CollectionScope::Full); >+ RELEASE_ASSERT(m_collectionScope && m_collectionScope.value() == CollectionScope::Full); > > if (cell->atomicCompareExchangeCellStateStrong(CellState::PossiblyBlack, CellState::DefinitelyWhite) == CellState::PossiblyBlack) { > // Now we protect against this race: >@@ -1234,7 +1216,7 @@ NEVER_INLINE bool Heap::runBeginPhase(GCConductor conn) > > prepareForMarking(); > >- if (m_collectionScope == CollectionScope::Full) { >+ if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) { > m_opaqueRoots.clear(); > m_collectorSlotVisitor->clearMarkStacks(); > m_mutatorMarkStack->clear(); >@@ -2127,7 +2109,7 @@ void Heap::willStartCollection() > if (false) > dataLog("Eden collection!\n"); > } >- if (m_collectionScope == CollectionScope::Full) { >+ if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) { > m_sizeBeforeLastFullCollect = m_sizeAfterLastCollect + m_bytesAllocatedThisCycle; > m_extraMemorySize = 0; > m_deprecatedExtraMemorySize = 0; >@@ -2138,7 +2120,7 @@ void Heap::willStartCollection() > if (m_fullActivityCallback) > m_fullActivityCallback->willCollect(); > } else { >- ASSERT(m_collectionScope == CollectionScope::Eden); >+ ASSERT(m_collectionScope && m_collectionScope.value() == CollectionScope::Eden); > m_sizeBeforeLastEdenCollect = m_sizeAfterLastCollect + m_bytesAllocatedThisCycle; > } > >@@ -2161,7 +2143,7 @@ void Heap::reapWeakHandles() > > void Heap::pruneStaleEntriesFromWeakGCMaps() > { >- if (m_collectionScope != CollectionScope::Full) >+ if (!m_collectionScope || m_collectionScope.value() != CollectionScope::Full) > return; > for (WeakGCMapBase* weakGCMap : m_weakGCMaps) > weakGCMap->pruneStaleEntries(); >@@ -2180,13 +2162,13 @@ void Heap::snapshotUnswept() > > void Heap::deleteSourceProviderCaches() > { >- if (*m_lastCollectionScope == CollectionScope::Full) >+ if (m_lastCollectionScope && m_lastCollectionScope.value() == CollectionScope::Full) > m_vm->clearSourceProviderCaches(); > } > > void Heap::notifyIncrementalSweeper() > { >- if (m_collectionScope == CollectionScope::Full) { >+ if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) { > if (!m_logicallyEmptyWeakBlocks.isEmpty()) > m_indexOfNextLogicallyEmptyWeakBlockToSweep = 0; > } >@@ -2231,7 +2213,7 @@ void Heap::updateAllocationLimits() > if (verbose) > dataLog("extraMemorySize() = ", extraMemorySize(), ", currentHeapSize = ", currentHeapSize, "\n"); > >- if (m_collectionScope == CollectionScope::Full) { >+ if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) { > // To avoid pathological GC churn in very small and very large heaps, we set > // the new allocation limit based on the current size of the heap, with a > // fixed minimum. >diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h >index af0f004c1e698ab5b790365dc82e78fe7d090e74..a5fb244a238ea0e62d36ee4f3db40904a90b2748 100644 >--- a/Source/JavaScriptCore/heap/Heap.h >+++ b/Source/JavaScriptCore/heap/Heap.h >@@ -44,6 +44,7 @@ > #include <wtf/Deque.h> > #include <wtf/HashCountedSet.h> > #include <wtf/HashSet.h> >+#include <wtf/Markable.h> > #include <wtf/ParallelHelperPool.h> > #include <wtf/Threading.h> > >@@ -558,32 +559,34 @@ class Heap { > static bool shouldSweepSynchronously(); > > const HeapType m_heapType; >+ MutatorState m_mutatorState { MutatorState::Running }; > const size_t m_ramSize; > const size_t m_minBytesPerCycle; >- size_t m_sizeAfterLastCollect; >- size_t m_sizeAfterLastFullCollect; >- size_t m_sizeBeforeLastFullCollect; >- size_t m_sizeAfterLastEdenCollect; >- size_t m_sizeBeforeLastEdenCollect; >- >- size_t m_bytesAllocatedThisCycle; >- size_t m_bytesAbandonedSinceLastFullCollect; >+ size_t m_sizeAfterLastCollect { 0 }; >+ size_t m_sizeAfterLastFullCollect { 0 }; >+ size_t m_sizeBeforeLastFullCollect { 0 }; >+ size_t m_sizeAfterLastEdenCollect { 0 }; >+ size_t m_sizeBeforeLastEdenCollect { 0 }; >+ >+ size_t m_bytesAllocatedThisCycle { 0 }; >+ size_t m_bytesAbandonedSinceLastFullCollect { 0 }; > size_t m_maxEdenSize; > size_t m_maxEdenSizeWhenCritical; > size_t m_maxHeapSize; >- bool m_shouldDoFullCollection; >- size_t m_totalBytesVisited; >- size_t m_totalBytesVisitedThisCycle; >+ size_t m_totalBytesVisited { 0 }; >+ size_t m_totalBytesVisitedThisCycle { 0 }; > double m_incrementBalance { 0 }; > >- Optional<CollectionScope> m_collectionScope; >- Optional<CollectionScope> m_lastCollectionScope; >- MutatorState m_mutatorState { MutatorState::Running }; >+ bool m_shouldDoFullCollection { false }; >+ Markable<CollectionScope, EnumMarkableTraits<CollectionScope>> m_collectionScope; >+ Markable<CollectionScope, EnumMarkableTraits<CollectionScope>> m_lastCollectionScope; >+ Lock m_raceMarkStackLock; >+ > StructureIDTable m_structureIDTable; > MarkedSpace m_objectSpace; > GCIncomingRefCountedSet<ArrayBuffer> m_arrayBuffers; >- size_t m_extraMemorySize; >- size_t m_deprecatedExtraMemorySize; >+ size_t m_extraMemorySize { 0 }; >+ size_t m_deprecatedExtraMemorySize { 0 }; > > HashSet<const JSCell*> m_copyingRememberedSet; > >@@ -595,10 +598,7 @@ class Heap { > std::unique_ptr<SlotVisitor> m_collectorSlotVisitor; > std::unique_ptr<SlotVisitor> m_mutatorSlotVisitor; > std::unique_ptr<MarkStackArray> m_mutatorMarkStack; >- >- Lock m_raceMarkStackLock; > std::unique_ptr<MarkStackArray> m_raceMarkStack; >- > std::unique_ptr<MarkingConstraintSet> m_constraintSet; > > // We pool the slot visitors used by parallel marking threads. It's useful to be able to >@@ -607,22 +607,22 @@ class Heap { > // them at the end. > Vector<std::unique_ptr<SlotVisitor>> m_parallelSlotVisitors; > Vector<SlotVisitor*> m_availableParallelSlotVisitors; >- Lock m_parallelSlotVisitorLock; > > HandleSet m_handleSet; > std::unique_ptr<CodeBlockSet> m_codeBlocks; > std::unique_ptr<JITStubRoutineSet> m_jitStubRoutines; > FinalizerOwner m_finalizerOwner; > >- bool m_isSafeToCollect; >+ Lock m_parallelSlotVisitorLock; >+ bool m_isSafeToCollect { false }; > bool m_isShuttingDown { false }; >- > bool m_mutatorShouldBeFenced { Options::forceFencedBarrier() }; >+ > unsigned m_barrierThreshold { Options::forceFencedBarrier() ? tautologicalThreshold : blackThreshold }; > > VM* m_vm; >- Seconds m_lastFullGCLength; >- Seconds m_lastEdenGCLength; >+ Seconds m_lastFullGCLength { 10_ms }; >+ Seconds m_lastEdenGCLength { 10_ms }; > > Vector<WeakBlock*> m_logicallyEmptyWeakBlocks; > size_t m_indexOfNextLogicallyEmptyWeakBlockToSweep { WTF::notFound }; >@@ -636,34 +636,26 @@ class Heap { > > Vector<HeapFinalizerCallback> m_heapFinalizerCallbacks; > >- unsigned m_deferralDepth; >- bool m_didDeferGCWork { false }; >- > std::unique_ptr<HeapVerifier> m_verifier; > > #if USE(FOUNDATION) > Vector<RetainPtr<CFTypeRef>> m_delayedReleaseObjects; >- unsigned m_delayedReleaseRecursionCount; >+ unsigned m_delayedReleaseRecursionCount { 0 }; > #endif > #if USE(GLIB) > Vector<std::unique_ptr<JSCGLibWrapperObject>> m_delayedReleaseObjects; > unsigned m_delayedReleaseRecursionCount { 0 }; > #endif >+ unsigned m_deferralDepth { 0 }; > > HashSet<WeakGCMapBase*> m_weakGCMaps; > >- Lock m_visitRaceLock; >- >- Lock m_markingMutex; >- Condition m_markingConditionVariable; > std::unique_ptr<MarkStackArray> m_sharedCollectorMarkStack; > std::unique_ptr<MarkStackArray> m_sharedMutatorMarkStack; > unsigned m_numberOfActiveParallelMarkers { 0 }; > unsigned m_numberOfWaitingParallelMarkers { 0 }; >- bool m_parallelMarkersShouldExit { false }; > > ConcurrentPtrHashSet m_opaqueRoots; >- > static const size_t s_blockFragmentLength = 32; > > ParallelHelperClient m_helperClient; >@@ -684,6 +676,10 @@ class Heap { > static const unsigned mutatorWaitingBit = 1u << 5u; // Allows the mutator to use this as a condition variable. > Atomic<unsigned> m_worldState; > bool m_worldIsStopped { false }; >+ Lock m_visitRaceLock; >+ Lock m_markingMutex; >+ Condition m_markingConditionVariable; >+ > MonotonicTime m_beforeGC; > MonotonicTime m_afterGC; > MonotonicTime m_stopTime; >@@ -692,26 +688,22 @@ class Heap { > GCRequest m_currentRequest; > Ticket m_lastServedTicket { 0 }; > Ticket m_lastGrantedTicket { 0 }; >+ > CollectorPhase m_lastPhase { CollectorPhase::NotRunning }; > CollectorPhase m_currentPhase { CollectorPhase::NotRunning }; > CollectorPhase m_nextPhase { CollectorPhase::NotRunning }; > bool m_threadShouldStop { false }; > bool m_threadIsStopping { false }; > bool m_mutatorDidRun { true }; >+ bool m_didDeferGCWork { false }; >+ bool m_shouldStopCollectingContinuously { false }; >+ > uint64_t m_mutatorExecutionVersion { 0 }; > uint64_t m_phaseVersion { 0 }; > Box<Lock> m_threadLock; > Ref<AutomaticThreadCondition> m_threadCondition; // The mutator must not wait on this. It would cause a deadlock. > RefPtr<AutomaticThread> m_thread; > >-#if PLATFORM(IOS_FAMILY) >- unsigned m_precentAvailableMemoryCachedCallCount; >- bool m_overCriticalMemoryThreshold; >-#endif >- >- Lock m_collectContinuouslyLock; >- Condition m_collectContinuouslyCondition; >- bool m_shouldStopCollectingContinuously { false }; > RefPtr<WTF::Thread> m_collectContinuouslyThread { nullptr }; > > MonotonicTime m_lastGCStartTime; >@@ -723,6 +715,15 @@ class Heap { > > CurrentThreadState* m_currentThreadState { nullptr }; > WTF::Thread* m_currentThread { nullptr }; // It's OK if this becomes a dangling pointer. >+ >+#if PLATFORM(IOS_FAMILY) >+ unsigned m_precentAvailableMemoryCachedCallCount; >+ bool m_overCriticalMemoryThreshold; >+#endif >+ >+ bool m_parallelMarkersShouldExit { false }; >+ Lock m_collectContinuouslyLock; >+ Condition m_collectContinuouslyCondition; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/heap/IsoAlignedMemoryAllocator.h b/Source/JavaScriptCore/heap/IsoAlignedMemoryAllocator.h >index 09073b946f080d39a6f7128a49a2e7674dae5cf1..336e9b8ca86b9db94fd7cc581ddc0889c2719226 100644 >--- a/Source/JavaScriptCore/heap/IsoAlignedMemoryAllocator.h >+++ b/Source/JavaScriptCore/heap/IsoAlignedMemoryAllocator.h >@@ -40,11 +40,11 @@ class IsoAlignedMemoryAllocator : public AlignedMemoryAllocator { > void dump(PrintStream&) const override; > > private: >- Lock m_lock; > Vector<void*> m_blocks; > HashMap<void*, unsigned> m_blockIndices; > FastBitVector m_committed; > unsigned m_firstUncommitted { 0 }; >+ Lock m_lock; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/heap/LargeAllocation.cpp b/Source/JavaScriptCore/heap/LargeAllocation.cpp >index dfbf6acd05c94b7f9be8461876aea9353db6b624..40ece3dc0ec0d5ad6c37a6106684e3987cc904be 100644 >--- a/Source/JavaScriptCore/heap/LargeAllocation.cpp >+++ b/Source/JavaScriptCore/heap/LargeAllocation.cpp >@@ -30,6 +30,7 @@ > #include "Heap.h" > #include "JSCInlines.h" > #include "Operations.h" >+#include "SubspaceInlines.h" > > namespace JSC { > >diff --git a/Source/JavaScriptCore/heap/LocalAllocator.cpp b/Source/JavaScriptCore/heap/LocalAllocator.cpp >index bfc749f46a4acb161b80c374a8c8967a9a454e4d..ee7c78208351ae962e0b4fd9ae30145d4d1c553d 100644 >--- a/Source/JavaScriptCore/heap/LocalAllocator.cpp >+++ b/Source/JavaScriptCore/heap/LocalAllocator.cpp >@@ -34,8 +34,7 @@ namespace JSC { > > LocalAllocator::LocalAllocator(BlockDirectory* directory) > : m_directory(directory) >- , m_cellSize(directory->m_cellSize) >- , m_freeList(m_cellSize) >+ , m_freeList(directory->m_cellSize) > { > auto locker = holdLock(directory->m_localAllocatorsLock); > directory->m_localAllocators.append(this); >diff --git a/Source/JavaScriptCore/heap/LocalAllocator.h b/Source/JavaScriptCore/heap/LocalAllocator.h >index 9d8f5a4cef03ecf7c8ff145a4f419ef8fa486294..dfa66c38009986010d6fa7ad762cd9c857fd4383 100644 >--- a/Source/JavaScriptCore/heap/LocalAllocator.h >+++ b/Source/JavaScriptCore/heap/LocalAllocator.h >@@ -43,7 +43,7 @@ class LocalAllocator : public BasicRawSentinelNode<LocalAllocator> { > > void* allocate(GCDeferralContext*, AllocationFailureMode); > >- unsigned cellSize() const { return m_cellSize; } >+ unsigned cellSize() const { return m_freeList.cellSize(); } > > void stopAllocating(); > void prepareForAllocation(); >@@ -67,8 +67,8 @@ class LocalAllocator : public BasicRawSentinelNode<LocalAllocator> { > ALWAYS_INLINE void doTestCollectionsIfNeeded(GCDeferralContext*); > > BlockDirectory* m_directory; >- unsigned m_cellSize; > FreeList m_freeList; >+ > MarkedBlock::Handle* m_currentBlock { nullptr }; > MarkedBlock::Handle* m_lastActiveBlock { nullptr }; > >@@ -84,7 +84,7 @@ inline ptrdiff_t LocalAllocator::offsetOfFreeList() > > inline ptrdiff_t LocalAllocator::offsetOfCellSize() > { >- return OBJECT_OFFSETOF(LocalAllocator, m_cellSize); >+ return OBJECT_OFFSETOF(LocalAllocator, m_freeList) + FreeList::offsetOfCellSize(); > } > > } // namespace JSC >diff --git a/Source/JavaScriptCore/heap/MarkedSpace.cpp b/Source/JavaScriptCore/heap/MarkedSpace.cpp >index e3872a73cd78d246cfd4958a07d0c43a8412a7ca..ec89a025370ff8ab7bb88e3d006b48de6179a2bd 100644 >--- a/Source/JavaScriptCore/heap/MarkedSpace.cpp >+++ b/Source/JavaScriptCore/heap/MarkedSpace.cpp >@@ -197,8 +197,6 @@ void MarkedSpace::initializeSizeClassForStepSize() > > MarkedSpace::MarkedSpace(Heap* heap) > : m_heap(heap) >- , m_capacity(0) >- , m_isIterating(false) > { > initializeSizeClassForStepSize(); > } >diff --git a/Source/JavaScriptCore/heap/MarkedSpace.h b/Source/JavaScriptCore/heap/MarkedSpace.h >index 0d769817aee578814b3fc9eea7d38714be386bac..698f1c7a473ac25c69615a0917c105b528e32e90 100644 >--- a/Source/JavaScriptCore/heap/MarkedSpace.h >+++ b/Source/JavaScriptCore/heap/MarkedSpace.h >@@ -201,22 +201,22 @@ class MarkedSpace { > unsigned m_largeAllocationsNurseryOffset { 0 }; > unsigned m_largeAllocationsOffsetForThisCollection { 0 }; > unsigned m_largeAllocationsNurseryOffsetForSweep { 0 }; >+ unsigned m_largeAllocationsForThisCollectionSize { 0 }; > LargeAllocation** m_largeAllocationsForThisCollectionBegin { nullptr }; > LargeAllocation** m_largeAllocationsForThisCollectionEnd { nullptr }; >- unsigned m_largeAllocationsForThisCollectionSize { 0 }; > > Heap* m_heap; >+ size_t m_capacity { 0 }; > HeapVersion m_markingVersion { initialVersion }; > HeapVersion m_newlyAllocatedVersion { initialVersion }; >- size_t m_capacity; >- bool m_isIterating; >+ bool m_isIterating { false }; > bool m_isMarking { false }; >+ Lock m_directoryLock; > MarkedBlockSet m_blocks; > > SentinelLinkedList<WeakSet, BasicRawSentinelNode<WeakSet>> m_activeWeakSets; > SentinelLinkedList<WeakSet, BasicRawSentinelNode<WeakSet>> m_newActiveWeakSets; > >- Lock m_directoryLock; > SinglyLinkedListWithTail<BlockDirectory> m_directories; > > friend class HeapVerifier; >diff --git a/Source/JavaScriptCore/heap/MarkingConstraint.h b/Source/JavaScriptCore/heap/MarkingConstraint.h >index 5f0effe33207cfbdc64ee3c044eb0cd7e5cf23ca..8df4e97eca8582834268685da05afba38d02d082 100644 >--- a/Source/JavaScriptCore/heap/MarkingConstraint.h >+++ b/Source/JavaScriptCore/heap/MarkingConstraint.h >@@ -82,13 +82,13 @@ class MarkingConstraint { > private: > friend class MarkingConstraintSet; // So it can set m_index. > >- unsigned m_index { UINT_MAX }; > CString m_abbreviatedName; > CString m_name; >+ size_t m_lastVisitCount { 0 }; >+ unsigned m_index { UINT_MAX }; > ConstraintVolatility m_volatility; > ConstraintConcurrency m_concurrency; > ConstraintParallelism m_parallelism; >- size_t m_lastVisitCount { 0 }; > Lock m_lock; > }; > >diff --git a/Source/JavaScriptCore/heap/Subspace.cpp b/Source/JavaScriptCore/heap/Subspace.cpp >index e14a3749227f746760aa8a409404af2d440eb17a..b87052c65e2091f2ddb279cfa49f2fc72abbaac0 100644 >--- a/Source/JavaScriptCore/heap/Subspace.cpp >+++ b/Source/JavaScriptCore/heap/Subspace.cpp >@@ -45,7 +45,6 @@ Subspace::Subspace(CString name, Heap& heap) > > void Subspace::initialize(HeapCellType* heapCellType, AlignedMemoryAllocator* alignedMemoryAllocator) > { >- m_attributes = heapCellType->attributes(); > m_heapCellType = heapCellType; > m_alignedMemoryAllocator = alignedMemoryAllocator; > m_directoryForEmptyAllocation = m_alignedMemoryAllocator->firstDirectory(); >diff --git a/Source/JavaScriptCore/heap/Subspace.h b/Source/JavaScriptCore/heap/Subspace.h >index 83ef4d749fbc8678675c9234804773db18cac9a6..c327199e5ca121a9705189e5cfc542ca946040a5 100644 >--- a/Source/JavaScriptCore/heap/Subspace.h >+++ b/Source/JavaScriptCore/heap/Subspace.h >@@ -50,7 +50,7 @@ class Subspace { > const char* name() const { return m_name.data(); } > MarkedSpace& space() const { return m_space; } > >- const CellAttributes& attributes() const { return m_attributes; } >+ const CellAttributes& attributes() const; > HeapCellType* heapCellType() const { return m_heapCellType; } > AlignedMemoryAllocator* alignedMemoryAllocator() const { return m_alignedMemoryAllocator; } > >@@ -106,9 +106,6 @@ class Subspace { > > MarkedSpace& m_space; > >- CString m_name; >- CellAttributes m_attributes; >- > HeapCellType* m_heapCellType { nullptr }; > AlignedMemoryAllocator* m_alignedMemoryAllocator { nullptr }; > >@@ -116,6 +113,8 @@ class Subspace { > BlockDirectory* m_directoryForEmptyAllocation { nullptr }; // Uses the MarkedSpace linked list of blocks. > SentinelLinkedList<LargeAllocation, BasicRawSentinelNode<LargeAllocation>> m_largeAllocations; > Subspace* m_nextSubspaceInAlignedMemoryAllocator { nullptr }; >+ >+ CString m_name; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/heap/SubspaceInlines.h b/Source/JavaScriptCore/heap/SubspaceInlines.h >index 167127ff43843eb614e0b1a6cf7693a50a7bacb8..20b41bb7a722a7d8760310602d33c367f99635bd 100644 >--- a/Source/JavaScriptCore/heap/SubspaceInlines.h >+++ b/Source/JavaScriptCore/heap/SubspaceInlines.h >@@ -26,6 +26,7 @@ > #pragma once > > #include "BlockDirectoryInlines.h" >+#include "HeapCellType.h" > #include "JSCast.h" > #include "MarkedBlock.h" > #include "MarkedSpace.h" >@@ -76,10 +77,11 @@ void Subspace::forEachMarkedCell(const Func& func) > return IterationStatus::Continue; > }); > }); >+ CellAttributes attributes = this->attributes(); > forEachLargeAllocation( > [&] (LargeAllocation* allocation) { > if (allocation->isMarked()) >- func(allocation->cell(), m_attributes.cellKind); >+ func(allocation->cell(), attributes.cellKind); > }); > } > >@@ -112,10 +114,11 @@ Ref<SharedTask<void(SlotVisitor&)>> Subspace::forEachMarkedCellInParallel(const > m_needToVisitLargeAllocations = false; > } > >+ CellAttributes attributes = m_subspace.attributes(); > m_subspace.forEachLargeAllocation( > [&] (LargeAllocation* allocation) { > if (allocation->isMarked()) >- m_func(visitor, allocation->cell(), m_subspace.m_attributes.cellKind); >+ m_func(visitor, allocation->cell(), attributes.cellKind); > }); > } > >@@ -141,12 +144,18 @@ void Subspace::forEachLiveCell(const Func& func) > return IterationStatus::Continue; > }); > }); >+ CellAttributes attributes = this->attributes(); > forEachLargeAllocation( > [&] (LargeAllocation* allocation) { > if (allocation->isLive()) >- func(allocation->cell(), m_attributes.cellKind); >+ func(allocation->cell(), attributes.cellKind); > }); > } > >+inline const CellAttributes& Subspace::attributes() const >+{ >+ return m_heapCellType->attributes(); >+} >+ > } // namespace JSC >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
saam
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193612
: 359603