Commit 084de665 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

heap: Introduce Isolate::RequestGarbageCollectionForTesting with stack state

Once CppHeap moves away from EmbedderHeapTracer, it can no longer be
returned by Isolate::GetEmbedderHeapTracer. Blink currently uses
GetEmbedderHeapTracer to trigger GCs. This CL introduces a variant of
Isolate::RequestGarbageCollectionForTesting to replace that.

Bug: v8:12407
Change-Id: I099989f55291a0daab7d2051072dedddef58dd40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3293413
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78015}
parent 6a2cf923
......@@ -1134,6 +1134,21 @@ class V8_EXPORT Isolate {
*/
void RequestGarbageCollectionForTesting(GarbageCollectionType type);
/**
* Request garbage collection with a specific embedderstack state in this
* Isolate. It is only valid to call this function if --expose_gc was
* specified.
*
* This should only be used for testing purposes and not to enforce a garbage
* collection schedule. It has strong negative impact on the garbage
* collection performance. Use IdleNotificationDeadline() or
* LowMemoryNotification() instead to influence the garbage collection
* schedule.
*/
void RequestGarbageCollectionForTesting(
GarbageCollectionType type,
EmbedderHeapTracer::EmbedderStackState stack_state);
/**
* Set the callback to invoke for logging event.
*/
......
......@@ -8562,6 +8562,17 @@ void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) {
}
}
void Isolate::RequestGarbageCollectionForTesting(
GarbageCollectionType type,
EmbedderHeapTracer::EmbedderStackState stack_state) {
if (type == kFullGarbageCollection) {
reinterpret_cast<i::Isolate*>(this)
->heap()
->SetEmbedderStackStateForNextFinalization(stack_state);
}
RequestGarbageCollectionForTesting(type);
}
Isolate* Isolate::GetCurrent() {
i::Isolate* isolate = i::Isolate::Current();
return reinterpret_cast<Isolate*>(isolate);
......
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