#include "src/heap/cppgc/sweeper.h"
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
#include "include/cppgc/platform.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/time.h"
#include "src/heap/cppgc/free-list.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap-base.h"
#include "src/heap/cppgc/heap-config.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/heap-page.h"
#include "src/heap/cppgc/heap-space.h"
#include "src/heap/cppgc/heap-visitor.h"
#include "src/heap/cppgc/memory.h"
#include "src/heap/cppgc/object-poisoner.h"
#include "src/heap/cppgc/object-start-bitmap.h"
#include "src/heap/cppgc/page-memory.h"
#include "src/heap/cppgc/raw-heap.h"
#include "src/heap/cppgc/stats-collector.h"
#include "src/heap/cppgc/task-handle.h"
namespace cppgc::internal {
namespace {
class DeadlineChecker final { … };
enum class MutatorThreadSweepingMode { … };
constexpr const char* ToString(MutatorThreadSweepingMode sweeping_mode) { … }
enum class StickyBits : uint8_t { … };
class ObjectStartBitmapVerifier
: private HeapVisitor<ObjectStartBitmapVerifier> { … };
class FreeHandlerBase { … };
class DiscardingFreeHandler : public FreeHandlerBase { … };
class RegularFreeHandler : public FreeHandlerBase { … };
template <typename T>
class ThreadSafeStack { … };
struct SweepingState { … };
SpaceStates;
void StickyUnmark(HeapObjectHeader* header, StickyBits sticky_bits) { … }
class InlinedFinalizationBuilderBase { … };
template <typename FreeHandler>
class InlinedFinalizationBuilder final : public InlinedFinalizationBuilderBase,
public FreeHandler { … };
template <typename FreeHandler>
class DeferredFinalizationBuilder final : public FreeHandler { … };
template <typename FinalizationBuilder>
typename FinalizationBuilder::ResultType SweepNormalPage(
NormalPage* page, PageAllocator& page_allocator, StickyBits sticky_bits) { … }
constexpr BaseSpace* kSweepWithoutSpaceAssignment = …;
enum class EmptyPageHandling { … };
class SweepFinalizer final { … };
class MutatorThreadSweeper final : private HeapVisitor<MutatorThreadSweeper> { … };
class ConcurrentSweepTask final : public cppgc::JobTask,
private HeapVisitor<ConcurrentSweepTask> { … };
class PrepareForSweepVisitor final
: protected HeapVisitor<PrepareForSweepVisitor> { … };
}
class Sweeper::SweeperImpl final { … };
Sweeper::Sweeper(HeapBase& heap)
: … { … }
Sweeper::~Sweeper() = default;
void Sweeper::Start(SweepingConfig config) { … }
bool Sweeper::FinishIfRunning() { … }
void Sweeper::FinishIfOutOfWork() { … }
void Sweeper::WaitForConcurrentSweepingForTesting() { … }
bool Sweeper::SweepForAllocationIfRunning(NormalPageSpace* space, size_t size,
v8::base::TimeDelta max_duration) { … }
bool Sweeper::IsSweepingOnMutatorThread() const { … }
bool Sweeper::IsSweepingInProgress() const { … }
bool Sweeper::PerformSweepOnMutatorThread(v8::base::TimeDelta max_duration,
StatsCollector::ScopeId scope_id) { … }
Sweeper::SweepingOnMutatorThreadObserver::SweepingOnMutatorThreadObserver(
Sweeper& sweeper)
: … { … }
Sweeper::SweepingOnMutatorThreadObserver::~SweepingOnMutatorThreadObserver() { … }
}