Ignore:
Timestamp:
Jul 22, 2017, 7:36:18 AM (8 years ago)
Author:
[email protected]
Message:

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.cpp:

(bmalloc::StaticMutex::lockSlowCase):

Source/JavaScriptCore:


Use the new WTF::Thread::yield() function for yielding instead of the C++ function.

  • heap/Heap.cpp:

(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):

  • runtime/JSLock.cpp:

(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/ThreadingWin.cpp:

(WTF::Thread::yield):

  • wtf/WordLock.cpp:

(WTF::WordLockBase::lockSlow):
(WTF::WordLockBase::unlockSlow):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSLock.cpp

    r219696 r219763  
    247247    while (dropper->dropDepth() != m_lockDropDepth) {
    248248        unlock(droppedLockCount);
    249         std::this_thread::yield();
     249        Thread::yield();
    250250        lock(droppedLockCount);
    251251    }
Note: See TracChangeset for help on using the changeset viewer.