#include "src/heap/cppgc/compactor.h"
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include "include/cppgc/macros.h"
#include "src/heap/cppgc/compaction-worklists.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap-base.h"
#include "src/heap/cppgc/heap-page.h"
#include "src/heap/cppgc/heap-space.h"
#include "src/heap/cppgc/memory.h"
#include "src/heap/cppgc/object-poisoner.h"
#include "src/heap/cppgc/raw-heap.h"
#include "src/heap/cppgc/stats-collector.h"
namespace cppgc {
namespace internal {
namespace {
static constexpr size_t kFreeListSizeThreshold = …;
class MovableReferences final { … };
void MovableReferences::AddOrFilter(MovableReference* slot) { … }
void MovableReferences::Relocate(Address from, Address to,
size_t size_including_header) { … }
void MovableReferences::RelocateInteriorReferences(Address from, Address to,
size_t size) { … }
class CompactionState final { … };
enum class StickyBits : uint8_t { … };
void CompactPage(NormalPage* page, CompactionState& compaction_state,
StickyBits sticky_bits) { … }
void CompactSpace(NormalPageSpace* space, MovableReferences& movable_references,
StickyBits sticky_bits) { … }
size_t UpdateHeapResidency(const std::vector<NormalPageSpace*>& spaces) { … }
}
Compactor::Compactor(RawHeap& heap) : … { … }
bool Compactor::ShouldCompact(GCConfig::MarkingType marking_type,
StackState stack_state) const { … }
void Compactor::InitializeIfShouldCompact(GCConfig::MarkingType marking_type,
StackState stack_state) { … }
void Compactor::CancelIfShouldNotCompact(GCConfig::MarkingType marking_type,
StackState stack_state) { … }
Compactor::CompactableSpaceHandling Compactor::CompactSpacesIfEnabled() { … }
void Compactor::EnableForNextGCForTesting() { … }
}
}