haikuwebkit/Source/WTF/wtf/ReadWriteLock.cpp

69 lines
2.1 KiB
C++
Raw Permalink Normal View History

REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
/*
* Copyright (C) 2017 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.
*/
#include "config.h"
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
#include <wtf/ReadWriteLock.h>
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
#include <wtf/Locker.h>
namespace WTF {
[WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors https://bugs.webkit.org/show_bug.cgi?id=180495 Reviewed by Mark Lam. Very nice feature of C++11 is that constexpr constructor can initialize static global variables without calling global constructors. We do not need to have XXXLockBase with derived XXXLock class since StaticXXXLock can have constructors as long as it is constexpr. We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability. C++11's default constructor is constexpr as long as its member's default constructor / default initializer is constexpr. * wtf/Condition.h: (WTF::ConditionBase::construct): Deleted. (WTF::ConditionBase::waitUntil): Deleted. (WTF::ConditionBase::waitFor): Deleted. (WTF::ConditionBase::wait): Deleted. (WTF::ConditionBase::notifyOne): Deleted. (WTF::ConditionBase::notifyAll): Deleted. (WTF::Condition::Condition): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::CountingLock): Deleted. (WTF::CountingLock::~CountingLock): Deleted. * wtf/Lock.cpp: (WTF::Lock::lockSlow): (WTF::Lock::unlockSlow): (WTF::Lock::unlockFairlySlow): (WTF::Lock::safepointSlow): (WTF::LockBase::lockSlow): Deleted. (WTF::LockBase::unlockSlow): Deleted. (WTF::LockBase::unlockFairlySlow): Deleted. (WTF::LockBase::safepointSlow): Deleted. * wtf/Lock.h: (WTF::LockBase::construct): Deleted. (WTF::LockBase::lock): Deleted. (WTF::LockBase::tryLock): Deleted. (WTF::LockBase::try_lock): Deleted. (WTF::LockBase::unlock): Deleted. (WTF::LockBase::unlockFairly): Deleted. (WTF::LockBase::safepoint): Deleted. (WTF::LockBase::isHeld const): Deleted. (WTF::LockBase::isLocked const): Deleted. (WTF::LockBase::isFullyReset const): Deleted. (WTF::Lock::Lock): Deleted. * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): (WTF::ReadWriteLockBase::construct): Deleted. (WTF::ReadWriteLockBase::readLock): Deleted. (WTF::ReadWriteLockBase::readUnlock): Deleted. (WTF::ReadWriteLockBase::writeLock): Deleted. (WTF::ReadWriteLockBase::writeUnlock): Deleted. * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::read): (WTF::ReadWriteLock::write): (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted. (WTF::ReadWriteLockBase::ReadLock::lock): Deleted. (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted. (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted. (WTF::ReadWriteLockBase::WriteLock::lock): Deleted. (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted. (WTF::ReadWriteLockBase::read): Deleted. (WTF::ReadWriteLockBase::write): Deleted. (WTF::ReadWriteLock::ReadWriteLock): Deleted. * wtf/RecursiveLockAdapter.h: (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted. * wtf/WordLock.cpp: (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): (WTF::WordLockBase::lockSlow): Deleted. (WTF::WordLockBase::unlockSlow): Deleted. * wtf/WordLock.h: (WTF::WordLockBase::lock): Deleted. (WTF::WordLockBase::unlock): Deleted. (WTF::WordLockBase::isHeld const): Deleted. (WTF::WordLockBase::isLocked const): Deleted. (WTF::WordLockBase::isFullyReset const): Deleted. (WTF::WordLock::WordLock): Deleted. * wtf/WorkQueue.cpp: Canonical link: https://commits.webkit.org/196438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-07 03:52:09 +00:00
void ReadWriteLock::readLock()
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
{
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
Locker locker { m_lock };
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
while (m_isWriteLocked || m_numWaitingWriters)
m_cond.wait(m_lock);
m_numReaders++;
}
[WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors https://bugs.webkit.org/show_bug.cgi?id=180495 Reviewed by Mark Lam. Very nice feature of C++11 is that constexpr constructor can initialize static global variables without calling global constructors. We do not need to have XXXLockBase with derived XXXLock class since StaticXXXLock can have constructors as long as it is constexpr. We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability. C++11's default constructor is constexpr as long as its member's default constructor / default initializer is constexpr. * wtf/Condition.h: (WTF::ConditionBase::construct): Deleted. (WTF::ConditionBase::waitUntil): Deleted. (WTF::ConditionBase::waitFor): Deleted. (WTF::ConditionBase::wait): Deleted. (WTF::ConditionBase::notifyOne): Deleted. (WTF::ConditionBase::notifyAll): Deleted. (WTF::Condition::Condition): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::CountingLock): Deleted. (WTF::CountingLock::~CountingLock): Deleted. * wtf/Lock.cpp: (WTF::Lock::lockSlow): (WTF::Lock::unlockSlow): (WTF::Lock::unlockFairlySlow): (WTF::Lock::safepointSlow): (WTF::LockBase::lockSlow): Deleted. (WTF::LockBase::unlockSlow): Deleted. (WTF::LockBase::unlockFairlySlow): Deleted. (WTF::LockBase::safepointSlow): Deleted. * wtf/Lock.h: (WTF::LockBase::construct): Deleted. (WTF::LockBase::lock): Deleted. (WTF::LockBase::tryLock): Deleted. (WTF::LockBase::try_lock): Deleted. (WTF::LockBase::unlock): Deleted. (WTF::LockBase::unlockFairly): Deleted. (WTF::LockBase::safepoint): Deleted. (WTF::LockBase::isHeld const): Deleted. (WTF::LockBase::isLocked const): Deleted. (WTF::LockBase::isFullyReset const): Deleted. (WTF::Lock::Lock): Deleted. * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): (WTF::ReadWriteLockBase::construct): Deleted. (WTF::ReadWriteLockBase::readLock): Deleted. (WTF::ReadWriteLockBase::readUnlock): Deleted. (WTF::ReadWriteLockBase::writeLock): Deleted. (WTF::ReadWriteLockBase::writeUnlock): Deleted. * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::read): (WTF::ReadWriteLock::write): (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted. (WTF::ReadWriteLockBase::ReadLock::lock): Deleted. (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted. (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted. (WTF::ReadWriteLockBase::WriteLock::lock): Deleted. (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted. (WTF::ReadWriteLockBase::read): Deleted. (WTF::ReadWriteLockBase::write): Deleted. (WTF::ReadWriteLock::ReadWriteLock): Deleted. * wtf/RecursiveLockAdapter.h: (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted. * wtf/WordLock.cpp: (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): (WTF::WordLockBase::lockSlow): Deleted. (WTF::WordLockBase::unlockSlow): Deleted. * wtf/WordLock.h: (WTF::WordLockBase::lock): Deleted. (WTF::WordLockBase::unlock): Deleted. (WTF::WordLockBase::isHeld const): Deleted. (WTF::WordLockBase::isLocked const): Deleted. (WTF::WordLockBase::isFullyReset const): Deleted. (WTF::WordLock::WordLock): Deleted. * wtf/WorkQueue.cpp: Canonical link: https://commits.webkit.org/196438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-07 03:52:09 +00:00
void ReadWriteLock::readUnlock()
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
{
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
Locker locker { m_lock };
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
m_numReaders--;
if (!m_numReaders)
m_cond.notifyAll();
}
[WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors https://bugs.webkit.org/show_bug.cgi?id=180495 Reviewed by Mark Lam. Very nice feature of C++11 is that constexpr constructor can initialize static global variables without calling global constructors. We do not need to have XXXLockBase with derived XXXLock class since StaticXXXLock can have constructors as long as it is constexpr. We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability. C++11's default constructor is constexpr as long as its member's default constructor / default initializer is constexpr. * wtf/Condition.h: (WTF::ConditionBase::construct): Deleted. (WTF::ConditionBase::waitUntil): Deleted. (WTF::ConditionBase::waitFor): Deleted. (WTF::ConditionBase::wait): Deleted. (WTF::ConditionBase::notifyOne): Deleted. (WTF::ConditionBase::notifyAll): Deleted. (WTF::Condition::Condition): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::CountingLock): Deleted. (WTF::CountingLock::~CountingLock): Deleted. * wtf/Lock.cpp: (WTF::Lock::lockSlow): (WTF::Lock::unlockSlow): (WTF::Lock::unlockFairlySlow): (WTF::Lock::safepointSlow): (WTF::LockBase::lockSlow): Deleted. (WTF::LockBase::unlockSlow): Deleted. (WTF::LockBase::unlockFairlySlow): Deleted. (WTF::LockBase::safepointSlow): Deleted. * wtf/Lock.h: (WTF::LockBase::construct): Deleted. (WTF::LockBase::lock): Deleted. (WTF::LockBase::tryLock): Deleted. (WTF::LockBase::try_lock): Deleted. (WTF::LockBase::unlock): Deleted. (WTF::LockBase::unlockFairly): Deleted. (WTF::LockBase::safepoint): Deleted. (WTF::LockBase::isHeld const): Deleted. (WTF::LockBase::isLocked const): Deleted. (WTF::LockBase::isFullyReset const): Deleted. (WTF::Lock::Lock): Deleted. * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): (WTF::ReadWriteLockBase::construct): Deleted. (WTF::ReadWriteLockBase::readLock): Deleted. (WTF::ReadWriteLockBase::readUnlock): Deleted. (WTF::ReadWriteLockBase::writeLock): Deleted. (WTF::ReadWriteLockBase::writeUnlock): Deleted. * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::read): (WTF::ReadWriteLock::write): (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted. (WTF::ReadWriteLockBase::ReadLock::lock): Deleted. (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted. (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted. (WTF::ReadWriteLockBase::WriteLock::lock): Deleted. (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted. (WTF::ReadWriteLockBase::read): Deleted. (WTF::ReadWriteLockBase::write): Deleted. (WTF::ReadWriteLock::ReadWriteLock): Deleted. * wtf/RecursiveLockAdapter.h: (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted. * wtf/WordLock.cpp: (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): (WTF::WordLockBase::lockSlow): Deleted. (WTF::WordLockBase::unlockSlow): Deleted. * wtf/WordLock.h: (WTF::WordLockBase::lock): Deleted. (WTF::WordLockBase::unlock): Deleted. (WTF::WordLockBase::isHeld const): Deleted. (WTF::WordLockBase::isLocked const): Deleted. (WTF::WordLockBase::isFullyReset const): Deleted. (WTF::WordLock::WordLock): Deleted. * wtf/WorkQueue.cpp: Canonical link: https://commits.webkit.org/196438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-07 03:52:09 +00:00
void ReadWriteLock::writeLock()
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
{
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
Locker locker { m_lock };
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
while (m_isWriteLocked || m_numReaders) {
m_numWaitingWriters++;
m_cond.wait(m_lock);
m_numWaitingWriters--;
}
m_isWriteLocked = true;
}
[WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors https://bugs.webkit.org/show_bug.cgi?id=180495 Reviewed by Mark Lam. Very nice feature of C++11 is that constexpr constructor can initialize static global variables without calling global constructors. We do not need to have XXXLockBase with derived XXXLock class since StaticXXXLock can have constructors as long as it is constexpr. We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability. C++11's default constructor is constexpr as long as its member's default constructor / default initializer is constexpr. * wtf/Condition.h: (WTF::ConditionBase::construct): Deleted. (WTF::ConditionBase::waitUntil): Deleted. (WTF::ConditionBase::waitFor): Deleted. (WTF::ConditionBase::wait): Deleted. (WTF::ConditionBase::notifyOne): Deleted. (WTF::ConditionBase::notifyAll): Deleted. (WTF::Condition::Condition): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::CountingLock): Deleted. (WTF::CountingLock::~CountingLock): Deleted. * wtf/Lock.cpp: (WTF::Lock::lockSlow): (WTF::Lock::unlockSlow): (WTF::Lock::unlockFairlySlow): (WTF::Lock::safepointSlow): (WTF::LockBase::lockSlow): Deleted. (WTF::LockBase::unlockSlow): Deleted. (WTF::LockBase::unlockFairlySlow): Deleted. (WTF::LockBase::safepointSlow): Deleted. * wtf/Lock.h: (WTF::LockBase::construct): Deleted. (WTF::LockBase::lock): Deleted. (WTF::LockBase::tryLock): Deleted. (WTF::LockBase::try_lock): Deleted. (WTF::LockBase::unlock): Deleted. (WTF::LockBase::unlockFairly): Deleted. (WTF::LockBase::safepoint): Deleted. (WTF::LockBase::isHeld const): Deleted. (WTF::LockBase::isLocked const): Deleted. (WTF::LockBase::isFullyReset const): Deleted. (WTF::Lock::Lock): Deleted. * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): (WTF::ReadWriteLockBase::construct): Deleted. (WTF::ReadWriteLockBase::readLock): Deleted. (WTF::ReadWriteLockBase::readUnlock): Deleted. (WTF::ReadWriteLockBase::writeLock): Deleted. (WTF::ReadWriteLockBase::writeUnlock): Deleted. * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::read): (WTF::ReadWriteLock::write): (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted. (WTF::ReadWriteLockBase::ReadLock::lock): Deleted. (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted. (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted. (WTF::ReadWriteLockBase::WriteLock::lock): Deleted. (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted. (WTF::ReadWriteLockBase::read): Deleted. (WTF::ReadWriteLockBase::write): Deleted. (WTF::ReadWriteLock::ReadWriteLock): Deleted. * wtf/RecursiveLockAdapter.h: (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted. * wtf/WordLock.cpp: (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): (WTF::WordLockBase::lockSlow): Deleted. (WTF::WordLockBase::unlockSlow): Deleted. * wtf/WordLock.h: (WTF::WordLockBase::lock): Deleted. (WTF::WordLockBase::unlock): Deleted. (WTF::WordLockBase::isHeld const): Deleted. (WTF::WordLockBase::isLocked const): Deleted. (WTF::WordLockBase::isFullyReset const): Deleted. (WTF::WordLock::WordLock): Deleted. * wtf/WorkQueue.cpp: Canonical link: https://commits.webkit.org/196438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-07 03:52:09 +00:00
void ReadWriteLock::writeUnlock()
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
{
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
Locker locker { m_lock };
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 https://bugs.webkit.org/show_bug.cgi?id=175083 Reviewed by Oliver Hunt. Source/JavaScriptCore: This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, even if we are using the pop path. Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile the world just because we changed it. Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it easier to debug leaks. * bytecode/AccessCase.cpp: * bytecode/PolymorphicAccess.cpp: * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCellInlines.h: (JSC::HeapCell::isLive): Deleted. * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::endMarking): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::specializedSweep): * jit/AssemblyHelpers.cpp: * jit/Repatch.cpp: * runtime/TestRunnerUtils.h: * runtime/VM.cpp: (JSC::waitForVMDestruction): (JSC::VM::~VM): Source/WTF: Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is guaranted to bias in favor of writers or not. * WTF.xcodeproj/project.pbxproj: * wtf/Condition.h: (WTF::ConditionBase::construct): (WTF::Condition::Condition): * wtf/Lock.h: (WTF::LockBase::construct): (WTF::Lock::Lock): * wtf/ReadWriteLock.cpp: Added. (WTF::ReadWriteLockBase::construct): (WTF::ReadWriteLockBase::readLock): (WTF::ReadWriteLockBase::readUnlock): (WTF::ReadWriteLockBase::writeLock): (WTF::ReadWriteLockBase::writeUnlock): * wtf/ReadWriteLock.h: Added. (WTF::ReadWriteLockBase::ReadLock::tryLock): (WTF::ReadWriteLockBase::ReadLock::lock): (WTF::ReadWriteLockBase::ReadLock::unlock): (WTF::ReadWriteLockBase::WriteLock::tryLock): (WTF::ReadWriteLockBase::WriteLock::lock): (WTF::ReadWriteLockBase::WriteLock::unlock): (WTF::ReadWriteLockBase::read): (WTF::ReadWriteLockBase::write): (WTF::ReadWriteLock::ReadWriteLock): Tools: Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI to wait for VM destructions to finish before running the next test. This makes it easier to understand leaks results from workers tests, and leads to fewer reported leaks. * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Canonical link: https://commits.webkit.org/191978@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-06 04:43:37 +00:00
m_isWriteLocked = false;
m_cond.notifyAll();
}
} // namespace WTF