#include "src/heap/cppgc/marker.h"
#include <memory>
#include "include/cppgc/allocation.h"
#include "include/cppgc/ephemeron-pair.h"
#include "include/cppgc/internal/pointer-policies.h"
#include "include/cppgc/member.h"
#include "include/cppgc/persistent.h"
#include "include/cppgc/trace-trait.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/marking-visitor.h"
#include "src/heap/cppgc/object-allocator.h"
#include "src/heap/cppgc/stats-collector.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
class MarkerTest : public testing::TestWithHeap { … };
class GCed : public GarbageCollected<GCed> { … };
template <typename T>
V8_NOINLINE T access(volatile const T& t) { … }
}
TEST_F(MarkerTest, PersistentIsMarked) { … }
TEST_F(MarkerTest, ReachableMemberIsMarked) { … }
TEST_F(MarkerTest, UnreachableMemberIsNotMarked) { … }
TEST_F(MarkerTest, ObjectReachableFromStackIsMarked) { … }
TEST_F(MarkerTest, ObjectReachableOnlyFromStackIsNotMarkedIfStackIsEmpty) { … }
TEST_F(MarkerTest, WeakReferenceToUnreachableObjectIsCleared) { … }
TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) { … }
TEST_F(MarkerTest, DeepHierarchyIsMarked) { … }
TEST_F(MarkerTest, NestedObjectsOnStackAreMarked) { … }
namespace {
class GCedWithCallback : public GarbageCollected<GCedWithCallback> { … };
}
TEST_F(MarkerTest, InConstructionObjectIsEventuallyMarkedEmptyStack) { … }
TEST_F(MarkerTest, InConstructionObjectIsEventuallyMarkedNonEmptyStack) { … }
namespace {
class GCObliviousObjectStorage final { … };
V8_NOINLINE void RegisterInConstructionObject(
AllocationHandle& allocation_handle, Visitor& v,
GCObliviousObjectStorage& storage) { … }
}
TEST_F(MarkerTest,
InConstructionObjectIsEventuallyMarkedDifferentNonEmptyStack) { … }
TEST_F(MarkerTest, SentinelNotClearedOnWeakPersistentHandling) { … }
namespace {
class SimpleObject final : public GarbageCollected<SimpleObject> { … };
class ObjectWithEphemeronPair final
: public GarbageCollected<ObjectWithEphemeronPair> { … };
}
TEST_F(MarkerTest, MarkerProcessesAllEphemeronPairs) { … }
class IncrementalMarkingTest : public testing::TestWithHeap { … };
constexpr MarkingConfig IncrementalMarkingTest::IncrementalPreciseMarkingConfig;
TEST_F(IncrementalMarkingTest, RootIsMarkedAfterMarkingStarted) { … }
TEST_F(IncrementalMarkingTest, MemberIsMarkedAfterMarkingSteps) { … }
TEST_F(IncrementalMarkingTest,
MemberWithWriteBarrierIsMarkedAfterMarkingSteps) { … }
namespace {
class Holder : public GarbageCollected<Holder> { … };
}
TEST_F(IncrementalMarkingTest, IncrementalStepDuringAllocation) { … }
TEST_F(IncrementalMarkingTest, MarkingRunsOutOfWorkEventually) { … }
}
}