#include "src/heap/cppgc/marking-verifier.h"
#include "include/cppgc/allocation.h"
#include "include/cppgc/member.h"
#include "include/cppgc/persistent.h"
#include "include/cppgc/prefinalizer.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/heap.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
class MarkingVerifierTest : public testing::TestWithHeap { … };
class GCed : public GarbageCollected<GCed> { … };
template <typename T>
V8_NOINLINE T access(volatile const T& t) { … }
bool MarkHeader(HeapObjectHeader& header) { … }
}
TEST_F(MarkingVerifierTest, DoesNotDieOnMarkedOnStackReference) { … }
TEST_F(MarkingVerifierTest, DoesNotDieOnMarkedMember) { … }
TEST_F(MarkingVerifierTest, DoesNotDieOnMarkedWeakMember) { … }
namespace {
class GCedWithCallback : public GarbageCollected<GCedWithCallback> { … };
}
TEST_F(MarkingVerifierTest, DoesNotDieOnInConstructionOnObject) { … }
namespace {
class GCedWithCallbackAndChild final
: public GarbageCollected<GCedWithCallbackAndChild> { … };
template <typename T>
struct Holder : public GarbageCollected<Holder<T>> { … };
}
TEST_F(MarkingVerifierTest, DoesntDieOnInConstructionObjectWithWriteBarrier) { … }
namespace {
class MarkingVerifierDeathTest : public MarkingVerifierTest { … };
}
TEST_F(MarkingVerifierDeathTest, DieOnUnmarkedOnStackReference) { … }
TEST_F(MarkingVerifierDeathTest, DieOnUnmarkedMember) { … }
TEST_F(MarkingVerifierDeathTest, DieOnUnmarkedWeakMember) { … }
#ifdef CPPGC_VERIFY_HEAP
TEST_F(MarkingVerifierDeathTest, DieOnUnexpectedLiveByteCount) { … }
#endif
namespace {
template <template <typename T> class Reference>
class ResurrectingPreFinalizer
: public GarbageCollected<ResurrectingPreFinalizer<Reference>> { … };
}
template <template <typename T> class Reference>
void MarkingVerifierDeathTest::TestResurrectingPreFinalizer() { … }
#if CPPGC_VERIFY_HEAP
TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedMember) { … }
TEST_F(MarkingVerifierDeathTest, DiesOnResurrectedWeakMember) { … }
#endif
}
}