#include "src/heap/scavenger.h"
#include <atomic>
#include <optional>
#include "src/common/globals.h"
#include "src/handles/global-handles.h"
#include "src/heap/array-buffer-sweeper.h"
#include "src/heap/concurrent-marking.h"
#include "src/heap/ephemeron-remembered-set.h"
#include "src/heap/gc-tracer-inl.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
#include "src/heap/large-page-metadata-inl.h"
#include "src/heap/mark-compact-inl.h"
#include "src/heap/mark-compact.h"
#include "src/heap/memory-chunk-layout.h"
#include "src/heap/mutable-page-metadata-inl.h"
#include "src/heap/mutable-page-metadata.h"
#include "src/heap/objects-visiting-inl.h"
#include "src/heap/pretenuring-handler.h"
#include "src/heap/remembered-set-inl.h"
#include "src/heap/scavenger-inl.h"
#include "src/heap/slot-set.h"
#include "src/heap/sweeper.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/objects-body-descriptors-inl.h"
#include "src/objects/slots.h"
#include "src/objects/transitions-inl.h"
#include "src/utils/utils-inl.h"
namespace v8 {
namespace internal {
class IterateAndScavengePromotedObjectsVisitor final : public ObjectVisitor { … };
namespace {
V8_INLINE bool IsUnscavengedHeapObject(Heap* heap, Tagged<Object> object) { … }
V8_INLINE bool IsUnscavengedHeapObject(Heap* heap,
Tagged<HeapObject> heap_object) { … }
bool IsUnscavengedHeapObjectSlot(Heap* heap, FullObjectSlot p) { … }
}
ScavengerCollector::JobTask::JobTask(
ScavengerCollector* outer,
std::vector<std::unique_ptr<Scavenger>>* scavengers,
std::vector<std::pair<ParallelWorkItem, MutablePageMetadata*>>
memory_chunks,
Scavenger::CopiedList* copied_list,
Scavenger::PromotionList* promotion_list)
: … { … }
void ScavengerCollector::JobTask::Run(JobDelegate* delegate) { … }
size_t ScavengerCollector::JobTask::GetMaxConcurrency(
size_t worker_count) const { … }
void ScavengerCollector::JobTask::ProcessItems(JobDelegate* delegate,
Scavenger* scavenger) { … }
void ScavengerCollector::JobTask::ConcurrentScavengePages(
Scavenger* scavenger) { … }
ScavengerCollector::ScavengerCollector(Heap* heap)
: … { … }
namespace {
class GlobalHandlesWeakRootsUpdatingVisitor final : public RootVisitor { … };
}
class V8_NODISCARD ScopedFullHeapCrashKey { … };
void ScavengerCollector::CollectGarbage() { … }
void ScavengerCollector::IterateStackAndScavenge(
RootScavengeVisitor* root_scavenge_visitor,
std::vector<std::unique_ptr<Scavenger>>* scavengers, int main_thread_id) { … }
void ScavengerCollector::SweepArrayBufferExtensions() { … }
void ScavengerCollector::HandleSurvivingNewLargeObjects() { … }
void ScavengerCollector::MergeSurvivingNewLargeObjects(
const SurvivingNewLargeObjectsMap& objects) { … }
int ScavengerCollector::NumberOfScavengeTasks() { … }
Scavenger::PromotionList::Local::Local(Scavenger::PromotionList* promotion_list)
: … { … }
Scavenger::Scavenger(ScavengerCollector* collector, Heap* heap, bool is_logging,
EmptyChunksList* empty_chunks, CopiedList* copied_list,
PromotionList* promotion_list,
EphemeronRememberedSet::TableList* ephemeron_table_list,
int task_id)
: … { … }
void Scavenger::IterateAndScavengePromotedObject(Tagged<HeapObject> target,
Tagged<Map> map, int size) { … }
void Scavenger::RememberPromotedEphemeron(Tagged<EphemeronHashTable> table,
int index) { … }
void Scavenger::ScavengePage(MutablePageMetadata* page) { … }
void Scavenger::Process(JobDelegate* delegate) { … }
void ScavengerCollector::ProcessWeakReferences(
EphemeronRememberedSet::TableList* ephemeron_table_list) { … }
void ScavengerCollector::ClearYoungEphemerons(
EphemeronRememberedSet::TableList* ephemeron_table_list) { … }
void ScavengerCollector::ClearOldEphemerons() { … }
void Scavenger::Finalize() { … }
void Scavenger::Publish() { … }
void Scavenger::AddEphemeronHashTable(Tagged<EphemeronHashTable> table) { … }
template <typename TSlot>
void Scavenger::CheckOldToNewSlotForSharedUntyped(MemoryChunk* chunk,
MutablePageMetadata* page,
TSlot slot) { … }
void Scavenger::CheckOldToNewSlotForSharedTyped(
MemoryChunk* chunk, MutablePageMetadata* page, SlotType slot_type,
Address slot_address, Tagged<MaybeObject> new_target) { … }
void RootScavengeVisitor::VisitRootPointer(Root root, const char* description,
FullObjectSlot p) { … }
void RootScavengeVisitor::VisitRootPointers(Root root, const char* description,
FullObjectSlot start,
FullObjectSlot end) { … }
void RootScavengeVisitor::ScavengePointer(FullObjectSlot p) { … }
RootScavengeVisitor::RootScavengeVisitor(Scavenger* scavenger)
: … { … }
ScavengeVisitor::ScavengeVisitor(Scavenger* scavenger)
: … { … }
}
}