Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c9eac47597dd0447d181e32ef2436cfce67791c
      
https://github.com/WebKit/WebKit/commit/5c9eac47597dd0447d181e32ef2436cfce67791c
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2023-11-17 (Fri, 17 Nov 2023)

  Changed paths:
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/heap/EdenGCActivityCallback.cpp
    M Source/JavaScriptCore/heap/EdenGCActivityCallback.h
    M Source/JavaScriptCore/heap/FullGCActivityCallback.cpp
    M Source/JavaScriptCore/heap/FullGCActivityCallback.h
    M Source/JavaScriptCore/heap/GCActivityCallback.cpp
    M Source/JavaScriptCore/heap/GCActivityCallback.h
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/heap/MarkedSpace.cpp
    M Source/JavaScriptCore/heap/MarkedSpace.h
    M Source/JavaScriptCore/runtime/DeferredWorkTimer.h
    M Source/JavaScriptCore/runtime/JSRunLoopTimer.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/WebCore/bindings/js/CommonVM.cpp
    M Source/WebCore/page/OpportunisticTaskScheduler.cpp
    M Source/WebCore/page/OpportunisticTaskScheduler.h

  Log Message:
  -----------
  Adjust GC Timer a bit with heuristics to avoid running it while critical 
tasks are waiting
https://bugs.webkit.org/show_bug.cgi?id=265055
rdar://118574205

Reviewed by Wenson Hsieh and Justin Michaud.

We found that GC timer fires randomly and it runs GC at random timing. We 
should avoid
running it when there is critical tasks are waiting. This patch starts with a 
naive simple
approach which just defers this GC invocation with some threshold when there is 
a waiting task.
We are not directly using OpportunisticTaskScheduler since it is active only 
when a page is visible
and active, but we would like to run this GC for background page too. 
Eventually we would like
to unify both into one global mechanism but we put it as a future work.

* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/heap/EdenGCActivityCallback.cpp:
(JSC::EdenGCActivityCallback::EdenGCActivityCallback):
(JSC::EdenGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/EdenGCActivityCallback.h:
(JSC::EdenGCActivityCallback::tryCreate):
(): Deleted.
(JSC::GCActivityCallback::tryCreateEdenTimer): Deleted.
* Source/JavaScriptCore/heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::FullGCActivityCallback):
(JSC::FullGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/FullGCActivityCallback.h:
(JSC::FullGCActivityCallback::tryCreate):
(): Deleted.
(JSC::GCActivityCallback::tryCreateFullTimer): Deleted.
* Source/JavaScriptCore/heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::GCActivityCallback):
(JSC::GCActivityCallback::scheduleTimer):
* Source/JavaScriptCore/heap/GCActivityCallback.h:
(JSC::GCActivityCallback::didGCRecently const):
(JSC::GCActivityCallback::setDidGCRecently):
(JSC::GCActivityCallback::GCActivityCallback):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::collect):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::collectNowFullIfNotDoneRecently):
(JSC::Heap::setFullActivityCallback):
(JSC::Heap::setEdenActivityCallback):
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/heap/MarkedSpace.cpp:
(JSC::MarkedSpace::beginMarking):
* Source/JavaScriptCore/heap/MarkedSpace.h:
(JSC::MarkedSpace::edenVersion const):
* Source/JavaScriptCore/runtime/DeferredWorkTimer.h:
* Source/JavaScriptCore/runtime/JSRunLoopTimer.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::performOpportunisticallyScheduledTasks):
* Source/WebCore/bindings/js/CommonVM.cpp:
(WebCore::commonVMSlow):
* Source/WebCore/page/OpportunisticTaskScheduler.cpp:
(WebCore::OpportunisticTaskScheduler::runLoopObserverFired):
(WebCore::isBusyForTimerBasedGC):
(WebCore::OpportunisticTaskScheduler::FullGCActivityCallback::doCollection):
(WebCore::OpportunisticTaskScheduler::EdenGCActivityCallback::doCollection):
* Source/WebCore/page/OpportunisticTaskScheduler.h:
(WebCore::OpportunisticTaskScheduler::create): Deleted.
(WebCore::OpportunisticTaskScheduler::willQueueIdleCallback): Deleted.
(WebCore::OpportunisticTaskScheduler::hasImminentlyScheduledWork const): 
Deleted.

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to