It should be easy to decide how WebKit yields
https://bugs.webkit.org/show_bug.cgi?id=174298
Reviewed by Saam Barati.
Source/bmalloc:
Use sched_yield() explicitly.
(bmalloc::StaticMutex::lockSlowCase):
Source/JavaScriptCore:
Use the new WTF::Thread::yield() function for yielding instead of the C++ function.
(JSC::Heap::resumeThePeriphery):
- heap/VisitingTimeout.h:
- runtime/JSCell.cpp:
(JSC::JSCell::lockSlow):
(JSC::JSCell::unlockSlow):
- runtime/JSCell.h:
- runtime/JSCellInlines.h:
(JSC::JSCell::lock):
(JSC::JSCell::unlock):
(JSC::JSLock::grabAllLocks):
- runtime/SamplingProfiler.cpp:
Source/WebCore:
No new tests because the WebCore change is just a change to how we #include things.
- inspector/InspectorPageAgent.h:
- inspector/TimelineRecordFactory.h:
- workers/Worker.h:
- workers/WorkerGlobalScopeProxy.h:
- workers/WorkerMessagingProxy.h:
Source/WebKitLegacy:
- Storage/StorageTracker.h:
Source/WTF:
Created a Thread::yield() abstraction for sched_yield(), and made WTF use it everywhere that it
had previously used std::this_thread::yield().
To make it less annoying to experiment with changes to the lock algorithm in the future, this also
moves the meat of the algorithm into LockAlgorithmInlines.h. Only two files include that header.
Since LockAlgorithm.h no longer includes ParkingLot.h, a bunch of files in WK now need to include
timing headers (Seconds, MonotonicTime, etc) manually.
- WTF.xcodeproj/project.pbxproj:
- benchmarks/ToyLocks.h:
- wtf/CMakeLists.txt:
- wtf/Lock.cpp:
- wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockSlow): Deleted.
(WTF::LockAlgorithm::unlockSlow): Deleted.
- wtf/LockAlgorithmInlines.h: Added.
(WTF::hasParkedBit>::lockSlow):
(WTF::hasParkedBit>::unlockSlow):
- wtf/MainThread.cpp:
- wtf/RunLoopTimer.h:
- wtf/Threading.cpp:
- wtf/Threading.h:
- wtf/ThreadingPthreads.cpp:
(WTF::Thread::yield):
(WTF::Thread::yield):
(WTF::WordLockBase::lockSlow):
(WTF::WordLockBase::unlockSlow):