Commit 0b95f282 authored by Simon Zünd's avatar Simon Zünd Committed by V8 LUCI CQ

Introduce Isolate::ClearCachesForTesting API method

This CL adds a new method intended for tests or lab settings to
cleanup V8 caches. The synchronous nature of the method greatly reduces
flakiness of blink leak detection in many cases.

Bug: chromium:1217831
Change-Id: I107eddc8b88d91aa7e69430ecfc135fe39538a5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2948666
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75041}
parent 783b4e50
......@@ -8719,6 +8719,13 @@ class V8_EXPORT Isolate {
*/
void MemoryPressureNotification(MemoryPressureLevel level);
/**
* Drop non-essential caches. Should only be called from testing code.
* The method can potentially block for a long time and does not necessarily
* trigger GC.
*/
void ClearCachesForTesting();
/**
* Methods below this point require holding a lock (using Locker) in
* a multi-threaded environment.
......
......@@ -8906,6 +8906,12 @@ void Isolate::MemoryPressureNotification(MemoryPressureLevel level) {
isolate->heap()->MemoryPressureNotification(level, on_isolate_thread);
}
void Isolate::ClearCachesForTesting() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->AbortConcurrentOptimization(i::BlockingBehavior::kBlock);
isolate->ClearSerializerData();
}
void Isolate::EnableMemorySavingsMode() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->EnableMemorySavingsMode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment