cppgc: Provide API to test if object is marked or freed

This is needed to support minor gc tests on the Blink side.

Bug: chromium:1029379
Change-Id: Ic7ce1ae8e626b87738d76663ceecf7198e425d18
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3437050
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78943}
This commit is contained in:
Anton Bikineev 2022-02-04 12:43:47 +01:00 committed by V8 LUCI CQ
parent fca5a7f350
commit 4c2b5f4d30
2 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,8 @@ class V8_EXPORT StandaloneTestingHeap final {
HeapHandle& heap_handle_;
};
V8_EXPORT bool IsHeapObjectOld(void*);
} // namespace testing
} // namespace cppgc

View File

@ -54,5 +54,13 @@ void StandaloneTestingHeap::ForceCompactionForNextGarbageCollection() {
.EnableForNextGCForTesting();
}
bool IsHeapObjectOld(void* object) {
#if defined(CPPGC_YOUNG_GENERATION)
return internal::HeapObjectHeader::FromObject(object).IsMarked();
#else
return true;
#endif
}
} // namespace testing
} // namespace cppgc