%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_ #define V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_ #include "src/heap/cppgc/marker.h" #include "src/heap/cppgc/sweeper.h" namespace cppgc { namespace internal { // GC interface that allows abstraction over the actual GC invocation. This is // needed to mock/fake GC for testing. class GarbageCollector { public: struct Config { using CollectionType = Marker::MarkingConfig::CollectionType; using StackState = cppgc::Heap::StackState; using MarkingType = Marker::MarkingConfig::MarkingType; using SweepingType = Sweeper::SweepingConfig::SweepingType; using FreeMemoryHandling = Sweeper::SweepingConfig::FreeMemoryHandling; using IsForcedGC = Marker::MarkingConfig::IsForcedGC; static constexpr Config ConservativeAtomicConfig() { return {CollectionType::kMajor, StackState::kMayContainHeapPointers, MarkingType::kAtomic, SweepingType::kAtomic}; } static constexpr Config PreciseAtomicConfig() { return {CollectionType::kMajor, StackState::kNoHeapPointers, MarkingType::kAtomic, SweepingType::kAtomic}; } static constexpr Config ConservativeIncrementalConfig() { return {CollectionType::kMajor, StackState::kMayContainHeapPointers, MarkingType::kIncremental, SweepingType::kAtomic}; } static constexpr Config PreciseIncrementalConfig() { return {CollectionType::kMajor, StackState::kNoHeapPointers, MarkingType::kIncremental, SweepingType::kAtomic}; } static constexpr Config PreciseIncrementalMarkingConcurrentSweepingConfig() { return {CollectionType::kMajor, StackState::kNoHeapPointers, MarkingType::kIncremental, SweepingType::kIncrementalAndConcurrent}; } static constexpr Config MinorPreciseAtomicConfig() { return {CollectionType::kMinor, StackState::kNoHeapPointers, MarkingType::kAtomic, SweepingType::kAtomic}; } CollectionType collection_type = CollectionType::kMajor; StackState stack_state = StackState::kMayContainHeapPointers; MarkingType marking_type = MarkingType::kAtomic; SweepingType sweeping_type = SweepingType::kAtomic; FreeMemoryHandling free_memory_handling = FreeMemoryHandling::kDoNotDiscard; IsForcedGC is_forced_gc = IsForcedGC::kNotForced; }; // Executes a garbage collection specified in config. virtual void CollectGarbage(Config) = 0; virtual void StartIncrementalGarbageCollection(Config) = 0; // The current epoch that the GC maintains. The epoch is increased on every // GC invocation. virtual size_t epoch() const = 0; }; } // namespace internal } // namespace cppgc #endif // V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_