Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
https://bugs.webkit.org/show_bug.cgi?id=140900
Reviewed by Mark Hahnenberg.
Source/JavaScriptCore:
Removes some more custom allocation code.
Looks like a speedup. (See results attached to bugzilla.)
Will hopefully reduce memory use by improving sharing between the GC and
malloc heaps.
- heap/BlockAllocator.cpp: Removed.
- heap/BlockAllocator.h: Removed. No need for a custom allocator anymore.
(JSC::CodeBlockSet::CodeBlockSet):
- heap/CodeBlockSet.h: Feed the compiler.
(JSC::CopiedBlock::createNoZeroFill):
(JSC::CopiedBlock::create):
(JSC::CopiedBlock::CopiedBlock):
(JSC::CopiedBlock::isOversize):
(JSC::CopiedBlock::payloadEnd):
(JSC::CopiedBlock::capacity):
- heap/CopiedBlockInlines.h:
(JSC::CopiedBlock::reportLiveBytes): Each copied block now tracks its
own size, since we can't rely on Region to tell us our size anymore.
(JSC::CopiedSpace::~CopiedSpace):
(JSC::CopiedSpace::tryAllocateOversize):
(JSC::CopiedSpace::tryReallocateOversize):
- heap/CopiedSpaceInlines.h:
(JSC::CopiedSpace::recycleEvacuatedBlock):
(JSC::CopiedSpace::recycleBorrowedBlock):
(JSC::CopiedSpace::allocateBlockForCopyingPhase):
(JSC::CopiedSpace::allocateBlock):
(JSC::CopiedSpace::startedCopying): Deallocate blocks directly, rather
than pushing them onto the block allocator's free list; the block
allocator doesn't exist anymore.
(JSC::CopyWorkListSegment::create):
(JSC::CopyWorkListSegment::CopyWorkListSegment):
(JSC::CopyWorkList::~CopyWorkList):
(JSC::CopyWorkList::append):
(JSC::CopyWorkList::CopyWorkList): Deleted.
(JSC::GCArraySegment::GCArraySegment):
- heap/GCSegmentedArrayInlines.h:
(JSC::GCSegmentedArray<T>::GCSegmentedArray):
(JSC::GCSegmentedArray<T>::~GCSegmentedArray):
(JSC::GCSegmentedArray<T>::clear):
(JSC::GCSegmentedArray<T>::expand):
(JSC::GCSegmentedArray<T>::refill):
(JSC::GCArraySegment<T>::create):
- heap/GCThreadSharedData.cpp:
(JSC::GCThreadSharedData::GCThreadSharedData):
- heap/GCThreadSharedData.h: Feed the compiler.
- heap/HandleBlock.h:
- heap/HandleBlockInlines.h:
(JSC::HandleBlock::create):
(JSC::HandleBlock::HandleBlock):
(JSC::HandleBlock::payloadEnd):
(JSC::HandleSet::~HandleSet):
(JSC::HandleSet::grow): Same as above.
(JSC::Heap::Heap):
- heap/Heap.h: Removed the block allocator since it is unused now.
(JSC::HeapBlock::destroy):
(JSC::HeapBlock::HeapBlock):
(JSC::HeapBlock::region): Deleted. Removed the Region pointer from each
HeapBlock since a HeapBlock is just a normal allocation now.
(JSC::Heap::blockAllocator): Deleted.
- heap/HeapTimer.cpp:
- heap/MarkStack.cpp:
(JSC::MarkStackArray::MarkStackArray):
- heap/MarkStack.h: Feed the compiler.
- heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::allocateBlock): No need to use a custom code path
based on size, since we use a general purpose allocator now.
(JSC::MarkedBlock::create):
(JSC::MarkedBlock::destroy):
(JSC::MarkedBlock::MarkedBlock):
(JSC::MarkedBlock::capacity): Track block size explicitly, like CopiedBlock.
(JSC::MarkedSpace::freeBlock):
(JSC::SlotVisitor::SlotVisitor): Removed reference to block allocator.
- heap/SuperRegion.cpp: Removed.
- heap/SuperRegion.h: Removed.
(JSC::WeakBlock::create):
(JSC::WeakBlock::WeakBlock):
- heap/WeakBlock.h:
- heap/WeakSet.cpp:
(JSC::WeakSet::~WeakSet):
(JSC::WeakSet::addAllocator):
(JSC::WeakSet::removeAllocator): Removed reference to block allocator.
Source/WebCore:
- platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::install): Be sure to release other
memory after GC and not before, since GC might contribute to free
malloc pages now.
Source/WTF:
New interface for aligned allocation: fastAlignedMalloc / fastAlignedFree.
We require a special function call on free because Windows.
(WTF::fastAlignedMalloc):
(WTF::fastAlignedFree): Do it.
(WTF::do_memalign): Un-ifdef this, since we use it now.
- wtf/FastMalloc.h: Make our new function names visible like the rest
of fastMalloc.