Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=156647 Reviewed by Saam Barati. Source/JavaScriptCore: Given that there there are only 128 FLS indices compared to over a 1000 for TLS, I eliminated the thread specific m_threadSpecificForThread and instead we look for the current thread in m_registeredThreads list when we need it. In most cases there will only be one thread. * heap/MachineStackMarker.cpp: (JSC::MachineThreads::MachineThreads): (JSC::MachineThreads::~MachineThreads): (JSC::MachineThreads::addCurrentThread): (JSC::MachineThreads::machineThreadForCurrentThread): (JSC::MachineThreads::removeThread): * heap/MachineStackMarker.h: Source/WTF: If a thread was created without using the WTF thread apis and that thread uses a JavaScript VM and that thread exits with the VM still around, JSC won't know that the thread has exited. Currently, we use ThreadSpecificThreadExit() to clean up any thread specific keys. Cleaning up these keys is how JSC is notified of a thread exit. We only call ThreadSpecificThreadExit() from wtfThreadEntryPoint() when the thread entry point function returns. This mechanism was put in place for Windows because we layer the WTF::ThreadSpecific functionality on top of TLS (Thread Local Storage), but TLS doesn't have a thread exiting callback the way that pthread_create_key. The fix is to change from using TLS to using FLS (Fiber Local Storage). Although Windows allows multiple fibers per thread, WebKit is not designed to work with a multiple fibers per thread. When there is only one fiber per thread, FLS works just like TLS, but it has the destroy callback. I restructured the Windows version of WTF::ThreadSpecific to be almost the same as the pthread version. * wtf/ThreadSpecific.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): (WTF::ThreadSpecific<T>::ThreadSpecific): (WTF::ThreadSpecific<T>::~ThreadSpecific): (WTF::ThreadSpecific<T>::get): (WTF::ThreadSpecific<T>::set): (WTF::ThreadSpecific<T>::destroy): Restructured to use FLS. Renamed TLS* to FLS*. * wtf/ThreadSpecificWin.cpp: (WTF::flsKeyCount): (WTF::flsKeys): Renamed from tlsKey*() to flsKey*(). (WTF::destructorsList): Deleted. (WTF::destructorsMutex): Deleted. (WTF::PlatformThreadSpecificKey::PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::~PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::setValue): Deleted. (WTF::PlatformThreadSpecificKey::value): Deleted. (WTF::PlatformThreadSpecificKey::callDestructor): Deleted. (WTF::tlsKeyCount): Deleted. (WTF::tlsKeys): Deleted. (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. (WTF::ThreadSpecificThreadExit): Deleted. * wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Eliminated call to ThreadSpecificThreadExit. LayoutTests: Disabled fast/workers/dedicated-worker-lifecycle.html as it creates more workers that we have ThreadSpecific keys. We need at least one key per JSC VM we create. I didn't want to weaken the test for other platforms. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/174861@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
9 changed files
with
145 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.