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

heap: Mark EmbedderHeapTracer::GarbageCollectionForTesting as deprecated

Bug: v8:12407
Change-Id: Iedf6154796423267fdb32125a408e580bb3c205b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3295349Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78030}
parent 39cd76ce
...@@ -210,6 +210,7 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -210,6 +210,7 @@ class V8_EXPORT EmbedderHeapTracer {
* *
* Should only be used in testing code. * Should only be used in testing code.
*/ */
V8_DEPRECATE_SOON("Use Isolate::RequestGarbageCollectionForTesting instead")
void GarbageCollectionForTesting(EmbedderStackState stack_state); void GarbageCollectionForTesting(EmbedderStackState stack_state);
/* /*
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "include/cppgc/heap-consistency.h" #include "include/cppgc/heap-consistency.h"
#include "include/cppgc/platform.h" #include "include/cppgc/platform.h"
#include "include/v8-isolate.h"
#include "include/v8-local-handle.h" #include "include/v8-local-handle.h"
#include "include/v8-platform.h" #include "include/v8-platform.h"
#include "src/base/logging.h" #include "src/base/logging.h"
...@@ -588,8 +589,9 @@ void CppHeap::CollectGarbageForTesting( ...@@ -588,8 +589,9 @@ void CppHeap::CollectGarbageForTesting(
SetStackEndOfCurrentGC(v8::base::Stack::GetCurrentStackPosition()); SetStackEndOfCurrentGC(v8::base::Stack::GetCurrentStackPosition());
if (isolate_) { if (isolate_) {
// Go through EmbedderHeapTracer API and perform a unified heap collection. reinterpret_cast<v8::Isolate*>(isolate_)
GarbageCollectionForTesting(stack_state); ->RequestGarbageCollectionForTesting(
v8::Isolate::kFullGarbageCollection, stack_state);
} else { } else {
// Perform an atomic GC, with starting incremental/concurrent marking and // Perform an atomic GC, with starting incremental/concurrent marking and
// immediately finalizing the garbage collection. // immediately finalizing the garbage collection.
......
...@@ -288,21 +288,6 @@ TEST(FinalizeTracingWhenMarking) { ...@@ -288,21 +288,6 @@ TEST(FinalizeTracingWhenMarking) {
CHECK(marking->IsStopped()); CHECK(marking->IsStopped());
} }
TEST(GarbageCollectionForTesting) {
ManualGCScope manual_gc;
i::FLAG_expose_gc = true;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
TestEmbedderHeapTracer tracer;
heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
int saved_gc_counter = i_isolate->heap()->gc_count();
tracer.GarbageCollectionForTesting(
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
CHECK_GT(i_isolate->heap()->gc_count(), saved_gc_counter);
}
namespace { namespace {
void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context, void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
......
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