haikuwebkit/Source/WTF/wtf/RawPointer.h

56 lines
1.7 KiB
C
Raw Permalink Normal View History

It should be possible to say dataLog("count = ", count, "\n") instead of dataLogF("count = %d\n", count) https://bugs.webkit.org/show_bug.cgi?id=103009 Reviewed by Michael Saboff. Source/JavaScriptCore: Instead of converting all of JSC to use the new dataLog()/print() methods, I just changed one place: dumping of abstract values. This is mainly just to ensure that the code I added to WTF is actually doing things. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): (WTF): (WTF::printInternal): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): (WTF): (WTF::printInternal): Source/WTF: Added the ability to use out.print(...) and dataLog(...) variadically and with WTF::printInternal(PrintStream&, const T&) overloads for any type T that you want to be able to pass as an argument to out.print() or dataLog(). Also added one example class for doing this: RawPointer, which can be used to force a pointer to be printed as "%p" rather than matching any overloads that you might want to introduce. * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/PrintStream.cpp: (WTF::printInternal): (WTF): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): (WTF): * wtf/RawPointer.h: Added. (WTF): (RawPointer): (WTF::RawPointer::RawPointer): (WTF::RawPointer::value): Canonical link: https://commits.webkit.org/121689@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-28 22:59:35 +00:00
/*
* Copyright (C) 2012 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
It should be possible to say dataLog("count = ", count, "\n") instead of dataLogF("count = %d\n", count) https://bugs.webkit.org/show_bug.cgi?id=103009 Reviewed by Michael Saboff. Source/JavaScriptCore: Instead of converting all of JSC to use the new dataLog()/print() methods, I just changed one place: dumping of abstract values. This is mainly just to ensure that the code I added to WTF is actually doing things. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): (WTF): (WTF::printInternal): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): (WTF): (WTF::printInternal): Source/WTF: Added the ability to use out.print(...) and dataLog(...) variadically and with WTF::printInternal(PrintStream&, const T&) overloads for any type T that you want to be able to pass as an argument to out.print() or dataLog(). Also added one example class for doing this: RawPointer, which can be used to force a pointer to be printed as "%p" rather than matching any overloads that you might want to introduce. * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/PrintStream.cpp: (WTF::printInternal): (WTF): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): (WTF): * wtf/RawPointer.h: Added. (WTF): (RawPointer): (WTF::RawPointer::RawPointer): (WTF::RawPointer::value): Canonical link: https://commits.webkit.org/121689@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-28 22:59:35 +00:00
namespace WTF {
class RawPointer {
public:
RawPointer()
[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_value(nullptr)
It should be possible to say dataLog("count = ", count, "\n") instead of dataLogF("count = %d\n", count) https://bugs.webkit.org/show_bug.cgi?id=103009 Reviewed by Michael Saboff. Source/JavaScriptCore: Instead of converting all of JSC to use the new dataLog()/print() methods, I just changed one place: dumping of abstract values. This is mainly just to ensure that the code I added to WTF is actually doing things. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): (WTF): (WTF::printInternal): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): (WTF): (WTF::printInternal): Source/WTF: Added the ability to use out.print(...) and dataLog(...) variadically and with WTF::printInternal(PrintStream&, const T&) overloads for any type T that you want to be able to pass as an argument to out.print() or dataLog(). Also added one example class for doing this: RawPointer, which can be used to force a pointer to be printed as "%p" rather than matching any overloads that you might want to introduce. * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/PrintStream.cpp: (WTF::printInternal): (WTF): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): (WTF): * wtf/RawPointer.h: Added. (WTF): (RawPointer): (WTF::RawPointer::RawPointer): (WTF::RawPointer::value): Canonical link: https://commits.webkit.org/121689@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-28 22:59:35 +00:00
{
}
explicit RawPointer(void* value)
: m_value(value)
{
}
It should be easy to find code blocks in debug dumps https://bugs.webkit.org/show_bug.cgi?id=103623 Source/JavaScriptCore: Reviewed by Goeffrey Garen. This gives CodeBlock a relatively strong, but also relatively compact, hash. We compute it lazily so that it only impacts run-time when debug support is enabled. We stringify it smartly so that it's short and easy to type. We base it on the source code so that the optimization level is irrelevant. And, we use SHA1 since it's already in our code base. Now, when a piece of code wants to print some debugging to say that it's operating on some code block, it can use this CodeBlockHash instead of memory addresses. This also takes CodeBlock debugging into the new world of print() and dataLog(). In particular, CodeBlock::dump() corresponds to the thing you want printed if you do: dataLog("I heart ", *myCodeBlock); Probably, you want to just print some identifying information at this point rather than the full bytecode dump. So, the existing CodeBlock::dump() has been renamed to CodeBlock::dumpBytecode(), and CodeBlock::dump() now prints the CodeBlockHash plus just a few little tidbits. Here's an example of CodeBlock::dump() output: EkILzr:[0x103883a00, BaselineFunctionCall] EkILzr is the CodeBlockHash. 0x103883a00 is the CodeBlock's address in memory. The other part is self-explanatory. Finally, this new notion of CodeBlockHash is available for other purposes like bisecting breakage. As such CodeBlockHash has all of the comparison operator overloads. When bisecting in DFGDriver.cpp, you can now say things like: if (codeBlock->hash() < CodeBlockHash("CAAAAA")) return false; And yes, CAAAAA is near the median hash, and the largest one is smaller than E99999. Such is life when you use base 62 to encode a 32-bit number. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * Target.pri: * bytecode/CallLinkInfo.h: (CallLinkInfo): (JSC::CallLinkInfo::specializationKind): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::hash): (JSC): (JSC::CodeBlock::dumpAssumingJITType): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/CodeBlock.h: (JSC::CodeBlock::specializationKind): (CodeBlock): (JSC::CodeBlock::getJITType): * bytecode/CodeBlockHash.cpp: Added. (JSC): (JSC::CodeBlockHash::CodeBlockHash): (JSC::CodeBlockHash::dump): * bytecode/CodeBlockHash.h: Added. (JSC): (CodeBlockHash): (JSC::CodeBlockHash::CodeBlockHash): (JSC::CodeBlockHash::hash): (JSC::CodeBlockHash::operator==): (JSC::CodeBlockHash::operator!=): (JSC::CodeBlockHash::operator<): (JSC::CodeBlockHash::operator>): (JSC::CodeBlockHash::operator<=): (JSC::CodeBlockHash::operator>=): * bytecode/CodeBlockWithJITType.h: Added. (JSC): (CodeBlockWithJITType): (JSC::CodeBlockWithJITType::CodeBlockWithJITType): (JSC::CodeBlockWithJITType::dump): * bytecode/CodeOrigin.cpp: Added. (JSC): (JSC::CodeOrigin::inlineDepthForCallFrame): (JSC::CodeOrigin::inlineDepth): (JSC::CodeOrigin::inlineStack): (JSC::InlineCallFrame::hash): * bytecode/CodeOrigin.h: (InlineCallFrame): (JSC::InlineCallFrame::specializationKind): (JSC): * bytecode/CodeType.cpp: Added. (WTF): (WTF::printInternal): * bytecode/CodeType.h: (WTF): * bytecode/ExecutionCounter.cpp: (JSC::ExecutionCounter::dump): * bytecode/ExecutionCounter.h: (ExecutionCounter): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseCodeBlock): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dumpCodeOrigin): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOperations.cpp: * dfg/DFGRepatch.cpp: (JSC::DFG::generateProtoChainAccessStub): (JSC::DFG::tryCacheGetByID): (JSC::DFG::tryBuildGetByIDList): (JSC::DFG::emitPutReplaceStub): (JSC::DFG::emitPutTransitionStub): (JSC::DFG::dfgLinkClosureCall): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpCallFrame): * jit/JITCode.cpp: Added. (WTF): (WTF::printInternal): * jit/JITCode.h: (JSC::JITCode::jitType): (WTF): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompilePutByVal): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/CodeSpecializationKind.cpp: Added. (WTF): (WTF::printInternal): * runtime/CodeSpecializationKind.h: (JSC::specializationFromIsCall): (JSC): (JSC::specializationFromIsConstruct): (WTF): * runtime/Executable.cpp: (JSC::ExecutableBase::hashFor): (JSC): (JSC::NativeExecutable::hashFor): (JSC::ScriptExecutable::hashFor): * runtime/Executable.h: (ExecutableBase): (NativeExecutable): (ScriptExecutable): (JSC::ScriptExecutable::source): Source/WTF: Reviewed by Geoffrey Garen. Changed RawPointer to accept both const void* and void*, and use the former internally. Cleaned up SHA1 so that the functionality already used internally for self-testing is available via the API. This includes addBytes(CString) and computing hex digests. * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): (RawPointer): (WTF::RawPointer::value): * wtf/SHA1.cpp: (WTF::expectSHA1): (WTF::SHA1::hexDigest): (WTF::SHA1::computeHexDigest): * wtf/SHA1.h: (WTF::SHA1::addBytes): Canonical link: https://commits.webkit.org/121814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-30 03:42:29 +00:00
explicit RawPointer(const void* value)
: m_value(value)
{
}
const void* value() const { return m_value; }
It should be possible to say dataLog("count = ", count, "\n") instead of dataLogF("count = %d\n", count) https://bugs.webkit.org/show_bug.cgi?id=103009 Reviewed by Michael Saboff. Source/JavaScriptCore: Instead of converting all of JSC to use the new dataLog()/print() methods, I just changed one place: dumping of abstract values. This is mainly just to ensure that the code I added to WTF is actually doing things. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): (WTF): (WTF::printInternal): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): (WTF): (WTF::printInternal): Source/WTF: Added the ability to use out.print(...) and dataLog(...) variadically and with WTF::printInternal(PrintStream&, const T&) overloads for any type T that you want to be able to pass as an argument to out.print() or dataLog(). Also added one example class for doing this: RawPointer, which can be used to force a pointer to be printed as "%p" rather than matching any overloads that you might want to introduce. * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/PrintStream.cpp: (WTF::printInternal): (WTF): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): (WTF): * wtf/RawPointer.h: Added. (WTF): (RawPointer): (WTF::RawPointer::RawPointer): (WTF::RawPointer::value): Canonical link: https://commits.webkit.org/121689@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-28 22:59:35 +00:00
private:
It should be easy to find code blocks in debug dumps https://bugs.webkit.org/show_bug.cgi?id=103623 Source/JavaScriptCore: Reviewed by Goeffrey Garen. This gives CodeBlock a relatively strong, but also relatively compact, hash. We compute it lazily so that it only impacts run-time when debug support is enabled. We stringify it smartly so that it's short and easy to type. We base it on the source code so that the optimization level is irrelevant. And, we use SHA1 since it's already in our code base. Now, when a piece of code wants to print some debugging to say that it's operating on some code block, it can use this CodeBlockHash instead of memory addresses. This also takes CodeBlock debugging into the new world of print() and dataLog(). In particular, CodeBlock::dump() corresponds to the thing you want printed if you do: dataLog("I heart ", *myCodeBlock); Probably, you want to just print some identifying information at this point rather than the full bytecode dump. So, the existing CodeBlock::dump() has been renamed to CodeBlock::dumpBytecode(), and CodeBlock::dump() now prints the CodeBlockHash plus just a few little tidbits. Here's an example of CodeBlock::dump() output: EkILzr:[0x103883a00, BaselineFunctionCall] EkILzr is the CodeBlockHash. 0x103883a00 is the CodeBlock's address in memory. The other part is self-explanatory. Finally, this new notion of CodeBlockHash is available for other purposes like bisecting breakage. As such CodeBlockHash has all of the comparison operator overloads. When bisecting in DFGDriver.cpp, you can now say things like: if (codeBlock->hash() < CodeBlockHash("CAAAAA")) return false; And yes, CAAAAA is near the median hash, and the largest one is smaller than E99999. Such is life when you use base 62 to encode a 32-bit number. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * Target.pri: * bytecode/CallLinkInfo.h: (CallLinkInfo): (JSC::CallLinkInfo::specializationKind): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::hash): (JSC): (JSC::CodeBlock::dumpAssumingJITType): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/CodeBlock.h: (JSC::CodeBlock::specializationKind): (CodeBlock): (JSC::CodeBlock::getJITType): * bytecode/CodeBlockHash.cpp: Added. (JSC): (JSC::CodeBlockHash::CodeBlockHash): (JSC::CodeBlockHash::dump): * bytecode/CodeBlockHash.h: Added. (JSC): (CodeBlockHash): (JSC::CodeBlockHash::CodeBlockHash): (JSC::CodeBlockHash::hash): (JSC::CodeBlockHash::operator==): (JSC::CodeBlockHash::operator!=): (JSC::CodeBlockHash::operator<): (JSC::CodeBlockHash::operator>): (JSC::CodeBlockHash::operator<=): (JSC::CodeBlockHash::operator>=): * bytecode/CodeBlockWithJITType.h: Added. (JSC): (CodeBlockWithJITType): (JSC::CodeBlockWithJITType::CodeBlockWithJITType): (JSC::CodeBlockWithJITType::dump): * bytecode/CodeOrigin.cpp: Added. (JSC): (JSC::CodeOrigin::inlineDepthForCallFrame): (JSC::CodeOrigin::inlineDepth): (JSC::CodeOrigin::inlineStack): (JSC::InlineCallFrame::hash): * bytecode/CodeOrigin.h: (InlineCallFrame): (JSC::InlineCallFrame::specializationKind): (JSC): * bytecode/CodeType.cpp: Added. (WTF): (WTF::printInternal): * bytecode/CodeType.h: (WTF): * bytecode/ExecutionCounter.cpp: (JSC::ExecutionCounter::dump): * bytecode/ExecutionCounter.h: (ExecutionCounter): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseCodeBlock): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dumpCodeOrigin): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOperations.cpp: * dfg/DFGRepatch.cpp: (JSC::DFG::generateProtoChainAccessStub): (JSC::DFG::tryCacheGetByID): (JSC::DFG::tryBuildGetByIDList): (JSC::DFG::emitPutReplaceStub): (JSC::DFG::emitPutTransitionStub): (JSC::DFG::dfgLinkClosureCall): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpCallFrame): * jit/JITCode.cpp: Added. (WTF): (WTF::printInternal): * jit/JITCode.h: (JSC::JITCode::jitType): (WTF): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompilePutByVal): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * runtime/CodeSpecializationKind.cpp: Added. (WTF): (WTF::printInternal): * runtime/CodeSpecializationKind.h: (JSC::specializationFromIsCall): (JSC): (JSC::specializationFromIsConstruct): (WTF): * runtime/Executable.cpp: (JSC::ExecutableBase::hashFor): (JSC): (JSC::NativeExecutable::hashFor): (JSC::ScriptExecutable::hashFor): * runtime/Executable.h: (ExecutableBase): (NativeExecutable): (ScriptExecutable): (JSC::ScriptExecutable::source): Source/WTF: Reviewed by Geoffrey Garen. Changed RawPointer to accept both const void* and void*, and use the former internally. Cleaned up SHA1 so that the functionality already used internally for self-testing is available via the API. This includes addBytes(CString) and computing hex digests. * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): (RawPointer): (WTF::RawPointer::value): * wtf/SHA1.cpp: (WTF::expectSHA1): (WTF::SHA1::hexDigest): (WTF::SHA1::computeHexDigest): * wtf/SHA1.h: (WTF::SHA1::addBytes): Canonical link: https://commits.webkit.org/121814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-30 03:42:29 +00:00
const void* m_value;
It should be possible to say dataLog("count = ", count, "\n") instead of dataLogF("count = %d\n", count) https://bugs.webkit.org/show_bug.cgi?id=103009 Reviewed by Michael Saboff. Source/JavaScriptCore: Instead of converting all of JSC to use the new dataLog()/print() methods, I just changed one place: dumping of abstract values. This is mainly just to ensure that the code I added to WTF is actually doing things. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): (WTF): (WTF::printInternal): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): (WTF): (WTF::printInternal): Source/WTF: Added the ability to use out.print(...) and dataLog(...) variadically and with WTF::printInternal(PrintStream&, const T&) overloads for any type T that you want to be able to pass as an argument to out.print() or dataLog(). Also added one example class for doing this: RawPointer, which can be used to force a pointer to be printed as "%p" rather than matching any overloads that you might want to introduce. * GNUmakefile.list.am: * WTF.gypi: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/PrintStream.cpp: (WTF::printInternal): (WTF): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): (WTF): * wtf/RawPointer.h: Added. (WTF): (RawPointer): (WTF::RawPointer::RawPointer): (WTF::RawPointer::value): Canonical link: https://commits.webkit.org/121689@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-28 22:59:35 +00:00
};
} // namespace WTF
using WTF::RawPointer;