haikuwebkit/Source/bmalloc/bmalloc/BAssert.h

126 lines
3.6 KiB
C
Raw Permalink Normal View History

bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
/*
* Copyright (C) 2014-2016 Apple Inc. All rights reserved.
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
*
* 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. ``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
* 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.
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
*/
#pragma once
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
#include "BPlatform.h"
#include "Logging.h"
#if BUSE(OS_LOG)
#include <os/log.h>
#endif
#if defined(NDEBUG) && BOS(DARWIN)
#if BASAN_ENABLED
#define BBreakpointTrap() __builtin_trap()
#elif BCPU(X86_64) || BCPU(X86)
#define BBreakpointTrap() __asm__ volatile ("int3")
#elif BCPU(ARM_THUMB2)
#define BBreakpointTrap() __asm__ volatile ("bkpt #0")
#elif BCPU(ARM64)
#define BBreakpointTrap() __asm__ volatile ("brk #0xc471")
#else
#error "Unsupported CPU".
#endif
// Crash with a SIGTRAP i.e EXC_BREAKPOINT.
// We are not using __builtin_trap because it is only guaranteed to abort, but not necessarily
// trigger a SIGTRAP. Instead, we use inline asm to ensure that we trigger the SIGTRAP.
#define BCRASH() do { \
BBreakpointTrap(); \
__builtin_unreachable(); \
} while (false)
#else // not defined(NDEBUG) && BOS(DARWIN)
#if BASAN_ENABLED
#define BCRASH() __builtin_trap()
#else
#if defined(__GNUC__) // GCC or Clang
#define BCRASH() do { \
*(int*)0xbbadbeef = 0; \
__builtin_trap(); \
} while (0)
#else
#define BCRASH() do { \
*(int*)0xbbadbeef = 0; \
((void(*)())0)(); \
Enable gigacage on iOS https://bugs.webkit.org/show_bug.cgi?id=177586 Reviewed by JF Bastien. JSTests: Add tests for when Gigacage gets runtime disabled. * stress/disable-gigacage-arrays.js: Added. (foo): * stress/disable-gigacage-strings.js: Added. (foo): * stress/disable-gigacage-typed-arrays.js: Added. (foo): Source/bmalloc: Introduce the ability to disable gigacage at runtime if allocation fails. If any step of gigacage allocation fails, we free all of the gigacages and turn off gigacage support. Roll this back in after discussion. * CMakeLists.txt: * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Cache.cpp: (bmalloc::Cache::scavenge): * bmalloc/Cache.h: (bmalloc::Cache::tryAllocate): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): (bmalloc::Cache::reallocate): * bmalloc/Gigacage.cpp: (Gigacage::ensureGigacage): (Gigacage::runway): (Gigacage::totalSize): (Gigacage::shouldBeEnabled): (): Deleted. (Gigacage::Callback::Callback): Deleted. (Gigacage::Callback::function): Deleted. (Gigacage::PrimitiveDisableCallbacks::PrimitiveDisableCallbacks): Deleted. * bmalloc/Gigacage.h: (Gigacage::wasEnabled): (Gigacage::isEnabled): (Gigacage::runway): Deleted. (Gigacage::totalSize): Deleted. * bmalloc/HeapKind.cpp: Added. (bmalloc::isActiveHeapKind): (bmalloc::mapToActiveHeapKind): * bmalloc/HeapKind.h: (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): * bmalloc/Scavenger.cpp: (bmalloc::Scavenger::scavenge): * bmalloc/bmalloc.h: (bmalloc::api::tryLargeMemalignVirtual): (bmalloc::api::freeLargeVirtual): (bmalloc::api::isEnabled): Source/JavaScriptCore: The hardest part of enabling Gigacage on iOS is that it requires loading global variables while executing JS, so the LLInt needs to know how to load from global variables on all platforms that have Gigacage. So, this teaches ARM64 how to load from global variables. Also, this makes the code handle disabling the gigacage a bit better. * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::caged): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::cage): (JSC::AssemblyHelpers::cageConditionally): * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/instructions.rb: Tools: Add a mode to test disabling Gigacage. * Scripts/run-jsc-stress-tests: * Scripts/webkitruby/jsc-stress-test-writer-default.rb: Canonical link: https://commits.webkit.org/194463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 16:02:45 +00:00
} while (0)
#endif // defined(__GNUC__)
#endif // BASAN_ENABLED
#endif // defined(NDEBUG) && BOS(DARWIN)
Made bmalloc more #include friendly https://bugs.webkit.org/show_bug.cgi?id=131386 Reviewed by Andreas Kling. Marked a bunch of headers private so they can be used from client code that #includes bmalloc.h. Renamed ASSERT macros to BASSERT. This matches their header, which already had to be renamed, and fixes conflicts with WTF's ASSERT macros. * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Allocator.cpp: (bmalloc::Allocator::allocateSlowCase): * bmalloc/AsyncTask.h: (bmalloc::Function>::runSlowCase): * bmalloc/BAssert.h: * bmalloc/BoundaryTag.h: (bmalloc::BoundaryTag::setSize): * bmalloc/BoundaryTagInlines.h: (bmalloc::validate): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Chunk.h: * bmalloc/Deallocator.cpp: (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): * bmalloc/Deallocator.h: (bmalloc::Deallocator::deallocateFastCase): * bmalloc/FixedVector.h: (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: (bmalloc::Heap::allocateLarge): * bmalloc/LargeChunk.h: (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: (bmalloc::MediumAllocator::allocate): * bmalloc/ObjectType.h: (bmalloc::isSmall): * bmalloc/Page.h: (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): * bmalloc/PerThread.h: (bmalloc::PerThread<T>::getSlowCase): * bmalloc/SegregatedFreeList.cpp: (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): * bmalloc/SmallAllocator.h: (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::refill): * bmalloc/Syscall.h: * bmalloc/VMAllocate.h: (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocatePhysicalPagesSloppy): * bmalloc/Vector.h: (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): * bmalloc/XLargeChunk.h: (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): Canonical link: https://commits.webkit.org/149441@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 20:36:07 +00:00
#define BASSERT_IMPL(x) do { \
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
if (!(x)) \
BCRASH(); \
Enable gigacage on iOS https://bugs.webkit.org/show_bug.cgi?id=177586 Reviewed by JF Bastien. JSTests: Add tests for when Gigacage gets runtime disabled. * stress/disable-gigacage-arrays.js: Added. (foo): * stress/disable-gigacage-strings.js: Added. (foo): * stress/disable-gigacage-typed-arrays.js: Added. (foo): Source/bmalloc: Introduce the ability to disable gigacage at runtime if allocation fails. If any step of gigacage allocation fails, we free all of the gigacages and turn off gigacage support. Roll this back in after discussion. * CMakeLists.txt: * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Cache.cpp: (bmalloc::Cache::scavenge): * bmalloc/Cache.h: (bmalloc::Cache::tryAllocate): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): (bmalloc::Cache::reallocate): * bmalloc/Gigacage.cpp: (Gigacage::ensureGigacage): (Gigacage::runway): (Gigacage::totalSize): (Gigacage::shouldBeEnabled): (): Deleted. (Gigacage::Callback::Callback): Deleted. (Gigacage::Callback::function): Deleted. (Gigacage::PrimitiveDisableCallbacks::PrimitiveDisableCallbacks): Deleted. * bmalloc/Gigacage.h: (Gigacage::wasEnabled): (Gigacage::isEnabled): (Gigacage::runway): Deleted. (Gigacage::totalSize): Deleted. * bmalloc/HeapKind.cpp: Added. (bmalloc::isActiveHeapKind): (bmalloc::mapToActiveHeapKind): * bmalloc/HeapKind.h: (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): * bmalloc/Scavenger.cpp: (bmalloc::Scavenger::scavenge): * bmalloc/bmalloc.h: (bmalloc::api::tryLargeMemalignVirtual): (bmalloc::api::freeLargeVirtual): (bmalloc::api::isEnabled): Source/JavaScriptCore: The hardest part of enabling Gigacage on iOS is that it requires loading global variables while executing JS, so the LLInt needs to know how to load from global variables on all platforms that have Gigacage. So, this teaches ARM64 how to load from global variables. Also, this makes the code handle disabling the gigacage a bit better. * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::caged): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::cage): (JSC::AssemblyHelpers::cageConditionally): * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/instructions.rb: Tools: Add a mode to test disabling Gigacage. * Scripts/run-jsc-stress-tests: * Scripts/webkitruby/jsc-stress-test-writer-default.rb: Canonical link: https://commits.webkit.org/194463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 16:02:45 +00:00
} while (0)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
Made bmalloc more #include friendly https://bugs.webkit.org/show_bug.cgi?id=131386 Reviewed by Andreas Kling. Marked a bunch of headers private so they can be used from client code that #includes bmalloc.h. Renamed ASSERT macros to BASSERT. This matches their header, which already had to be renamed, and fixes conflicts with WTF's ASSERT macros. * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Allocator.cpp: (bmalloc::Allocator::allocateSlowCase): * bmalloc/AsyncTask.h: (bmalloc::Function>::runSlowCase): * bmalloc/BAssert.h: * bmalloc/BoundaryTag.h: (bmalloc::BoundaryTag::setSize): * bmalloc/BoundaryTagInlines.h: (bmalloc::validate): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Chunk.h: * bmalloc/Deallocator.cpp: (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): * bmalloc/Deallocator.h: (bmalloc::Deallocator::deallocateFastCase): * bmalloc/FixedVector.h: (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: (bmalloc::Heap::allocateLarge): * bmalloc/LargeChunk.h: (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: (bmalloc::MediumAllocator::allocate): * bmalloc/ObjectType.h: (bmalloc::isSmall): * bmalloc/Page.h: (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): * bmalloc/PerThread.h: (bmalloc::PerThread<T>::getSlowCase): * bmalloc/SegregatedFreeList.cpp: (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): * bmalloc/SmallAllocator.h: (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::refill): * bmalloc/Syscall.h: * bmalloc/VMAllocate.h: (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocatePhysicalPagesSloppy): * bmalloc/Vector.h: (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): * bmalloc/XLargeChunk.h: (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): Canonical link: https://commits.webkit.org/149441@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 20:36:07 +00:00
#define RELEASE_BASSERT(x) BASSERT_IMPL(x)
Gigacage disabling checks should handle the GIGACAGE_ALLOCATION_CAN_FAIL case properly. https://bugs.webkit.org/show_bug.cgi?id=193292 <rdar://problem/46485450> Reviewed by Yusuke Suzuki. Source/bmalloc: Previously, when GIGACAGE_ALLOCATION_CAN_FAIL is true, we allow the Gigacage to be disabled if we fail to allocate memory for it. However, Gigacage::primitiveGigacageDisabled() still always assumes that the Gigacage is always enabled after ensureGigacage() is called. This patch updates Gigacage::primitiveGigacageDisabled() to allow the Gigacage to already be disabled if GIGACAGE_ALLOCATION_CAN_FAIL is true and wasEnabled() is false. In this patch, we also put the wasEnabled flag in the 0th slot of the g_gigacageBasePtrs buffer to ensure that it is also protected against writes just like the Gigacage base pointers. To achieve this, we do the following: 1. Added a reservedForFlags field in struct BasePtrs. 2. Added a ReservedForFlagsAndNotABasePtr Gigacage::Kind. 3. Added assertions to ensure that the BasePtrs::primitive is at the offset matching the offset computed from Gigacage::Primitive. Ditto for BasePtrs::jsValue and Gigacage::JSValue. 4. Added assertions to ensure that Gigacage::ReservedForFlagsAndNotABasePtr is not used for fetching a Gigacage base pointer. 5. Added RELEASE_BASSERT_NOT_REACHED() to implement such assertions in bmalloc. No test added because this issue requires Gigacage allocation to fail in order to manifest. I've tested it manually by modifying the code locally to force an allocation failure. * bmalloc/BAssert.h: * bmalloc/Gigacage.cpp: (Gigacage::ensureGigacage): (Gigacage::primitiveGigacageDisabled): * bmalloc/Gigacage.h: (Gigacage::wasEnabled): (Gigacage::setWasEnabled): (Gigacage::name): (Gigacage::basePtr): (Gigacage::size): * bmalloc/HeapKind.h: (bmalloc::heapKind): Source/JavaScriptCore: * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): Source/WTF: Update the USE_SYSTEM_MALLOC version of Gigacage.h to match the bmalloc version. * wtf/Gigacage.h: Canonical link: https://commits.webkit.org/207793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-09 22:45:06 +00:00
#define RELEASE_BASSERT_NOT_REACHED() BCRASH()
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
#if BUSE(OS_LOG)
#define BMALLOC_LOGGING_PREFIX "bmalloc: "
#define BLOG_ERROR(format, ...) os_log_error(OS_LOG_DEFAULT, BMALLOC_LOGGING_PREFIX format, __VA_ARGS__)
#else
#define BLOG_ERROR(format, ...) bmalloc::reportAssertionFailureWithMessage(__FILE__, __LINE__, __PRETTY_FUNCTION__, format, __VA_ARGS__)
#endif
#if defined(NDEBUG)
#define RELEASE_BASSERT_WITH_MESSAGE(x, format, ...) BASSERT_IMPL(x)
#else
#define RELEASE_BASSERT_WITH_MESSAGE(x, format, ...) do { \
if (!(x)) { \
BLOG_ERROR("ASSERTION FAILED: " #x " :: " format, ##__VA_ARGS__); \
BCRASH(); \
} \
Enable gigacage on iOS https://bugs.webkit.org/show_bug.cgi?id=177586 Reviewed by JF Bastien. JSTests: Add tests for when Gigacage gets runtime disabled. * stress/disable-gigacage-arrays.js: Added. (foo): * stress/disable-gigacage-strings.js: Added. (foo): * stress/disable-gigacage-typed-arrays.js: Added. (foo): Source/bmalloc: Introduce the ability to disable gigacage at runtime if allocation fails. If any step of gigacage allocation fails, we free all of the gigacages and turn off gigacage support. Roll this back in after discussion. * CMakeLists.txt: * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Cache.cpp: (bmalloc::Cache::scavenge): * bmalloc/Cache.h: (bmalloc::Cache::tryAllocate): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): (bmalloc::Cache::reallocate): * bmalloc/Gigacage.cpp: (Gigacage::ensureGigacage): (Gigacage::runway): (Gigacage::totalSize): (Gigacage::shouldBeEnabled): (): Deleted. (Gigacage::Callback::Callback): Deleted. (Gigacage::Callback::function): Deleted. (Gigacage::PrimitiveDisableCallbacks::PrimitiveDisableCallbacks): Deleted. * bmalloc/Gigacage.h: (Gigacage::wasEnabled): (Gigacage::isEnabled): (Gigacage::runway): Deleted. (Gigacage::totalSize): Deleted. * bmalloc/HeapKind.cpp: Added. (bmalloc::isActiveHeapKind): (bmalloc::mapToActiveHeapKind): * bmalloc/HeapKind.h: (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): * bmalloc/Scavenger.cpp: (bmalloc::Scavenger::scavenge): * bmalloc/bmalloc.h: (bmalloc::api::tryLargeMemalignVirtual): (bmalloc::api::freeLargeVirtual): (bmalloc::api::isEnabled): Source/JavaScriptCore: The hardest part of enabling Gigacage on iOS is that it requires loading global variables while executing JS, so the LLInt needs to know how to load from global variables on all platforms that have Gigacage. So, this teaches ARM64 how to load from global variables. Also, this makes the code handle disabling the gigacage a bit better. * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::caged): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::cage): (JSC::AssemblyHelpers::cageConditionally): * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/instructions.rb: Tools: Add a mode to test disabling Gigacage. * Scripts/run-jsc-stress-tests: * Scripts/webkitruby/jsc-stress-test-writer-default.rb: Canonical link: https://commits.webkit.org/194463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 16:02:45 +00:00
} while (0)
#endif
#define BUNUSED(x) ((void)x)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
// ===== Release build =====
#if defined(NDEBUG)
Made bmalloc more #include friendly https://bugs.webkit.org/show_bug.cgi?id=131386 Reviewed by Andreas Kling. Marked a bunch of headers private so they can be used from client code that #includes bmalloc.h. Renamed ASSERT macros to BASSERT. This matches their header, which already had to be renamed, and fixes conflicts with WTF's ASSERT macros. * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Allocator.cpp: (bmalloc::Allocator::allocateSlowCase): * bmalloc/AsyncTask.h: (bmalloc::Function>::runSlowCase): * bmalloc/BAssert.h: * bmalloc/BoundaryTag.h: (bmalloc::BoundaryTag::setSize): * bmalloc/BoundaryTagInlines.h: (bmalloc::validate): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Chunk.h: * bmalloc/Deallocator.cpp: (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): * bmalloc/Deallocator.h: (bmalloc::Deallocator::deallocateFastCase): * bmalloc/FixedVector.h: (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: (bmalloc::Heap::allocateLarge): * bmalloc/LargeChunk.h: (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: (bmalloc::MediumAllocator::allocate): * bmalloc/ObjectType.h: (bmalloc::isSmall): * bmalloc/Page.h: (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): * bmalloc/PerThread.h: (bmalloc::PerThread<T>::getSlowCase): * bmalloc/SegregatedFreeList.cpp: (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): * bmalloc/SmallAllocator.h: (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::refill): * bmalloc/Syscall.h: * bmalloc/VMAllocate.h: (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocatePhysicalPagesSloppy): * bmalloc/Vector.h: (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): * bmalloc/XLargeChunk.h: (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): Canonical link: https://commits.webkit.org/149441@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 20:36:07 +00:00
#define BASSERT(x)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
Progress towards CMake on Windows and Mac. https://bugs.webkit.org/show_bug.cgi?id=143293 Reviewed by Filip Pizlo. .: * CMakeLists.txt: Set DERIVED_SOURCES_WTF_DIR for Windows. * Source/CMakeLists.txt: Don't compile bmalloc on Windows. * Source/cmake/OptionsCommon.cmake: Use the absolute path of the C preprocessor. * Source/cmake/OptionsWinCairo.cmake: Added needed definitions. * Source/cmake/OptionsWindows.cmake: Set some default values and removed support for old Visual Studio versions before /MP. * Source/cmake/WebKitFS.cmake: Make WTF DerivedSources directory. * Source/cmake/WebKitMacros.cmake: Added ADD_PRECOMPILED_HEADER macro based on http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake Source/bmalloc: * bmalloc/BAssert.h: Removed ellipses from macros to appease Visual Studio. Source/JavaScriptCore: * CMakeLists.txt: Enabled using assembly on Windows. Replaced unix commands with CMake commands. * PlatformMac.cmake: Tell open source builders where to find unicode headers. Source/ThirdParty/ANGLE: * include/GLES2/gl2.h: Temporarily disabled WebGL on Windows CMake builds. Source/WebCore: * PlatformMac.cmake: Tell open source builders where to find unicode headers. * PlatformWin.cmake: Include PlatformWinCairo.cmake. * PlatformWinCairo.cmake: Added from bug 115944 by Patrick Gansterer. * bindings/js/JSDOMStringListCustom.cpp: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSMessageChannelCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamCustom.cpp: * bindings/js/ReadableStreamJSSource.cpp: * bindings/js/ScriptController.cpp: * css/CSSComputedStyleDeclaration.cpp: * dom/Attr.cpp: * dom/CollectionIndexCache.cpp: * platform/graphics/ANGLEWebKitBridge.h: Fixed include quirks. Source/WebKit: * PlatformMac.cmake: Fixed some include directories. Source/WTF: * wtf/CMakeLists.txt: Don't use bmalloc on Windows yet. * wtf/FeatureDefines.h: Temporarily disabled WebGL on Windows CMake builds. * wtf/PlatformMac.cmake: Tell open source builders where to find unicode headers. Canonical link: https://commits.webkit.org/161340@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-04-01 18:36:43 +00:00
#define IF_DEBUG(x)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
#endif // defined(NDEBUG)
// ===== Debug build =====
#if !defined(NDEBUG)
Made bmalloc more #include friendly https://bugs.webkit.org/show_bug.cgi?id=131386 Reviewed by Andreas Kling. Marked a bunch of headers private so they can be used from client code that #includes bmalloc.h. Renamed ASSERT macros to BASSERT. This matches their header, which already had to be renamed, and fixes conflicts with WTF's ASSERT macros. * bmalloc.xcodeproj/project.pbxproj: * bmalloc/Allocator.cpp: (bmalloc::Allocator::allocateSlowCase): * bmalloc/AsyncTask.h: (bmalloc::Function>::runSlowCase): * bmalloc/BAssert.h: * bmalloc/BoundaryTag.h: (bmalloc::BoundaryTag::setSize): * bmalloc/BoundaryTagInlines.h: (bmalloc::validate): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Chunk.h: * bmalloc/Deallocator.cpp: (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): * bmalloc/Deallocator.h: (bmalloc::Deallocator::deallocateFastCase): * bmalloc/FixedVector.h: (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: (bmalloc::Heap::allocateLarge): * bmalloc/LargeChunk.h: (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: (bmalloc::MediumAllocator::allocate): * bmalloc/ObjectType.h: (bmalloc::isSmall): * bmalloc/Page.h: (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): * bmalloc/PerThread.h: (bmalloc::PerThread<T>::getSlowCase): * bmalloc/SegregatedFreeList.cpp: (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): * bmalloc/SmallAllocator.h: (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::refill): * bmalloc/Syscall.h: * bmalloc/VMAllocate.h: (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocatePhysicalPagesSloppy): * bmalloc/Vector.h: (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): * bmalloc/XLargeChunk.h: (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): Canonical link: https://commits.webkit.org/149441@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 20:36:07 +00:00
#define BASSERT(x) BASSERT_IMPL(x)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
#define IF_DEBUG(x) (x)
bmalloc https://bugs.webkit.org/show_bug.cgi?id=131170 Reviewed by Andreas Kling. Initial commit. * bmalloc: Added. * bmalloc.xcodeproj: Added. * bmalloc.xcodeproj/project.pbxproj: Added. * bmalloc/Algorithm.h: Added. (bmalloc::max): (bmalloc::min): (bmalloc::mask): (bmalloc::test): (bmalloc::roundUpToMultipleOf): (bmalloc::roundDownToMultipleOf): (bmalloc::sizeOf): (bmalloc::bitCount): (bmalloc::isPowerOfTwo): * bmalloc/Allocator.cpp: Added. (bmalloc::Allocator::Allocator): (bmalloc::Allocator::~Allocator): (bmalloc::Allocator::log): (bmalloc::Allocator::processSmallAllocatorLog): (bmalloc::Allocator::processMediumAllocatorLog): (bmalloc::Allocator::allocateLarge): (bmalloc::Allocator::allocateXLarge): (bmalloc::Allocator::allocateMedium): (bmalloc::Allocator::allocateSlowCase): * bmalloc/Allocator.h: Added. (bmalloc::Allocator::smallAllocatorFor): (bmalloc::Allocator::allocateFastCase): (bmalloc::Allocator::allocate): * bmalloc/AsyncTask.cpp: Added. (bmalloc::AsyncTask<Function>::runSlowCase): (bmalloc::AsyncTask<Function>::pthreadEntryPoint): (bmalloc::AsyncTask<Function>::entryPoint): * bmalloc/AsyncTask.h: Added. (bmalloc::Function>::AsyncTask): (bmalloc::Function>::join): (bmalloc::Function>::run): (bmalloc::Function>::runSlowCase): (bmalloc::Function>::pthreadEntryPoint): (bmalloc::Function>::entryPoint): * bmalloc/BAssert.h: Added. * bmalloc/BeginTag.h: Added. (bmalloc::BeginTag::isInFreeList): * bmalloc/BoundaryTag.h: Added. (bmalloc::BoundaryTag::isXLarge): (bmalloc::BoundaryTag::setXLarge): (bmalloc::BoundaryTag::isFree): (bmalloc::BoundaryTag::setFree): (bmalloc::BoundaryTag::isEnd): (bmalloc::BoundaryTag::setEnd): (bmalloc::BoundaryTag::hasPhysicalPages): (bmalloc::BoundaryTag::setHasPhysicalPages): (bmalloc::BoundaryTag::isNull): (bmalloc::BoundaryTag::clear): (bmalloc::BoundaryTag::size): (bmalloc::BoundaryTag::setSize): (bmalloc::BoundaryTag::prev): (bmalloc::BoundaryTag::next): * bmalloc/BoundaryTagInlines.h: Added. (bmalloc::validate): (bmalloc::validatePrev): (bmalloc::validateNext): (bmalloc::BoundaryTag::init): (bmalloc::BoundaryTag::mergeLargeLeft): (bmalloc::BoundaryTag::mergeLargeRight): (bmalloc::BoundaryTag::mergeLarge): (bmalloc::BoundaryTag::deallocate): (bmalloc::BoundaryTag::splitLarge): (bmalloc::BoundaryTag::allocate): * bmalloc/Cache.cpp: Added. (bmalloc::Cache::operator new): (bmalloc::Cache::operator delete): (bmalloc::Cache::Cache): (bmalloc::Cache::allocateSlowCase): (bmalloc::Cache::allocateSlowCaseNullCache): (bmalloc::Cache::deallocateSlowCase): (bmalloc::Cache::deallocateSlowCaseNullCache): * bmalloc/Cache.h: Added. (bmalloc::Cache::allocator): (bmalloc::Cache::deallocator): (bmalloc::Cache::allocateFastCase): (bmalloc::Cache::deallocateFastCase): (bmalloc::Cache::allocate): (bmalloc::Cache::deallocate): * bmalloc/Chunk.h: Added. (bmalloc::Chunk::begin): (bmalloc::Chunk::end): (bmalloc::Chunk::lines): (bmalloc::Chunk::pages): * bmalloc/Deallocator.cpp: Added. (bmalloc::Deallocator::Deallocator): (bmalloc::Deallocator::~Deallocator): (bmalloc::Deallocator::deallocateLarge): (bmalloc::Deallocator::deallocateXLarge): (bmalloc::Deallocator::processObjectLog): (bmalloc::Deallocator::deallocateSlowCase): (bmalloc::Deallocator::deallocateSmallLine): (bmalloc::Deallocator::allocateSmallLine): (bmalloc::Deallocator::deallocateMediumLine): (bmalloc::Deallocator::allocateMediumLine): * bmalloc/Deallocator.h: Added. (bmalloc::Deallocator::deallocateFastCase): (bmalloc::Deallocator::deallocate): * bmalloc/EndTag.h: Added. (bmalloc::EndTag::operator=): * bmalloc/FixedVector.h: Added. (bmalloc::FixedVector::begin): (bmalloc::FixedVector::end): (bmalloc::FixedVector::size): (bmalloc::FixedVector::capacity): (bmalloc::FixedVector::clear): (bmalloc::FixedVector::isEmpty): (bmalloc::Capacity>::FixedVector): (bmalloc::Capacity>::operator): (bmalloc::Capacity>::push): (bmalloc::Capacity>::pop): (bmalloc::Capacity>::shrink): * bmalloc/Heap.cpp: Added. (bmalloc::sleep): (bmalloc::Heap::Heap): (bmalloc::Heap::concurrentScavenge): (bmalloc::Heap::scavengeSmallPages): (bmalloc::Heap::scavengeMediumPages): (bmalloc::Heap::scavengeLargeRanges): (bmalloc::Heap::allocateSmallLineSlowCase): (bmalloc::Heap::allocateMediumLineSlowCase): (bmalloc::Heap::allocateXLarge): (bmalloc::Heap::deallocateXLarge): (bmalloc::Heap::allocateLarge): (bmalloc::Heap::deallocateLarge): * bmalloc/Heap.h: Added. (bmalloc::Heap::deallocateSmallLine): (bmalloc::Heap::allocateSmallLine): (bmalloc::Heap::deallocateMediumLine): (bmalloc::Heap::allocateMediumLine): * bmalloc/Inline.h: Added. * bmalloc/LargeChunk.h: Added. (bmalloc::LargeChunk::begin): (bmalloc::LargeChunk::end): (bmalloc::LargeChunk::create): (bmalloc::LargeChunk::get): (bmalloc::LargeChunk::beginTag): (bmalloc::LargeChunk::endTag): * bmalloc/Line.h: Added. (bmalloc::Line<Traits>::begin): (bmalloc::Line<Traits>::end): (bmalloc::Line<Traits>::concurrentRef): (bmalloc::Line<Traits>::deref): * bmalloc/MediumAllocator.h: Added. (bmalloc::MediumAllocator::isNull): (bmalloc::MediumAllocator::MediumAllocator): (bmalloc::MediumAllocator::line): (bmalloc::MediumAllocator::allocate): (bmalloc::MediumAllocator::derefCount): (bmalloc::MediumAllocator::refill): * bmalloc/MediumChunk.h: Added. * bmalloc/MediumLine.h: Added. * bmalloc/MediumPage.h: Added. * bmalloc/MediumTraits.h: Added. * bmalloc/Mutex.cpp: Added. (bmalloc::Mutex::lockSlowCase): * bmalloc/Mutex.h: Added. (bmalloc::Mutex::Mutex): (bmalloc::Mutex::try_lock): (bmalloc::Mutex::lock): (bmalloc::Mutex::unlock): * bmalloc/ObjectType.cpp: Added. (bmalloc::objectType): * bmalloc/ObjectType.h: Added. (bmalloc::isSmallOrMedium): (bmalloc::isSmall): * bmalloc/Page.h: Added. (bmalloc::Page<Traits>::ref): (bmalloc::Page<Traits>::deref): (bmalloc::Page<Traits>::refCount): * bmalloc/PerProcess.h: Added. (bmalloc::PerProcess::mutex): (bmalloc::PerProcess<T>::getFastCase): (bmalloc::PerProcess<T>::get): (bmalloc::PerProcess<T>::getSlowCase): * bmalloc/PerThread.h: Added. (bmalloc::PerThreadStorage<Cache>::get): (bmalloc::PerThreadStorage<Cache>::init): (bmalloc::PerThreadStorage::get): (bmalloc::PerThreadStorage::init): (bmalloc::PerThread<T>::getFastCase): (bmalloc::PerThread<T>::get): (bmalloc::PerThread<T>::destructor): (bmalloc::PerThread<T>::getSlowCase): * bmalloc/Range.h: Added. (bmalloc::Range::Range): (bmalloc::Range::begin): (bmalloc::Range::end): (bmalloc::Range::size): (bmalloc::Range::operator!): (bmalloc::Range::operator<): * bmalloc/SegregatedFreeList.cpp: Added. (bmalloc::SegregatedFreeList::SegregatedFreeList): (bmalloc::SegregatedFreeList::insert): (bmalloc::SegregatedFreeList::takeGreedy): (bmalloc::SegregatedFreeList::take): * bmalloc/SegregatedFreeList.h: Added. * bmalloc/Sizes.h: Added. * bmalloc/SmallAllocator.h: Added. (bmalloc::SmallAllocator::isNull): (bmalloc::SmallAllocator::canAllocate): (bmalloc::SmallAllocator::SmallAllocator): (bmalloc::SmallAllocator::line): (bmalloc::SmallAllocator::allocate): (bmalloc::SmallAllocator::objectCount): (bmalloc::SmallAllocator::derefCount): (bmalloc::SmallAllocator::refill): * bmalloc/SmallChunk.h: Added. * bmalloc/SmallLine.h: Added. * bmalloc/SmallPage.h: Added. * bmalloc/SmallTraits.h: Added. * bmalloc/Syscall.h: Added. * bmalloc/VMAllocate.h: Added. (bmalloc::vmSize): (bmalloc::vmValidate): (bmalloc::vmAllocate): (bmalloc::vmDeallocate): (bmalloc::vmDeallocatePhysicalPages): (bmalloc::vmAllocatePhysicalPages): (bmalloc::vmDeallocatePhysicalPagesSloppy): (bmalloc::vmAllocatePhysicalPagesSloppy): * bmalloc/VMHeap.cpp: Added. (bmalloc::VMHeap::VMHeap): (bmalloc::VMHeap::allocateSmallChunk): (bmalloc::VMHeap::allocateMediumChunk): (bmalloc::VMHeap::allocateLargeChunk): * bmalloc/VMHeap.h: Added. (bmalloc::VMHeap::allocateSmallPage): (bmalloc::VMHeap::allocateMediumPage): (bmalloc::VMHeap::allocateLargeRange): (bmalloc::VMHeap::deallocateSmallPage): (bmalloc::VMHeap::deallocateMediumPage): (bmalloc::VMHeap::deallocateLargeRange): * bmalloc/Vector.h: Added. (bmalloc::Vector::begin): (bmalloc::Vector::end): (bmalloc::Vector::size): (bmalloc::Vector::capacity): (bmalloc::Vector::last): (bmalloc::Vector::pop): (bmalloc::Vector<T>::Vector): (bmalloc::Vector<T>::~Vector): (bmalloc::Vector<T>::operator): (bmalloc::Vector<T>::push): (bmalloc::Vector<T>::pop): (bmalloc::Vector<T>::shrink): (bmalloc::Vector<T>::reallocateBuffer): (bmalloc::Vector<T>::shrinkCapacity): (bmalloc::Vector<T>::growCapacity): * bmalloc/XLargeChunk.h: Added. (bmalloc::XLargeChunk::get): (bmalloc::XLargeChunk::begin): (bmalloc::XLargeChunk::XLargeChunk): (bmalloc::XLargeChunk::create): (bmalloc::XLargeChunk::destroy): (bmalloc::XLargeChunk::range): (bmalloc::XLargeChunk::size): * bmalloc/bmalloc.h: Added. (bmalloc::api::malloc): (bmalloc::api::free): (bmalloc::api::realloc): * bmalloc/mbmalloc.cpp: Added. Canonical link: https://commits.webkit.org/149378@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 23:54:11 +00:00
#endif // !defined(NDEBUG)