#ifndef V8_HEAP_CPPGC_MARKING_STATE_H_
#define V8_HEAP_CPPGC_MARKING_STATE_H_
#include <algorithm>
#include "include/cppgc/trace-trait.h"
#include "include/cppgc/visitor.h"
#include "src/base/logging.h"
#include "src/base/macros.h"
#include "src/heap/base/cached-unordered-map.h"
#include "src/heap/base/stack.h"
#include "src/heap/cppgc/compaction-worklists.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/heap-page.h"
#include "src/heap/cppgc/liveness-broker.h"
#include "src/heap/cppgc/marking-worklists.h"
namespace cppgc {
namespace internal {
class MarkingStateBase { … };
MarkingStateBase::MarkingStateBase(HeapBase& heap,
MarkingWorklists& marking_worklists)
: … { … }
void MarkingStateBase::MarkAndPush(const void* object, TraceDescriptor desc) { … }
void MarkingStateBase::MarkAndPush(HeapObjectHeader& header,
TraceDescriptor desc) { … }
bool MarkingStateBase::MarkNoPush(HeapObjectHeader& header) { … }
void MarkingStateBase::MarkAndPush(HeapObjectHeader& header) { … }
void MarkingStateBase::PushMarked(HeapObjectHeader& header,
TraceDescriptor desc) { … }
class BasicMarkingState : public MarkingStateBase { … };
void BasicMarkingState::RegisterWeakReferenceIfNeeded(
const void* object, TraceDescriptor desc, WeakCallback weak_callback,
const void* parameter) { … }
void BasicMarkingState::RegisterWeakContainerCallback(WeakCallback callback,
const void* object) { … }
void BasicMarkingState::RegisterWeakCustomCallback(WeakCallback callback,
const void* object) { … }
void BasicMarkingState::RegisterWeakContainer(HeapObjectHeader& header) { … }
void BasicMarkingState::ProcessWeakContainer(const void* object,
TraceDescriptor desc,
WeakCallback callback,
const void* data) { … }
void BasicMarkingState::ProcessEphemeron(const void* key, const void* value,
TraceDescriptor value_desc,
Visitor& visitor) { … }
void BasicMarkingState::AccountMarkedBytes(const HeapObjectHeader& header) { … }
void BasicMarkingState::AccountMarkedBytes(BasePage* base_page,
size_t marked_bytes) { … }
class MutatorMarkingState final : public BasicMarkingState { … };
void MutatorMarkingState::ReTraceMarkedWeakContainer(cppgc::Visitor& visitor,
HeapObjectHeader& header) { … }
void MutatorMarkingState::DynamicallyMarkAddress(ConstAddress address) { … }
void MutatorMarkingState::InvokeWeakRootsCallbackIfNeeded(
const void* object, TraceDescriptor desc, WeakCallback weak_callback,
const void* parameter) { … }
bool MutatorMarkingState::IsMarkedWeakContainer(HeapObjectHeader& header) { … }
bool MutatorMarkingState::RecentlyRetracedWeakContainers::Contains(
const HeapObjectHeader* header) const { … }
void MutatorMarkingState::RecentlyRetracedWeakContainers::Insert(
const HeapObjectHeader* header) { … }
class ConcurrentMarkingState final : public BasicMarkingState { … };
template <size_t deadline_check_interval, typename WorklistLocal,
typename Callback, typename Predicate>
bool DrainWorklistWithPredicate(Predicate should_yield,
WorklistLocal& worklist_local,
Callback callback) { … }
template <AccessMode mode>
void DynamicallyTraceMarkedObject(Visitor& visitor,
const HeapObjectHeader& header) { … }
}
}
#endif