haikuwebkit/Source/WTF/wtf/BumpPointerAllocator.h

255 lines
9.0 KiB
C
Raw Permalink Normal View History

Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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.
*/
Use pragma once in WTF https://bugs.webkit.org/show_bug.cgi?id=190527 Reviewed by Chris Dumez. Source/WTF: We also need to consistently include wtf headers from within wtf so we can build wtf without symbol redefinition errors from including the copy in Source and the copy in the build directory. * wtf/ASCIICType.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.h: * wtf/AutomaticThread.cpp: * wtf/AutomaticThread.h: * wtf/BackwardsGraph.h: * wtf/Bag.h: * wtf/BagToHashMap.h: * wtf/BitVector.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Box.h: * wtf/BubbleSort.h: * wtf/BumpPointerAllocator.h: * wtf/ByteOrder.h: * wtf/CPUTime.cpp: * wtf/CallbackAggregator.h: * wtf/CheckedArithmetic.h: * wtf/CheckedBoolean.h: * wtf/ClockType.cpp: * wtf/ClockType.h: * wtf/CommaPrinter.h: * wtf/CompilationThread.cpp: * wtf/CompilationThread.h: * wtf/Compiler.h: * wtf/ConcurrentPtrHashSet.cpp: * wtf/ConcurrentVector.h: * wtf/Condition.h: * wtf/CountingLock.cpp: * wtf/CrossThreadTaskHandler.cpp: * wtf/CryptographicUtilities.cpp: * wtf/CryptographicUtilities.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/CryptographicallyRandomNumber.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DataLog.h: * wtf/DateMath.cpp: * wtf/DateMath.h: * wtf/DecimalNumber.cpp: * wtf/DecimalNumber.h: * wtf/Deque.h: * wtf/DisallowCType.h: * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/FastBitVector.cpp: * wtf/FastMalloc.cpp: * wtf/FastMalloc.h: * wtf/FeatureDefines.h: * wtf/FilePrintStream.cpp: * wtf/FilePrintStream.h: * wtf/FlipBytes.h: * wtf/FunctionDispatcher.cpp: * wtf/FunctionDispatcher.h: * wtf/GetPtr.h: * wtf/Gigacage.cpp: * wtf/GlobalVersion.cpp: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.cpp: * wtf/GregorianDateTime.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashMethod.h: * wtf/HashSet.h: * wtf/HashTable.cpp: * wtf/HashTraits.h: * wtf/Indenter.h: * wtf/IndexSparseSet.h: * wtf/InlineASM.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/JSONValues.cpp: * wtf/JSValueMalloc.cpp: * wtf/LEBDecoder.h: * wtf/Language.cpp: * wtf/ListDump.h: * wtf/Lock.cpp: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockedPrintStream.cpp: * wtf/Locker.h: * wtf/MD5.cpp: * wtf/MD5.h: * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/MallocPtr.h: * wtf/MathExtras.h: * wtf/MediaTime.cpp: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.cpp: * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: * wtf/MetaAllocator.h: * wtf/MetaAllocatorHandle.h: * wtf/MonotonicTime.cpp: * wtf/MonotonicTime.h: * wtf/NakedPtr.h: * wtf/NoLock.h: * wtf/NoTailCalls.h: * wtf/Noncopyable.h: * wtf/NumberOfCores.cpp: * wtf/NumberOfCores.h: * wtf/OSAllocator.h: * wtf/OSAllocatorPosix.cpp: * wtf/OSRandomSource.cpp: * wtf/OSRandomSource.h: * wtf/ObjcRuntimeExtras.h: * wtf/OrderMaker.h: * wtf/PackedIntVector.h: * wtf/PageAllocation.h: * wtf/PageBlock.cpp: * wtf/PageBlock.h: * wtf/PageReservation.h: * wtf/ParallelHelperPool.cpp: * wtf/ParallelHelperPool.h: * wtf/ParallelJobs.h: * wtf/ParallelJobsLibdispatch.h: * wtf/ParallelVectorIterator.h: * wtf/ParkingLot.cpp: * wtf/ParkingLot.h: * wtf/Platform.h: * wtf/PointerComparison.h: * wtf/Poisoned.cpp: * wtf/PrintStream.cpp: * wtf/PrintStream.h: * wtf/ProcessID.h: * wtf/ProcessPrivilege.cpp: * wtf/RAMSize.cpp: * wtf/RAMSize.h: * wtf/RandomDevice.cpp: * wtf/RandomNumber.cpp: * wtf/RandomNumber.h: * wtf/RandomNumberSeed.h: * wtf/RangeSet.h: * wtf/RawPointer.h: * wtf/ReadWriteLock.cpp: * wtf/RedBlackTree.h: * wtf/Ref.h: * wtf/RefCountedArray.h: * wtf/RefCountedLeakCounter.cpp: * wtf/RefCountedLeakCounter.h: * wtf/RefCounter.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/RunLoop.cpp: * wtf/RunLoop.h: * wtf/RunLoopTimer.h: * wtf/RunLoopTimerCF.cpp: * wtf/SHA1.cpp: * wtf/SHA1.h: * wtf/SaturatedArithmetic.h: (saturatedSubtraction): * wtf/SchedulePair.h: * wtf/SchedulePairCF.cpp: * wtf/SchedulePairMac.mm: * wtf/ScopedLambda.h: * wtf/Seconds.cpp: * wtf/Seconds.h: * wtf/SegmentedVector.h: * wtf/SentinelLinkedList.h: * wtf/SharedTask.h: * wtf/SimpleStats.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SixCharacterHash.cpp: * wtf/SixCharacterHash.h: * wtf/SmallPtrSet.h: * wtf/Spectrum.h: * wtf/StackBounds.cpp: * wtf/StackBounds.h: * wtf/StackStats.cpp: * wtf/StackStats.h: * wtf/StackTrace.cpp: * wtf/StdLibExtras.h: * wtf/StreamBuffer.h: * wtf/StringHashDumpContext.h: * wtf/StringPrintStream.cpp: * wtf/StringPrintStream.h: * wtf/ThreadGroup.cpp: * wtf/ThreadMessage.cpp: * wtf/ThreadSpecific.h: * wtf/Threading.cpp: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: * wtf/TimeWithDynamicClockType.cpp: * wtf/TimeWithDynamicClockType.h: * wtf/TimingScope.cpp: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/TriState.h: * wtf/TypeCasts.h: * wtf/UUID.cpp: * wtf/UnionFind.h: * wtf/VMTags.h: * wtf/ValueCheck.h: * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.cpp: * wtf/WallTime.h: * wtf/WeakPtr.h: * wtf/WeakRandom.h: * wtf/WordLock.cpp: * wtf/WordLock.h: * wtf/WorkQueue.cpp: * wtf/WorkQueue.h: * wtf/WorkerPool.cpp: * wtf/cf/LanguageCF.cpp: * wtf/cf/RunLoopCF.cpp: * wtf/cocoa/Entitlements.mm: * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryFootprintCocoa.cpp: * wtf/cocoa/WorkQueueCocoa.cpp: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/ios/WebCoreThread.cpp: * wtf/ios/WebCoreThread.h: * wtf/mac/AppKitCompatibilityDeclarations.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: * wtf/mbmalloc.cpp: * wtf/persistence/PersistentCoders.cpp: * wtf/persistence/PersistentDecoder.cpp: * wtf/persistence/PersistentEncoder.cpp: * wtf/spi/cf/CFBundleSPI.h: * wtf/spi/darwin/CommonCryptoSPI.h: * wtf/text/ASCIIFastPath.h: * wtf/text/ASCIILiteral.cpp: * wtf/text/AtomicString.cpp: * wtf/text/AtomicString.h: * wtf/text/AtomicStringHash.h: * wtf/text/AtomicStringImpl.cpp: * wtf/text/AtomicStringImpl.h: * wtf/text/AtomicStringTable.cpp: * wtf/text/AtomicStringTable.h: * wtf/text/Base64.cpp: * wtf/text/CString.cpp: * wtf/text/CString.h: * wtf/text/ConversionMode.h: * wtf/text/ExternalStringImpl.cpp: * wtf/text/IntegerToStringConversion.h: * wtf/text/LChar.h: * wtf/text/LineEnding.cpp: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.cpp: * wtf/text/StringBuilder.h: * wtf/text/StringBuilderJSON.cpp: * wtf/text/StringCommon.h: * wtf/text/StringConcatenate.h: * wtf/text/StringHash.h: * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: * wtf/text/StringOperators.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: * wtf/text/SymbolImpl.cpp: * wtf/text/SymbolRegistry.cpp: * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.cpp: * wtf/text/TextBreakIterator.h: * wtf/text/TextBreakIteratorInternalICU.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.cpp: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.cpp: * wtf/text/WTFString.h: * wtf/text/cocoa/StringCocoa.mm: * wtf/text/cocoa/StringViewCocoa.mm: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: * wtf/text/icu/UTextProvider.cpp: * wtf/text/icu/UTextProvider.h: * wtf/text/icu/UTextProviderLatin1.cpp: * wtf/text/icu/UTextProviderLatin1.h: * wtf/text/icu/UTextProviderUTF16.cpp: * wtf/text/icu/UTextProviderUTF16.h: * wtf/threads/BinarySemaphore.cpp: * wtf/threads/BinarySemaphore.h: * wtf/threads/Signals.cpp: * wtf/unicode/CharacterNames.h: * wtf/unicode/Collator.h: * wtf/unicode/CollatorDefault.cpp: * wtf/unicode/UTF8.cpp: * wtf/unicode/UTF8.h: Tools: Put WorkQueue in namespace DRT so it does not conflict with WTF::WorkQueue. * DumpRenderTree/TestRunner.cpp: (TestRunner::queueLoadHTMLString): (TestRunner::queueLoadAlternateHTMLString): (TestRunner::queueBackNavigation): (TestRunner::queueForwardNavigation): (TestRunner::queueLoadingScript): (TestRunner::queueNonLoadingScript): (TestRunner::queueReload): * DumpRenderTree/WorkQueue.cpp: (WorkQueue::singleton): Deleted. (WorkQueue::WorkQueue): Deleted. (WorkQueue::queue): Deleted. (WorkQueue::dequeue): Deleted. (WorkQueue::count): Deleted. (WorkQueue::clear): Deleted. (WorkQueue::processWork): Deleted. * DumpRenderTree/WorkQueue.h: (WorkQueue::setFrozen): Deleted. * DumpRenderTree/WorkQueueItem.h: * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): * DumpRenderTree/mac/FrameLoadDelegate.mm: (-[FrameLoadDelegate processWork:]): (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): * DumpRenderTree/win/DumpRenderTree.cpp: (runTest): * DumpRenderTree/win/FrameLoadDelegate.cpp: (FrameLoadDelegate::processWork): (FrameLoadDelegate::locationChangeDone): * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): Canonical link: https://commits.webkit.org/205473@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-15 14:24:49 +00:00
#pragma once
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
#include <algorithm>
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
#include <wtf/PageAllocation.h>
#include <wtf/PageBlock.h>
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
namespace WTF {
#define MINIMUM_BUMP_POOL_SIZE 0x1000
class BumpPointerPool {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
public:
// ensureCapacity will check whether the current pool has capacity to
// allocate 'size' bytes of memory If it does not, it will attempt to
// allocate a new pool (which will be added to this one in a chain).
//
// If allocation fails (out of memory) this method will return null.
// If the return value is non-null, then callers should update any
// references they have to this current (possibly full) BumpPointerPool
// to instead point to the newly returned BumpPointerPool.
BumpPointerPool* ensureCapacity(size_t size)
{
void* allocationEnd = static_cast<char*>(m_current) + size;
Replace bounds checking ASSERTs with ASSERT_WITH_SECURITY_IMPLICATION https://bugs.webkit.org/show_bug.cgi?id=120893 Patch by Jessica Pease <jessica_n_pease@apple.com> on 2013-09-06 Reviewed by Darin Adler. Source/WebCore: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::IDBKeyPathLexer::lex): * Modules/indexeddb/IDBLevelDBCoding.cpp: (WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::cssPropertyIDForJSCSSPropertyName): * css/CSSFontSelector.cpp: (WebCore::compareFontFaces): * css/CSSParser.cpp: (WebCore::CSSParser::rewriteSpecifiers): * html/HTMLCollection.cpp: (WebCore::traverseMatchingElementsForwardToOffset): (WebCore::LiveNodeListBase::traverseChildNodeListForwardToOffset): (WebCore::HTMLCollection::traverseForwardToOffset): * html/HTMLFontElement.cpp: (WebCore::parseFontSize): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLIntegerInternal): (WebCore::parseHTMLNonNegativeIntegerInternal): * inspector/InspectorStyleSheet.h: (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration): * platform/graphics/StringTruncator.cpp: (WebCore::centerTruncateToBuffer): (WebCore::rightTruncateToBuffer): (WebCore::truncateString): * platform/graphics/TextRun.h: (WebCore::TextRun::subRun): * platform/text/BidiRunList.h: (WebCore::::reverseRuns): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::selectionRectForTextFragment): (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates): * rendering/svg/SVGTextChunkBuilder.cpp: (WebCore::SVGTextChunkBuilder::buildTextChunks): * rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::currentLogicalCharacterMetrics): * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates): * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): * svg/SVGPathByteStreamSource.h: (WebCore::SVGPathByteStreamSource::readType): Source/WebKit2: * Shared/Plugins/PluginQuirks.h: (WebKit::PluginQuirks::add): Source/WTF: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::ensureCapacityCrossPool): * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/StringPrintStream.cpp: (WTF::StringPrintStream::increaseSize): * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::SubBufferReference): * wtf/text/WTFString.cpp: (WTF::String::fromUTF8): Canonical link: https://commits.webkit.org/140810@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-12 18:03:39 +00:00
ASSERT_WITH_SECURITY_IMPLICATION(allocationEnd > m_current); // check for overflow
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
if (allocationEnd <= static_cast<void*>(this))
return this;
return ensureCapacityCrossPool(this, size);
}
// alloc should only be called after calling ensureCapacity; as such
// alloc will never fail.
void* alloc(size_t size)
{
void* current = m_current;
void* allocationEnd = static_cast<char*>(current) + size;
Replace bounds checking ASSERTs with ASSERT_WITH_SECURITY_IMPLICATION https://bugs.webkit.org/show_bug.cgi?id=120893 Patch by Jessica Pease <jessica_n_pease@apple.com> on 2013-09-06 Reviewed by Darin Adler. Source/WebCore: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::IDBKeyPathLexer::lex): * Modules/indexeddb/IDBLevelDBCoding.cpp: (WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::cssPropertyIDForJSCSSPropertyName): * css/CSSFontSelector.cpp: (WebCore::compareFontFaces): * css/CSSParser.cpp: (WebCore::CSSParser::rewriteSpecifiers): * html/HTMLCollection.cpp: (WebCore::traverseMatchingElementsForwardToOffset): (WebCore::LiveNodeListBase::traverseChildNodeListForwardToOffset): (WebCore::HTMLCollection::traverseForwardToOffset): * html/HTMLFontElement.cpp: (WebCore::parseFontSize): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLIntegerInternal): (WebCore::parseHTMLNonNegativeIntegerInternal): * inspector/InspectorStyleSheet.h: (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration): * platform/graphics/StringTruncator.cpp: (WebCore::centerTruncateToBuffer): (WebCore::rightTruncateToBuffer): (WebCore::truncateString): * platform/graphics/TextRun.h: (WebCore::TextRun::subRun): * platform/text/BidiRunList.h: (WebCore::::reverseRuns): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::selectionRectForTextFragment): (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates): * rendering/svg/SVGTextChunkBuilder.cpp: (WebCore::SVGTextChunkBuilder::buildTextChunks): * rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::currentLogicalCharacterMetrics): * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates): * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): * svg/SVGPathByteStreamSource.h: (WebCore::SVGPathByteStreamSource::readType): Source/WebKit2: * Shared/Plugins/PluginQuirks.h: (WebKit::PluginQuirks::add): Source/WTF: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::ensureCapacityCrossPool): * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/StringPrintStream.cpp: (WTF::StringPrintStream::increaseSize): * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::SubBufferReference): * wtf/text/WTFString.cpp: (WTF::String::fromUTF8): Canonical link: https://commits.webkit.org/140810@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-12 18:03:39 +00:00
ASSERT_WITH_SECURITY_IMPLICATION(allocationEnd > current); // check for overflow
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
ASSERT(allocationEnd <= static_cast<void*>(this));
m_current = allocationEnd;
return current;
}
// The dealloc method releases memory allocated using alloc. Memory
// must be released in a LIFO fashion, e.g. if the client calls alloc
// four times, returning pointer A, B, C, D, then the only valid order
// in which these may be deallocaed is D, C, B, A.
//
// The client may optionally skip some deallocations. In the example
// above, it would be valid to only explicitly dealloc C, A (D being
// dealloced along with C, B along with A).
//
// If pointer was not allocated from this pool (or pools) then dealloc
// will CRASH(). Callers should update any references they have to
// this current BumpPointerPool to instead point to the returned
// BumpPointerPool.
BumpPointerPool* dealloc(void* position)
{
if ((position >= m_start) && (position <= static_cast<void*>(this))) {
ASSERT(position <= m_current);
m_current = position;
return this;
}
return deallocCrossPool(this, position);
}
private:
// Placement operator new, returns the last 'size' bytes of allocation for use as this.
void* operator new(size_t size, const PageAllocation& allocation)
{
ASSERT(size < allocation.size());
return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
}
BumpPointerPool(const PageAllocation& allocation)
: m_current(allocation.base())
, m_start(allocation.base())
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
, m_next(nullptr)
, m_previous(nullptr)
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
, m_allocation(allocation)
{
}
static BumpPointerPool* create(size_t minimumCapacity = 0)
{
// Add size of BumpPointerPool object, check for overflow.
minimumCapacity += sizeof(BumpPointerPool);
if (minimumCapacity < sizeof(BumpPointerPool))
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
return nullptr;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
size_t poolSize = std::max(static_cast<size_t>(MINIMUM_BUMP_POOL_SIZE), WTF::pageSize());
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
while (poolSize < minimumCapacity) {
poolSize <<= 1;
// The following if check relies on MINIMUM_BUMP_POOL_SIZE being a power of 2!
ASSERT(!(MINIMUM_BUMP_POOL_SIZE & (MINIMUM_BUMP_POOL_SIZE - 1)));
if (!poolSize)
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
return nullptr;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
}
PageAllocation allocation = PageAllocation::allocate(poolSize);
if (!!allocation)
Placement new does an unnecessary NULL check https://bugs.webkit.org/show_bug.cgi?id=74676 Reviewed by Sam Weinig. Source/JavaScriptCore: We can define our own version, which skips the NULL check. Not a measurable speedup, but code inspection shows better code generated, and I believe this is a step toward turning off -fomit-frame-pointer. * API/JSCallbackConstructor.h: (JSC::JSCallbackConstructor::create): * API/JSCallbackFunction.h: (JSC::JSCallbackFunction::create): Use the NotNull version of placement new to skip the NULL check. * API/JSCallbackObject.h: Removed a conflicting, unnecessaray placement new. (JSC::JSCallbackObject::create): * debugger/DebuggerActivation.h: (JSC::DebuggerActivation::create): * heap/HandleHeap.cpp: (JSC::HandleHeap::grow): * heap/HandleHeap.h: (JSC::HandleHeap::allocate): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::create): (JSC::MarkedBlock::recycle): * jit/JITCode.h: (JSC::JITCode::clear): * jsc.cpp: (GlobalObject::create): * profiler/CallIdentifier.h: * runtime/Arguments.h: (JSC::Arguments::create): * runtime/ArrayConstructor.h: (JSC::ArrayConstructor::create): * runtime/ArrayPrototype.h: (JSC::ArrayPrototype::create): * runtime/BooleanConstructor.h: (JSC::BooleanConstructor::create): * runtime/BooleanObject.h: (JSC::BooleanObject::create): * runtime/BooleanPrototype.h: (JSC::BooleanPrototype::create): * runtime/DateConstructor.h: (JSC::DateConstructor::create): * runtime/DateInstance.h: (JSC::DateInstance::create): * runtime/DatePrototype.h: (JSC::DatePrototype::create): * runtime/Error.h: (JSC::StrictModeTypeErrorFunction::create): * runtime/ErrorConstructor.h: (JSC::ErrorConstructor::create): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): * runtime/ErrorPrototype.h: (JSC::ErrorPrototype::create): * runtime/ExceptionHelpers.h: (JSC::InterruptedExecutionError::create): (JSC::TerminatedExecutionError::create): * runtime/Executable.h: (JSC::NativeExecutable::create): (JSC::EvalExecutable::create): (JSC::ProgramExecutable::create): (JSC::FunctionExecutable::create): * runtime/FunctionConstructor.h: (JSC::FunctionConstructor::create): * runtime/FunctionPrototype.h: (JSC::FunctionPrototype::create): * runtime/GetterSetter.h: (JSC::GetterSetter::create): * runtime/JSAPIValueWrapper.h: (JSC::JSAPIValueWrapper::create): * runtime/JSActivation.h: (JSC::JSActivation::create): * runtime/JSArray.h: (JSC::JSArray::create): * runtime/JSBoundFunction.cpp: (JSC::JSBoundFunction::create): * runtime/JSByteArray.h: (JSC::JSByteArray::create): Use the NotNull version of placement new to skip the NULL check. * runtime/JSCell.h: Removed a conflicting, unnecessaray placement new. * runtime/JSFunction.cpp: (JSC::JSFunction::create): * runtime/JSFunction.h: (JSC::JSFunction::create): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::create): * runtime/JSGlobalThis.h: (JSC::JSGlobalThis::create): * runtime/JSNotAnObject.h: (JSC::JSNotAnObject::create): * runtime/JSONObject.h: (JSC::JSONObject::create): * runtime/JSObject.h: (JSC::JSFinalObject::create): * runtime/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::create): * runtime/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::create): * runtime/JSStaticScopeObject.h: (JSC::JSStaticScopeObject::create): * runtime/JSString.cpp: (JSC::StringObject::create): * runtime/JSString.h: (JSC::RopeBuilder::createNull): (JSC::RopeBuilder::create): (JSC::RopeBuilder::createHasOtherOwner): * runtime/MathObject.h: (JSC::MathObject::create): * runtime/NativeErrorConstructor.h: (JSC::NativeErrorConstructor::create): * runtime/NativeErrorPrototype.h: (JSC::NativeErrorPrototype::create): * runtime/NumberConstructor.h: (JSC::NumberConstructor::create): * runtime/NumberObject.h: (JSC::NumberObject::create): * runtime/NumberPrototype.h: (JSC::NumberPrototype::create): * runtime/ObjectConstructor.h: (JSC::ObjectConstructor::create): * runtime/ObjectPrototype.h: (JSC::ObjectPrototype::create): * runtime/RegExp.cpp: (JSC::RegExp::createWithoutCaching): * runtime/RegExpConstructor.h: (JSC::RegExpConstructor::create): * runtime/RegExpMatchesArray.h: (JSC::RegExpMatchesArray::create): * runtime/RegExpObject.h: (JSC::RegExpObject::create): * runtime/RegExpPrototype.h: (JSC::RegExpPrototype::create): * runtime/ScopeChain.h: (JSC::ScopeChainNode::create): * runtime/StrictEvalActivation.h: (JSC::StrictEvalActivation::create): * runtime/StringConstructor.h: (JSC::StringConstructor::create): * runtime/StringObject.h: (JSC::StringObject::create): * runtime/StringPrototype.h: (JSC::StringPrototype::create): * runtime/Structure.h: (JSC::Structure::create): (JSC::Structure::createStructure): * runtime/StructureChain.h: (JSC::StructureChain::create): * testRegExp.cpp: (GlobalObject::create): * wtf/BitVector.cpp: (WTF::BitVector::OutOfLineBits::create): Use the NotNull version of placement new to skip the NULL check. * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::create): Standardized spacing to make grep easier. * wtf/ByteArray.cpp: (WTF::ByteArray::create): * wtf/Deque.h: (WTF::::append): (WTF::::prepend): Use NotNull, as above. * wtf/FastAllocBase.h: Added a placement new, since this class would otherwise hide the name of the global placement new. (WTF::fastNew): Standardized spacing. Most of these functions don't need NotNull, since they check for NULL, and the optimizer can see that. * wtf/HashTable.h: * wtf/HashTraits.h: (WTF::SimpleClassHashTraits::constructDeletedValue): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocFreeSpaceNode): NotNull, as above. * wtf/StdLibExtras.h: (throw): This is our NotNull placement new. Declaring that we throw is the C++ way to say that operator new will not return NULL. * wtf/ThreadSpecific.h: (WTF::T): * wtf/Vector.h: (WTF::::append): (WTF::::tryAppend): (WTF::::uncheckedAppend): (WTF::::insert): * wtf/text/AtomicStringHash.h: * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitialized): (WTF::StringImpl::reallocate): * wtf/text/StringImpl.h: (WTF::StringImpl::tryCreateUninitialized): * wtf/text/StringStatics.cpp: (WTF::AtomicString::init): Use NotNull, as above. * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): Standardized spacing for easy grep. Source/WebCore: * bindings/js/JSImageConstructor.h: (WebCore::JSImageConstructor::create): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateConstructorDeclaration): * bridge/c/CRuntimeObject.h: (JSC::Bindings::CRuntimeObject::create): * bridge/c/c_instance.cpp: (JSC::Bindings::CRuntimeMethod::create): * bridge/jni/jsc/JavaInstanceJSC.cpp: (JavaRuntimeMethod::create): * bridge/jni/jsc/JavaRuntimeObject.h: (JSC::Bindings::JavaRuntimeObject::create): * bridge/objc/ObjCRuntimeObject.h: (JSC::Bindings::ObjCRuntimeObject::create): * bridge/objc/objc_instance.mm: (ObjCRuntimeMethod::create): * bridge/objc/objc_runtime.h: (JSC::Bindings::ObjcFallbackObjectImp::create): * bridge/runtime_array.h: (JSC::RuntimeArray::create): * bridge/runtime_method.h: (JSC::RuntimeMethod::create): * bridge/runtime_object.h: (JSC::Bindings::RuntimeObject::create): * dom/Document.h: (WebCore::FormElementKeyHashTraits::constructDeletedValue): Use NotNull placement new, as in JavaScriptCore. * platform/PODArena.h: (WebCore::PODArena::allocateObject): No need to check for NULL explicitly, since that's the built-in behavior of placement new. * platform/graphics/FontCache.cpp: (WebCore::FontDataCacheKeyTraits::constructDeletedValue): * platform/graphics/IntRectHash.h: * platform/graphics/IntSizeHash.h: More NotNull. * rendering/RenderObject.h: Declaring that we throw is the C++ way to say that operator new will not return NULL. Canonical link: https://commits.webkit.org/91607@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-12-19 17:45:13 +00:00
return new (allocation) BumpPointerPool(allocation);
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
return nullptr;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
}
void shrink()
{
ASSERT(!m_previous);
m_current = m_start;
while (m_next) {
BumpPointerPool* nextNext = m_next->m_next;
m_next->destroy();
m_next = nextNext;
}
}
void destroy()
{
m_allocation.deallocate();
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
}
static BumpPointerPool* ensureCapacityCrossPool(BumpPointerPool* previousPool, size_t size)
{
// The pool passed should not have capacity, so we'll start with the next one.
ASSERT(previousPool);
ASSERT((static_cast<char*>(previousPool->m_current) + size) > previousPool->m_current); // check for overflow
ASSERT((static_cast<char*>(previousPool->m_current) + size) > static_cast<void*>(previousPool));
BumpPointerPool* pool = previousPool->m_next;
while (true) {
if (!pool) {
// We've run to the end; allocate a new pool.
pool = BumpPointerPool::create(size);
previousPool->m_next = pool;
pool->m_previous = previousPool;
return pool;
}
//
void* current = pool->m_current;
void* allocationEnd = static_cast<char*>(current) + size;
Replace bounds checking ASSERTs with ASSERT_WITH_SECURITY_IMPLICATION https://bugs.webkit.org/show_bug.cgi?id=120893 Patch by Jessica Pease <jessica_n_pease@apple.com> on 2013-09-06 Reviewed by Darin Adler. Source/WebCore: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::IDBKeyPathLexer::lex): * Modules/indexeddb/IDBLevelDBCoding.cpp: (WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::cssPropertyIDForJSCSSPropertyName): * css/CSSFontSelector.cpp: (WebCore::compareFontFaces): * css/CSSParser.cpp: (WebCore::CSSParser::rewriteSpecifiers): * html/HTMLCollection.cpp: (WebCore::traverseMatchingElementsForwardToOffset): (WebCore::LiveNodeListBase::traverseChildNodeListForwardToOffset): (WebCore::HTMLCollection::traverseForwardToOffset): * html/HTMLFontElement.cpp: (WebCore::parseFontSize): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLIntegerInternal): (WebCore::parseHTMLNonNegativeIntegerInternal): * inspector/InspectorStyleSheet.h: (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration): * platform/graphics/StringTruncator.cpp: (WebCore::centerTruncateToBuffer): (WebCore::rightTruncateToBuffer): (WebCore::truncateString): * platform/graphics/TextRun.h: (WebCore::TextRun::subRun): * platform/text/BidiRunList.h: (WebCore::::reverseRuns): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::selectionRectForTextFragment): (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates): * rendering/svg/SVGTextChunkBuilder.cpp: (WebCore::SVGTextChunkBuilder::buildTextChunks): * rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::currentLogicalCharacterMetrics): * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates): * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): * svg/SVGPathByteStreamSource.h: (WebCore::SVGPathByteStreamSource::readType): Source/WebKit2: * Shared/Plugins/PluginQuirks.h: (WebKit::PluginQuirks::add): Source/WTF: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::ensureCapacityCrossPool): * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/StringPrintStream.cpp: (WTF::StringPrintStream::increaseSize): * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::SubBufferReference): * wtf/text/WTFString.cpp: (WTF::String::fromUTF8): Canonical link: https://commits.webkit.org/140810@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-12 18:03:39 +00:00
ASSERT_WITH_SECURITY_IMPLICATION(allocationEnd > current); // check for overflow
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
if (allocationEnd <= static_cast<void*>(pool))
return pool;
previousPool = pool;
pool = pool->m_next;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
}
}
static BumpPointerPool* deallocCrossPool(BumpPointerPool* pool, void* position)
{
// Should only be called if position is not in the current pool.
ASSERT((position < pool->m_start) || (position > static_cast<void*>(pool)));
while (true) {
// Unwind the current pool to the start, move back in the chain to the previous pool.
pool->m_current = pool->m_start;
pool = pool->m_previous;
// position was nowhere in the chain!
if (!pool)
CRASH();
if ((position >= pool->m_start) && (position <= static_cast<void*>(pool))) {
ASSERT(position <= pool->m_current);
pool->m_current = position;
return pool;
}
}
}
void* m_current;
void* m_start;
BumpPointerPool* m_next;
BumpPointerPool* m_previous;
PageAllocation m_allocation;
friend class BumpPointerAllocator;
};
// A BumpPointerAllocator manages a set of BumpPointerPool objects, which
// can be used for LIFO (stack like) allocation.
//
// To begin allocating using this class call startAllocator(). The result
// of this method will be null if the initial pool allocation fails, or a
// pointer to a BumpPointerPool object that can be used to perform
// allocations. Whilst running no memory will be released until
// stopAllocator() is called. At this point all allocations made through
// this allocator will be reaped, and underlying memory may be freed.
//
// (In practice we will still hold on to the initial pool to allow allocation
// to be quickly restared, but aditional pools will be freed).
//
// This allocator is non-renetrant, it is encumbant on the clients to ensure
// startAllocator() is not called again until stopAllocator() has been called.
class BumpPointerAllocator {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
public:
BumpPointerAllocator()
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
: m_head(nullptr)
Bug 42621 - Add a bump allocator for the YARR interpreter Reviewed by Oliver Hunt. The regex engine requires lifo allocation, however currently uses the general purpose malloc/free memory allocation. A simple bump pointer allocator should provide a lower overhead allocation solution. JavaScriptCore: When using YARR interpreter, 15% progression on v8-regex. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGlobalData.h: * runtime/RegExp.cpp: (JSC::RegExp::compile): * wtf/BumpPointerAllocator.h: Added. (WTF::BumpPointerPool::ensureCapacity): (WTF::BumpPointerPool::alloc): (WTF::BumpPointerPool::dealloc): (WTF::BumpPointerPool::operator new): (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerPool::shrink): (WTF::BumpPointerPool::destroy): (WTF::BumpPointerPool::ensureCapacityCrossPool): (WTF::BumpPointerPool::deallocCrossPool): (WTF::BumpPointerAllocator::BumpPointerAllocator): (WTF::BumpPointerAllocator::~BumpPointerAllocator): (WTF::BumpPointerAllocator::startAllocator): (WTF::BumpPointerAllocator::stopAllocator): * yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::byteCompileRegex): * yarr/RegexInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): JavaScriptGlue: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. WebCore: * ForwardingHeaders/wtf/BumpPointerAllocator.h: Added. Canonical link: https://commits.webkit.org/54974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-27 19:14:40 +00:00
{
}
~BumpPointerAllocator()
{
if (m_head)
m_head->destroy();
}
BumpPointerPool* startAllocator()
{
if (!m_head)
m_head = BumpPointerPool::create();
return m_head;
}
void stopAllocator()
{
if (m_head)
m_head->shrink();
}
private:
BumpPointerPool* m_head;
};
}
using WTF::BumpPointerAllocator;