#include "include/cppgc/internal/write-barrier.h"
#include <algorithm>
#include <initializer_list>
#include <vector>
#include "include/cppgc/heap-consistency.h"
#include "include/cppgc/internal/pointer-policies.h"
#include "src/base/logging.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/marker.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
class V8_NODISCARD IncrementalMarkingScope { … };
constexpr MarkingConfig IncrementalMarkingScope::kIncrementalConfig;
class V8_NODISCARD ExpectWriteBarrierFires final
: private IncrementalMarkingScope { … };
class V8_NODISCARD ExpectNoWriteBarrierFires final
: private IncrementalMarkingScope { … };
class GCed : public GarbageCollected<GCed> { … };
}
class WriteBarrierTest : public testing::TestWithHeap { … };
class NoWriteBarrierTest : public testing::TestWithHeap { … };
TEST_F(WriteBarrierTest, EnableDisableIncrementalMarking) { … }
TEST_F(WriteBarrierTest, TriggersWhenMarkingIsOn) { … }
TEST_F(NoWriteBarrierTest, BailoutWhenMarkingIsOff) { … }
TEST_F(WriteBarrierTest, BailoutIfMarked) { … }
TEST_F(WriteBarrierTest, MemberInitializingStoreNoBarrier) { … }
TEST_F(WriteBarrierTest, MemberReferenceAssignMember) { … }
TEST_F(WriteBarrierTest, MemberSetSentinelValueNoBarrier) { … }
TEST_F(WriteBarrierTest, MemberCopySentinelValueNoBarrier) { … }
namespace {
class Mixin : public GarbageCollectedMixin { … };
class ClassWithVirtual { … };
class Child : public GarbageCollected<Child>,
public ClassWithVirtual,
public Mixin { … };
class ParentWithMixinPointer : public GarbageCollected<ParentWithMixinPointer> { … };
}
TEST_F(WriteBarrierTest, WriteBarrierOnUnmarkedMixinApplication) { … }
TEST_F(WriteBarrierTest, NoWriteBarrierOnMarkedMixinApplication) { … }
WriteBarrierParams;
WriteBarrierType;
HeapConsistency;
TEST_F(NoWriteBarrierTest, WriteBarrierBailoutWhenMarkingIsOff) { … }
TEST_F(WriteBarrierTest, DijkstraWriteBarrierTriggersWhenMarkingIsOn) { … }
TEST_F(WriteBarrierTest, DijkstraWriteBarrierBailoutIfMarked) { … }
namespace {
struct InlinedObject { … };
class GCedWithInlinedArray : public GarbageCollected<GCedWithInlinedArray> { … };
}
TEST_F(WriteBarrierTest, DijkstraWriteBarrierRangeTriggersWhenMarkingIsOn) { … }
TEST_F(WriteBarrierTest, DijkstraWriteBarrierRangeBailoutIfMarked) { … }
TEST_F(WriteBarrierTest, SteeleWriteBarrierTriggersWhenMarkingIsOn) { … }
TEST_F(WriteBarrierTest, SteeleWriteBarrierBailoutIfNotMarked) { … }
}
}