Skip to content

Conversation

Constellation
Copy link
Member

@Constellation Constellation commented Nov 29, 2023

e0c479c

[JSC] Use synchronous GCActivityCallback GC with RunLoopObserver
https://bugs.webkit.org/show_bug.cgi?id=265515
rdar://118930139

Reviewed by Wenson Hsieh.

Now we can schedule GC only when we are idle from GCActivityCallback. So we do not need to run async version.
This patch changes two things.

1. We set up RunLoopObserver and run GC when RunLoop gets idle state after GCActivityCallback detects GC opportunities.
2. We use sync GC instead of async GC since we now run this only when we are idle. We do not need to run async version.

* Source/JavaScriptCore/heap/EdenGCActivityCallback.cpp:
(JSC::EdenGCActivityCallback::EdenGCActivityCallback):
(JSC::EdenGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/EdenGCActivityCallback.h:
(JSC::EdenGCActivityCallback::tryCreate):
* Source/JavaScriptCore/heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::FullGCActivityCallback):
(JSC::FullGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/FullGCActivityCallback.h:
(JSC::FullGCActivityCallback::tryCreate):
* Source/JavaScriptCore/heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::GCActivityCallback):
* Source/JavaScriptCore/heap/GCActivityCallback.h:
* Source/JavaScriptCore/heap/Synchronousness.h:
* Source/WebCore/page/OpportunisticTaskScheduler.cpp:
(WebCore::OpportunisticTaskScheduler::FullGCActivityCallback::FullGCActivityCallback):
(WebCore::OpportunisticTaskScheduler::FullGCActivityCallback::doCollection):
(WebCore::OpportunisticTaskScheduler::EdenGCActivityCallback::EdenGCActivityCallback):
(WebCore::OpportunisticTaskScheduler::EdenGCActivityCallback::doCollection):
* Source/WebCore/page/OpportunisticTaskScheduler.h:

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

5e9f357

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv-sim ✅ 🛠 jsc-armv7
✅ 🛠 watch ❌ 🧪 jsc-armv7-tests
✅ 🛠 🧪 unsafe-merge ✅ 🛠 watch-sim

@Constellation Constellation requested review from cdumez and a team as code owners November 29, 2023 14:31
@Constellation Constellation self-assigned this Nov 29, 2023
@Constellation Constellation added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Nov 29, 2023
@Constellation Constellation requested a review from whsieh November 29, 2023 14:31
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 29, 2023
@Constellation Constellation removed the merging-blocked Applied to prevent a change from being merged label Nov 29, 2023
@Constellation Constellation force-pushed the eng/JSC-Use-synchronous-GCActivityCallback-GC-with-RunLoopObserver branch from 49f77af to 5e9f357 Compare November 29, 2023 18:47
@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 30, 2023
https://bugs.webkit.org/show_bug.cgi?id=265515
rdar://118930139

Reviewed by Wenson Hsieh.

Now we can schedule GC only when we are idle from GCActivityCallback. So we do not need to run async version.
This patch changes two things.

1. We set up RunLoopObserver and run GC when RunLoop gets idle state after GCActivityCallback detects GC opportunities.
2. We use sync GC instead of async GC since we now run this only when we are idle. We do not need to run async version.

* Source/JavaScriptCore/heap/EdenGCActivityCallback.cpp:
(JSC::EdenGCActivityCallback::EdenGCActivityCallback):
(JSC::EdenGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/EdenGCActivityCallback.h:
(JSC::EdenGCActivityCallback::tryCreate):
* Source/JavaScriptCore/heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::FullGCActivityCallback):
(JSC::FullGCActivityCallback::doCollection):
* Source/JavaScriptCore/heap/FullGCActivityCallback.h:
(JSC::FullGCActivityCallback::tryCreate):
* Source/JavaScriptCore/heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::GCActivityCallback):
* Source/JavaScriptCore/heap/GCActivityCallback.h:
* Source/JavaScriptCore/heap/Synchronousness.h:
* Source/WebCore/page/OpportunisticTaskScheduler.cpp:
(WebCore::OpportunisticTaskScheduler::FullGCActivityCallback::FullGCActivityCallback):
(WebCore::OpportunisticTaskScheduler::FullGCActivityCallback::doCollection):
(WebCore::OpportunisticTaskScheduler::EdenGCActivityCallback::EdenGCActivityCallback):
(WebCore::OpportunisticTaskScheduler::EdenGCActivityCallback::doCollection):
* Source/WebCore/page/OpportunisticTaskScheduler.h:

Canonical link: https://commits.webkit.org/271324@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Use-synchronous-GCActivityCallback-GC-with-RunLoopObserver branch from 5e9f357 to e0c479c Compare November 30, 2023 03:28
@webkit-commit-queue
Copy link
Collaborator

Committed 271324@main (e0c479c): https://commits.webkit.org/271324@main

Reviewed commits have been landed. Closing PR #21050 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit e0c479c into WebKit:main Nov 30, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants