haikuwebkit/Source/WTF/wtf/CompilationThread.cpp

41 lines
1.5 KiB
C++
Raw Permalink Normal View History

fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation https://bugs.webkit.org/show_bug.cgi?id=115297 Source/JavaScriptCore: Reviewed by Geoffrey Garen. Put in assertions that we're not doing bad things in compilation threads. Also factored compilation into compile+link so that even though we don't yet have concurrent compilation, we can be explicit about which parts of DFG work are meant to be concurrent, and which aren't. Also fix a handful of bugs found by these assertions. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ResolveGlobalStatus.cpp: (JSC::computeForStructure): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::add): (JSC::InlineWatchpointSet::inflateSlow): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::~JITCompiler): (DFG): (JSC::DFG::JITCompiler::compileBody): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: (JITCompiler): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLCompile.h: (FTL): * ftl/FTLLink.cpp: Added. (FTL): (JSC::FTL::compileEntry): (JSC::FTL::link): * ftl/FTLLink.h: Added. (FTL): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (FTL): (State): * runtime/Structure.cpp: (JSC::Structure::get): (JSC::Structure::prototypeChainMayInterceptStoreTo): * runtime/Structure.h: (JSC::Structure::materializePropertyMapIfNecessary): * runtime/StructureInlines.h: (JSC::Structure::get): Source/WTF: Reviewed by Geoffrey Garen. Taught WTF the notion of compilation threads. This allows all parts of our stack to assert that we're not being called from a JSC compilation thread. This is in WTF because it will probably end up being used in StringImpl and WTFString. * WTF.xcodeproj/project.pbxproj: * wtf/CompilationThread.cpp: Added. (WTF): (WTF::initializeCompilationThreadsOnce): (WTF::initializeCompilationThreads): (WTF::isCompilationThread): (WTF::exchangeIsCompilationThread): * wtf/CompilationThread.h: Added. (WTF): (CompilationScope): (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): Canonical link: https://commits.webkit.org/136918@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 03:59:09 +00:00
/*
The GC should be in a thread https://bugs.webkit.org/show_bug.cgi?id=163562 Reviewed by Geoffrey Garen and Andreas Kling. Source/JavaScriptCore: In a concurrent GC, the work of collecting happens on a separate thread. This patch implements this, and schedules the thread the way that a concurrent GC thread would be scheduled. But, the GC isn't actually concurrent yet because it calls stopTheWorld() before doing anything and calls resumeTheWorld() after it's done with everything. The next step will be to make it really concurrent by basically calling stopTheWorld()/resumeTheWorld() around bounded snippets of work while making most of the work happen with the world running. Our GC will probably always have stop-the-world phases because the semantics of JSC weak references call for it. This implements concurrent GC scheduling. This means that there is no longer a Heap::collect() API. Instead, you can call collectAsync() which makes sure that a GC is scheduled (it will do nothing if one is scheduled or ongoing) or you can call collectSync() to schedule a GC and wait for it to happen. I made our debugging stuff call collectSync(). It should be a goal to never call collectSync() except for debugging or benchmark harness hacks. The collector thread is an AutomaticThread, so it won't linger when not in use. It works on a ticket-based system, like you would see at the DMV. A ticket is a 64-bit integer. There are two ticket counters: last granted and last served. When you request a collection, last granted is incremented and its new value given to you. When a collection completes, last served is incremented. collectSync() waits until last served catches up to what last granted had been at the time you requested a GC. This means that if you request a sync GC in the middle of an async GC, you will wait for that async GC to finish and then you will request and wait for your sync GC. The synchronization between the collector thread and the main threads is complex. The collector thread needs to be able to ask the main thread to stop. It needs to be able to do some post-GC clean-up, like the synchronous CodeBlock and LargeAllocation sweeps, on the main thread. The collector needs to be able to ask the main thread to execute a cross-modifying code fence before running any JIT code, since the GC might aid the JIT worklist and run JIT finalization. It's possible for the GC to want the main thread to run something at the same time that the main thread wants to wait for the GC. The main thread needs to be able to run non-JSC stuff without causing the GC to completely stall. The main thread needs to be able to query its own state (is there a request to stop?) and change it (running JSC versus not) quickly, since this may happen on hot paths. This kind of intertwined system of requests, notifications, and state changes requires a combination of lock-free algorithms and waiting. So, this is all implemented using a Atomic<unsigned> Heap::m_worldState, which has bits to represent things being requested by the collector and the heap access state of the mutator. I am borrowing a lot of terms that I've seen in other VMs that I've worked on. Here's what they mean: - Stop the world: make sure that either the mutator is not running, or that it's not running code that could mess with the heap. - Heap access: the mutator is said to have heap access if it could mess with the heap. If you stop the world and the mutator doesn't have heap access, all you're doing is making sure that it will block when it tries to acquire heap access. This means that our GC is already fully concurrent in cases where the GC is requested while the mutator has no heap access. This probably won't happen, but if it did then it should just work. Usually, stopping the world means that we state our shouldStop request with m_worldState, and a future call to Heap::stopIfNecessary() will go to slow path and stop. The act of stopping or waiting to acquire heap access is managed by using ParkingLot API directly on m_worldState. This works out great because it would be very awkward to get the same functionality using locks and condition variables, since we want stopIfNecessary/acquireAccess/requestAccess fast paths that are single atomic instructions (load/CAS/CAS, respectively). The mutator will call these things frequently. Currently we have Heap::stopIfNecessary() polling on every allocator slow path, but we may want to make it even more frequent than that. Currently only JSC API clients benefit from the heap access optimization. The DOM forces us to assume that heap access is permanently on, since DOM manipulation doesn't always hold the JSLock. We could still allow the GC to proceed when the runloop is idle by having the GC put a task on the runloop that just calls stopIfNecessary(). This is perf neutral. The only behavior change that clients ought to observe is that marking and the weak fixpoint happen on a separate thread. Marking was already parallel so it already handled multiple threads, but now it _never_ runs on the main thread. The weak fixpoint needed some help to be able to run on another thread - mostly because there was some code in IndexedDB that was using thread specifics in the weak fixpoint. * API/JSBase.cpp: (JSSynchronousEdenCollectForDebugging): * API/JSManagedValue.mm: (-[JSManagedValue initWithValue:]): * heap/EdenGCActivityCallback.cpp: (JSC::EdenGCActivityCallback::doCollection): * heap/FullGCActivityCallback.cpp: (JSC::FullGCActivityCallback::doCollection): * heap/Heap.cpp: (JSC::Heap::Thread::Thread): (JSC::Heap::Heap): (JSC::Heap::lastChanceToFinalize): (JSC::Heap::markRoots): (JSC::Heap::gatherStackRoots): (JSC::Heap::deleteUnmarkedCompiledCode): (JSC::Heap::collectAllGarbage): (JSC::Heap::collectAsync): (JSC::Heap::collectSync): (JSC::Heap::shouldCollectInThread): (JSC::Heap::collectInThread): (JSC::Heap::stopTheWorld): (JSC::Heap::resumeTheWorld): (JSC::Heap::stopIfNecessarySlow): (JSC::Heap::acquireAccessSlow): (JSC::Heap::releaseAccessSlow): (JSC::Heap::handleDidJIT): (JSC::Heap::handleNeedFinalize): (JSC::Heap::setDidJIT): (JSC::Heap::setNeedFinalize): (JSC::Heap::waitWhileNeedFinalize): (JSC::Heap::finalize): (JSC::Heap::requestCollection): (JSC::Heap::waitForCollection): (JSC::Heap::didFinishCollection): (JSC::Heap::canCollect): (JSC::Heap::shouldCollectHeuristic): (JSC::Heap::shouldCollect): (JSC::Heap::collectIfNecessaryOrDefer): (JSC::Heap::collectAccordingToDeferGCProbability): (JSC::Heap::collect): Deleted. (JSC::Heap::collectWithoutAnySweep): Deleted. (JSC::Heap::collectImpl): Deleted. * heap/Heap.h: (JSC::Heap::ReleaseAccessScope::ReleaseAccessScope): (JSC::Heap::ReleaseAccessScope::~ReleaseAccessScope): * heap/HeapInlines.h: (JSC::Heap::acquireAccess): (JSC::Heap::releaseAccess): (JSC::Heap::stopIfNecessary): * heap/MachineStackMarker.cpp: (JSC::MachineThreads::gatherConservativeRoots): (JSC::MachineThreads::gatherFromCurrentThread): Deleted. * heap/MachineStackMarker.h: * jit/JITWorklist.cpp: (JSC::JITWorklist::completeAllForVM): * jit/JITWorklist.h: * jsc.cpp: (functionFullGC): (functionEdenGC): * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSLock.cpp: (JSC::JSLock::didAcquireLock): (JSC::JSLock::unlock): (JSC::JSLock::willReleaseLock): * tools/JSDollarVMPrototype.cpp: (JSC::JSDollarVMPrototype::edenGC): Source/WebCore: No new tests because existing tests cover this. We now need to be more careful about using JSLock. This fixes some places that were not holding it. New assertions in the GC are more likely to catch this than before. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): Source/WTF: This fixes some bugs and adds a few features. * wtf/Atomics.h: The GC may do work on behalf of the JIT. If it does, the main thread needs to execute a cross-modifying code fence. This is cpuid on x86 and I believe it's isb on ARM. It would have been an isync on PPC and I think that isb is the ARM equivalent. (WTF::arm_isb): (WTF::crossModifyingCodeFence): (WTF::x86_ortop): (WTF::x86_cpuid): * wtf/AutomaticThread.cpp: I accidentally had AutomaticThreadCondition inherit from ThreadSafeRefCounted<AutomaticThread> [sic]. This never crashed before because all of our prior AutomaticThreadConditions were immortal. (WTF::AutomaticThread::AutomaticThread): (WTF::AutomaticThread::~AutomaticThread): (WTF::AutomaticThread::start): * wtf/AutomaticThread.h: * wtf/MainThread.cpp: Need to allow initializeGCThreads() to be called separately because it's now more than just a debugging thing. (WTF::initializeGCThreads): Canonical link: https://commits.webkit.org/182065@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-02 22:01:04 +00:00
* Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation https://bugs.webkit.org/show_bug.cgi?id=115297 Source/JavaScriptCore: Reviewed by Geoffrey Garen. Put in assertions that we're not doing bad things in compilation threads. Also factored compilation into compile+link so that even though we don't yet have concurrent compilation, we can be explicit about which parts of DFG work are meant to be concurrent, and which aren't. Also fix a handful of bugs found by these assertions. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ResolveGlobalStatus.cpp: (JSC::computeForStructure): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::add): (JSC::InlineWatchpointSet::inflateSlow): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::~JITCompiler): (DFG): (JSC::DFG::JITCompiler::compileBody): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: (JITCompiler): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLCompile.h: (FTL): * ftl/FTLLink.cpp: Added. (FTL): (JSC::FTL::compileEntry): (JSC::FTL::link): * ftl/FTLLink.h: Added. (FTL): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (FTL): (State): * runtime/Structure.cpp: (JSC::Structure::get): (JSC::Structure::prototypeChainMayInterceptStoreTo): * runtime/Structure.h: (JSC::Structure::materializePropertyMapIfNecessary): * runtime/StructureInlines.h: (JSC::Structure::get): Source/WTF: Reviewed by Geoffrey Garen. Taught WTF the notion of compilation threads. This allows all parts of our stack to assert that we're not being called from a JSC compilation thread. This is in WTF because it will probably end up being used in StringImpl and WTFString. * WTF.xcodeproj/project.pbxproj: * wtf/CompilationThread.cpp: Added. (WTF): (WTF::initializeCompilationThreadsOnce): (WTF::initializeCompilationThreads): (WTF::isCompilationThread): (WTF::exchangeIsCompilationThread): * wtf/CompilationThread.h: Added. (WTF): (CompilationScope): (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): Canonical link: https://commits.webkit.org/136918@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 03:59:09 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#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/CompilationThread.h>
fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation https://bugs.webkit.org/show_bug.cgi?id=115297 Source/JavaScriptCore: Reviewed by Geoffrey Garen. Put in assertions that we're not doing bad things in compilation threads. Also factored compilation into compile+link so that even though we don't yet have concurrent compilation, we can be explicit about which parts of DFG work are meant to be concurrent, and which aren't. Also fix a handful of bugs found by these assertions. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ResolveGlobalStatus.cpp: (JSC::computeForStructure): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::add): (JSC::InlineWatchpointSet::inflateSlow): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::~JITCompiler): (DFG): (JSC::DFG::JITCompiler::compileBody): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: (JITCompiler): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLCompile.h: (FTL): * ftl/FTLLink.cpp: Added. (FTL): (JSC::FTL::compileEntry): (JSC::FTL::link): * ftl/FTLLink.h: Added. (FTL): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (FTL): (State): * runtime/Structure.cpp: (JSC::Structure::get): (JSC::Structure::prototypeChainMayInterceptStoreTo): * runtime/Structure.h: (JSC::Structure::materializePropertyMapIfNecessary): * runtime/StructureInlines.h: (JSC::Structure::get): Source/WTF: Reviewed by Geoffrey Garen. Taught WTF the notion of compilation threads. This allows all parts of our stack to assert that we're not being called from a JSC compilation thread. This is in WTF because it will probably end up being used in StringImpl and WTFString. * WTF.xcodeproj/project.pbxproj: * wtf/CompilationThread.cpp: Added. (WTF): (WTF::initializeCompilationThreadsOnce): (WTF::initializeCompilationThreads): (WTF::isCompilationThread): (WTF::exchangeIsCompilationThread): * wtf/CompilationThread.h: Added. (WTF): (CompilationScope): (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): Canonical link: https://commits.webkit.org/136918@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 03:59:09 +00:00
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/StdLibExtras.h>
#include <wtf/Threading.h>
fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation https://bugs.webkit.org/show_bug.cgi?id=115297 Source/JavaScriptCore: Reviewed by Geoffrey Garen. Put in assertions that we're not doing bad things in compilation threads. Also factored compilation into compile+link so that even though we don't yet have concurrent compilation, we can be explicit about which parts of DFG work are meant to be concurrent, and which aren't. Also fix a handful of bugs found by these assertions. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ResolveGlobalStatus.cpp: (JSC::computeForStructure): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::add): (JSC::InlineWatchpointSet::inflateSlow): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::~JITCompiler): (DFG): (JSC::DFG::JITCompiler::compileBody): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: (JITCompiler): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLCompile.h: (FTL): * ftl/FTLLink.cpp: Added. (FTL): (JSC::FTL::compileEntry): (JSC::FTL::link): * ftl/FTLLink.h: Added. (FTL): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (FTL): (State): * runtime/Structure.cpp: (JSC::Structure::get): (JSC::Structure::prototypeChainMayInterceptStoreTo): * runtime/Structure.h: (JSC::Structure::materializePropertyMapIfNecessary): * runtime/StructureInlines.h: (JSC::Structure::get): Source/WTF: Reviewed by Geoffrey Garen. Taught WTF the notion of compilation threads. This allows all parts of our stack to assert that we're not being called from a JSC compilation thread. This is in WTF because it will probably end up being used in StringImpl and WTFString. * WTF.xcodeproj/project.pbxproj: * wtf/CompilationThread.cpp: Added. (WTF): (WTF::initializeCompilationThreadsOnce): (WTF::initializeCompilationThreads): (WTF::isCompilationThread): (WTF::exchangeIsCompilationThread): * wtf/CompilationThread.h: Added. (WTF): (CompilationScope): (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): Canonical link: https://commits.webkit.org/136918@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 03:59:09 +00:00
namespace WTF {
bool isCompilationThread()
{
[WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread https://bugs.webkit.org/show_bug.cgi?id=197146 Reviewed by Saam Barati. Source/JavaScriptCore: Rename Heap::Thread to Heap::HeapThread to remove conflict between WTF::Thread. * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerDirectory): * heap/Heap.cpp: (JSC::Heap::HeapThread::HeapThread): (JSC::Heap::Heap): (JSC::Heap::runCurrentPhase): (JSC::Heap::runBeginPhase): (JSC::Heap::resumeThePeriphery): (JSC::Heap::requestCollection): (JSC::Heap::isCurrentThreadBusy): (JSC::Heap::notifyIsSafeToCollect): (JSC::Heap::Thread::Thread): Deleted. * heap/Heap.h: * heap/HeapInlines.h: (JSC::Heap::incrementDeferralDepth): (JSC::Heap::decrementDeferralDepth): (JSC::Heap::decrementDeferralDepthAndGCIfNeeded): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::prepareForAllocation): Source/WebCore: * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::hasPendingActivity const): * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::hasPendingActivity const): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::hasPendingActivity const): Source/WTF: Since GCThread and CompilationThread flags exist in WTF, we put these flags into WTF::Thread directly instead of holding them in ThreadSpecific<>. And this patch removes dependency from Threading.h to ThreadSpecific.h. ThreadSpecific.h's OS threading primitives are moved to ThreadingPrimitives.h, and Threading.h relies on it instead. * wtf/CompilationThread.cpp: (WTF::isCompilationThread): (WTF::initializeCompilationThreads): Deleted. (WTF::exchangeIsCompilationThread): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): * wtf/MainThread.cpp: (WTF::initializeMainThread): (WTF::initializeMainThreadToProcessMainThread): (WTF::isMainThreadOrGCThread): (WTF::initializeGCThreads): Deleted. (WTF::registerGCThread): Deleted. (WTF::mayBeGCThread): Deleted. * wtf/MainThread.h: * wtf/ThreadSpecific.h: (WTF::canBeGCThread>::ThreadSpecific): (WTF::canBeGCThread>::set): (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. * wtf/Threading.cpp: (WTF::Thread::exchangeIsCompilationThread): (WTF::Thread::registerGCThread): (WTF::Thread::mayBeGCThread): * wtf/Threading.h: (WTF::Thread::isCompilationThread const): (WTF::Thread::gcThreadType const): (WTF::Thread::joinableState const): (WTF::Thread::hasExited const): (WTF::Thread::Thread): (WTF::Thread::joinableState): Deleted. (WTF::Thread::hasExited): Deleted. * wtf/ThreadingPrimitives.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): * wtf/win/ThreadSpecificWin.cpp: (WTF::flsKeys): Canonical link: https://commits.webkit.org/211984@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245258 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-13 22:32:34 +00:00
return Thread::current().isCompilationThread();
fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation https://bugs.webkit.org/show_bug.cgi?id=115297 Source/JavaScriptCore: Reviewed by Geoffrey Garen. Put in assertions that we're not doing bad things in compilation threads. Also factored compilation into compile+link so that even though we don't yet have concurrent compilation, we can be explicit about which parts of DFG work are meant to be concurrent, and which aren't. Also fix a handful of bugs found by these assertions. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ResolveGlobalStatus.cpp: (JSC::computeForStructure): * bytecode/Watchpoint.cpp: (JSC::WatchpointSet::add): (JSC::InlineWatchpointSet::inflateSlow): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::~JITCompiler): (DFG): (JSC::DFG::JITCompiler::compileBody): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: (JITCompiler): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLCompile.h: (FTL): * ftl/FTLLink.cpp: Added. (FTL): (JSC::FTL::compileEntry): (JSC::FTL::link): * ftl/FTLLink.h: Added. (FTL): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (FTL): (State): * runtime/Structure.cpp: (JSC::Structure::get): (JSC::Structure::prototypeChainMayInterceptStoreTo): * runtime/Structure.h: (JSC::Structure::materializePropertyMapIfNecessary): * runtime/StructureInlines.h: (JSC::Structure::get): Source/WTF: Reviewed by Geoffrey Garen. Taught WTF the notion of compilation threads. This allows all parts of our stack to assert that we're not being called from a JSC compilation thread. This is in WTF because it will probably end up being used in StringImpl and WTFString. * WTF.xcodeproj/project.pbxproj: * wtf/CompilationThread.cpp: Added. (WTF): (WTF::initializeCompilationThreadsOnce): (WTF::initializeCompilationThreads): (WTF::isCompilationThread): (WTF::exchangeIsCompilationThread): * wtf/CompilationThread.h: Added. (WTF): (CompilationScope): (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): Canonical link: https://commits.webkit.org/136918@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 03:59:09 +00:00
}
} // namespace WTF