chromium/v8/src/heap/cppgc/compactor.cc

// 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.

#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 {
// Freelist size threshold that must be exceeded before compaction
// should be considered.
static constexpr size_t kFreeListSizeThreshold =;

// The real worker behind heap compaction, recording references to movable
// objects ("slots".) When the objects end up being compacted and moved,
// relocate() will adjust the slots to point to the new location of the
// object along with handling references for interior pointers.
//
// The MovableReferences object is created and maintained for the lifetime
// of one heap compaction-enhanced GC.
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) {}

}  // namespace

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() {}

}  // namespace internal
}  // namespace cppgc