Commit 56817380 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

cppgc: Add marking verifier test

Bug: chromium:1056170
Change-Id: I4f935e1e653b2b713e690d9cd7d8a624d7bf1536
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2413259
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69935}
parent 140271f2
......@@ -76,6 +76,28 @@ TEST_F(MarkingVerifierTest, DoesntDieOnMarkedWeakMember) {
VerifyMarking(Heap::From(GetHeap())->AsBase(), StackState::kNoHeapPointers);
}
namespace {
class GCedWithCallback : public GarbageCollected<GCedWithCallback> {
public:
template <typename Callback>
explicit GCedWithCallback(Callback callback) {
callback(this);
}
void Trace(cppgc::Visitor* visitor) const {}
};
} // namespace
TEST_F(MarkingVerifierTest, DoesntDieOnInConstructionOnObject) {
MakeGarbageCollected<GCedWithCallback>(
GetAllocationHandle(), [this](GCedWithCallback* obj) {
HeapObjectHeader::FromPayload(obj).TryMarkAtomic();
VerifyMarking(Heap::From(GetHeap())->AsBase(),
StackState::kMayContainHeapPointers);
});
}
// Death tests.
namespace {
......
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