Skip to content

Commit 7cd0bde

Browse files
Taking some IOS GC branches for WPE as well
The aim is to make the GC more reliable on low-memory platforms. IOS branches applied: - FullGCActivityCallback::doCollection - do not bail out of GC early - MemoryPressureHandler - apply IOS defaults for conservative/strict mode thresholds - MemoryRelease / releaseCriticalMemory - request immediate GC - WorkerGlobalScope::deleteJSCodeAndGC - collect even if called with Synchronous::No
1 parent f0b98a4 commit 7cd0bde

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Source/JavaScriptCore/heap/FullGCActivityCallback.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void FullGCActivityCallback::doCollection(VM& vm)
4141
Heap& heap = vm.heap;
4242
m_didGCRecently = false;
4343

44-
#if !PLATFORM(IOS_FAMILY) || PLATFORM(MACCATALYST)
44+
#if (!PLATFORM(IOS_FAMILY) && !PLATFORM(WPE)) || PLATFORM(MACCATALYST)
4545
MonotonicTime startTime = MonotonicTime::now();
4646
if (MemoryPressureHandler::singleton().isUnderMemoryPressure() && heap.isPagedOut()) {
4747
cancel();

Source/WTF/wtf/MemoryPressureHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace WTF {
4040

4141
WTF_EXPORT_PRIVATE bool MemoryPressureHandler::ReliefLogger::s_loggingEnabled = false;
4242

43-
#if PLATFORM(IOS_FAMILY)
43+
#if PLATFORM(IOS_FAMILY) || PLATFORM(WPE)
4444
static const double s_conservativeThresholdFraction = 0.5;
4545
static const double s_strictThresholdFraction = 0.65;
4646
#else

Source/WebCore/page/MemoryRelease.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void releaseCriticalMemory(Synchronous synchronous, MaintainBackForwardCa
126126
GCController::singleton().deleteAllCode(JSC::DeleteAllCodeIfNotCollecting);
127127
GCController::singleton().garbageCollectNow();
128128
} else {
129-
#if PLATFORM(IOS_FAMILY)
129+
#if PLATFORM(IOS_FAMILY) || PLATFORM(WPE)
130130
GCController::singleton().garbageCollectNowIfNotDoneRecently();
131131
#else
132132
GCController::singleton().garbageCollectSoon();

Source/WebCore/workers/WorkerGlobalScope.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void WorkerGlobalScope::deleteJSCodeAndGC(Synchronous synchronous)
606606
return;
607607
}
608608
}
609-
#if PLATFORM(IOS_FAMILY)
609+
#if PLATFORM(IOS_FAMILY) || PLATFORM(WPE)
610610
if (!vm().heap.currentThreadIsDoingGCWork()) {
611611
vm().heap.collectNowFullIfNotDoneRecently(JSC::Async);
612612
return;

0 commit comments

Comments
 (0)