[webkit-changes] [WebKit/WebKit] 17e76f: [JSC] Skip notifyOne when all JIT threads are running

Yusuke Suzuki noreply at github.com
Fri Feb 9 19:44:01 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 17e76f594e5e272dd97df44490f16d5079daa273
      https://github.com/WebKit/WebKit/commit/17e76f594e5e272dd97df44490f16d5079daa273
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-02-09 (Fri, 09 Feb 2024)

  Changed paths:
    M Source/JavaScriptCore/jit/JITWorklist.cpp
    M Source/JavaScriptCore/jit/JITWorklist.h
    M Source/JavaScriptCore/jit/JITWorklistThread.cpp
    M Source/JavaScriptCore/jit/JITWorklistThread.h

  Log Message:
  -----------
  [JSC] Skip notifyOne when all JIT threads are running
https://bugs.webkit.org/show_bug.cgi?id=269111
rdar://122677279

Reviewed by Mark Lam.

Let's avoid calling notifyOne when all JIT threads are currently running.
In that case, they will pick the enqueued plan without notifying anyway.
This can skip some of costly syscalls like pthread_condvar related ones.
We also change JITWorklist::suspendAllThreads to first use tryLock for all threads.
So then, we can eagerly suspend currently-not-running-threads. And after that,
we eventually ensure all threads are not running. This avoids starting JIT compilation
in the latter thread while it was not having that when JITWorklist::suspendAllThreads started.

* Source/JavaScriptCore/jit/JITWorklist.cpp:
(JSC::JITWorklist::JITWorklist):
(JSC::JITWorklist::enqueue):
(JSC::JITWorklist::removeDeadPlans):
(JSC::JITWorklist::visitWeakReferences):
* Source/JavaScriptCore/jit/JITWorklist.h:
* Source/JavaScriptCore/jit/JITWorklistThread.cpp:
(JSC::JITWorklistThread::work):
* Source/JavaScriptCore/jit/JITWorklistThread.h:

Canonical link: https://commits.webkit.org/274407@main




More information about the webkit-changes mailing list