From 72dbc541a5887963bfcedaa329f9fe1e88d8e5a6 Mon Sep 17 00:00:00 2001 From: tomasz-karczewski-red Date: Tue, 22 Oct 2024 11:07:55 +0200 Subject: [PATCH 1/3] FullGCActivityCallback: take IOS GC branch for WPE The aim is to make the GC more reliable on low-memory platforms. In FullGCActivityCallback, the change is to do not bail out of GC early. --- Source/JavaScriptCore/heap/FullGCActivityCallback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/JavaScriptCore/heap/FullGCActivityCallback.cpp b/Source/JavaScriptCore/heap/FullGCActivityCallback.cpp index 114e3f21f3ddc..c6c49f7bf7037 100644 --- a/Source/JavaScriptCore/heap/FullGCActivityCallback.cpp +++ b/Source/JavaScriptCore/heap/FullGCActivityCallback.cpp @@ -41,7 +41,7 @@ void FullGCActivityCallback::doCollection(VM& vm) Heap& heap = vm.heap; m_didGCRecently = false; -#if !PLATFORM(IOS_FAMILY) || PLATFORM(MACCATALYST) +#if (!PLATFORM(IOS_FAMILY) && !PLATFORM(WPE)) || PLATFORM(MACCATALYST) MonotonicTime startTime = MonotonicTime::now(); if (MemoryPressureHandler::singleton().isUnderMemoryPressure() && heap.isPagedOut()) { cancel(); From 181fb01e5aea0a4ad9117c96d9f0f837277ccc2a Mon Sep 17 00:00:00 2001 From: tomasz-karczewski-red Date: Tue, 22 Oct 2024 11:09:45 +0200 Subject: [PATCH 2/3] MemoryRelease: take IOS GC branch for WPE The aim is to make the GC more reliable on low-memory platforms. In MemoryRelease, the change is to request immediate GC in releaseCriticalMemory. --- Source/WebCore/page/MemoryRelease.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/WebCore/page/MemoryRelease.cpp b/Source/WebCore/page/MemoryRelease.cpp index f13783a3f7c37..560272ed4f2d6 100644 --- a/Source/WebCore/page/MemoryRelease.cpp +++ b/Source/WebCore/page/MemoryRelease.cpp @@ -126,7 +126,7 @@ static void releaseCriticalMemory(Synchronous synchronous, MaintainBackForwardCa GCController::singleton().deleteAllCode(JSC::DeleteAllCodeIfNotCollecting); GCController::singleton().garbageCollectNow(); } else { -#if PLATFORM(IOS_FAMILY) +#if PLATFORM(IOS_FAMILY) || PLATFORM(WPE) GCController::singleton().garbageCollectNowIfNotDoneRecently(); #else GCController::singleton().garbageCollectSoon(); From 8c1c5e5bed3f03ef304ec65e1c64a538bfc39a64 Mon Sep 17 00:00:00 2001 From: tomasz-karczewski-red Date: Tue, 22 Oct 2024 11:11:05 +0200 Subject: [PATCH 3/3] WorkerGlobalScope: take IOS GC branch for WPE The aim is to make the GC more reliable on low-memory platforms. In WorkerGlobalScope::deleteJSCodeAndGC the change is to collect even if called with 'Synchronous::No' --- Source/WebCore/workers/WorkerGlobalScope.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/WebCore/workers/WorkerGlobalScope.cpp b/Source/WebCore/workers/WorkerGlobalScope.cpp index 8b56344669fa2..2149dd867fa58 100644 --- a/Source/WebCore/workers/WorkerGlobalScope.cpp +++ b/Source/WebCore/workers/WorkerGlobalScope.cpp @@ -606,7 +606,7 @@ void WorkerGlobalScope::deleteJSCodeAndGC(Synchronous synchronous) return; } } -#if PLATFORM(IOS_FAMILY) +#if PLATFORM(IOS_FAMILY) || PLATFORM(WPE) if (!vm().heap.currentThreadIsDoingGCWork()) { vm().heap.collectNowFullIfNotDoneRecently(JSC::Async); return;