#include "src/heap/concurrent-marking.h"
#include <algorithm>
#include <atomic>
#include <stack>
#include <unordered_map>
#include "include/v8config.h"
#include "src/base/logging.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/flags/flags.h"
#include "src/heap/base/cached-unordered-map.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/mark-compact-inl.h"
#include "src/heap/mark-compact.h"
#include "src/heap/marking-state-inl.h"
#include "src/heap/marking-visitor-inl.h"
#include "src/heap/marking-visitor.h"
#include "src/heap/marking.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/memory-measurement-inl.h"
#include "src/heap/memory-measurement.h"
#include "src/heap/minor-mark-sweep-inl.h"
#include "src/heap/minor-mark-sweep.h"
#include "src/heap/mutable-page-metadata.h"
#include "src/heap/object-lock.h"
#include "src/heap/objects-visiting-inl.h"
#include "src/heap/objects-visiting.h"
#include "src/heap/pretenuring-handler.h"
#include "src/heap/weak-object-worklists.h"
#include "src/heap/young-generation-marking-visitor.h"
#include "src/init/v8.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/hash-table-inl.h"
#include "src/objects/heap-object.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/transitions-inl.h"
#include "src/utils/utils-inl.h"
namespace v8 {
namespace internal {
struct MemoryChunkData final { … };
using MemoryChunkDataMap =
::heap::base::CachedUnorderedMap<MutablePageMetadata*, MemoryChunkData>;
class ConcurrentMarkingVisitor final
: public FullMarkingVisitorBase<ConcurrentMarkingVisitor> { … };
struct ConcurrentMarking::TaskState { … };
class ConcurrentMarking::JobTaskMajor : public v8::JobTask { … };
class ConcurrentMarking::JobTaskMinor : public v8::JobTask { … };
ConcurrentMarking::ConcurrentMarking(Heap* heap, WeakObjects* weak_objects)
: … { … }
ConcurrentMarking::~ConcurrentMarking() = default;
void ConcurrentMarking::RunMajor(JobDelegate* delegate,
base::EnumSet<CodeFlushMode> code_flush_mode,
unsigned mark_compact_epoch,
bool should_keep_ages_unchanged) { … }
class ConcurrentMarking::MinorMarkingState { … };
namespace {
V8_INLINE bool IsYoungObjectInLab(MainAllocator* new_space_allocator,
NewLargeObjectSpace* new_lo_space,
Tagged<HeapObject> heap_object) { … }
}
template <YoungGenerationMarkingVisitationMode marking_mode>
V8_INLINE size_t ConcurrentMarking::RunMinorImpl(JobDelegate* delegate,
TaskState* task_state) { … }
void ConcurrentMarking::RunMinor(JobDelegate* delegate) { … }
size_t ConcurrentMarking::GetMajorMaxConcurrency(size_t worker_count) { … }
size_t ConcurrentMarking::GetMinorMaxConcurrency(size_t worker_count) { … }
void ConcurrentMarking::TryScheduleJob(GarbageCollector garbage_collector,
TaskPriority priority) { … }
bool ConcurrentMarking::IsWorkLeft() const { … }
void ConcurrentMarking::RescheduleJobIfNeeded(
GarbageCollector garbage_collector, TaskPriority priority) { … }
void ConcurrentMarking::FlushPretenuringFeedback() { … }
void ConcurrentMarking::Join() { … }
bool ConcurrentMarking::Pause() { … }
bool ConcurrentMarking::IsStopped() { … }
void ConcurrentMarking::Resume() { … }
void ConcurrentMarking::FlushNativeContexts(NativeContextStats* main_stats) { … }
void ConcurrentMarking::FlushMemoryChunkData() { … }
void ConcurrentMarking::ClearMemoryChunkData(MutablePageMetadata* chunk) { … }
size_t ConcurrentMarking::TotalMarkedBytes() { … }
ConcurrentMarking::PauseScope::PauseScope(ConcurrentMarking* concurrent_marking)
: … { … }
ConcurrentMarking::PauseScope::~PauseScope() { … }
}
}