#include "src/heap/heap-verifier.h"
#include <optional>
#include "include/v8-locker.h"
#include "src/base/logging.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/reloc-info.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/heap/array-buffer-sweeper.h"
#include "src/heap/combined-heap.h"
#include "src/heap/ephemeron-remembered-set.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/heap.h"
#include "src/heap/large-spaces.h"
#include "src/heap/memory-chunk-layout.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/memory-chunk.h"
#include "src/heap/new-spaces.h"
#include "src/heap/objects-visiting-inl.h"
#include "src/heap/paged-spaces.h"
#include "src/heap/read-only-heap.h"
#include "src/heap/read-only-spaces.h"
#include "src/heap/remembered-set.h"
#include "src/heap/safepoint.h"
#include "src/objects/code-inl.h"
#include "src/objects/code.h"
#include "src/objects/maybe-object.h"
#include "src/objects/slots-inl.h"
#include "src/objects/string-table.h"
#ifdef VERIFY_HEAP
namespace v8 {
namespace internal {
namespace {
thread_local Tagged<HeapObject> pending_layout_change_object = …;
}
class VerifySmisVisitor final : public RootVisitor { … };
class VerifyPointersVisitor : public ObjectVisitorWithCageBases,
public RootVisitor { … };
void VerifyPointersVisitor::VisitPointers(Tagged<HeapObject> host,
ObjectSlot start, ObjectSlot end) { … }
void VerifyPointersVisitor::VisitPointers(Tagged<HeapObject> host,
MaybeObjectSlot start,
MaybeObjectSlot end) { … }
void VerifyPointersVisitor::VisitInstructionStreamPointer(
Tagged<Code> host, InstructionStreamSlot slot) { … }
void VerifyPointersVisitor::VisitRootPointers(Root root,
const char* description,
FullObjectSlot start,
FullObjectSlot end) { … }
void VerifyPointersVisitor::VisitRootPointers(Root root,
const char* description,
OffHeapObjectSlot start,
OffHeapObjectSlot end) { … }
void VerifyPointersVisitor::VisitMapPointer(Tagged<HeapObject> host) { … }
void VerifyPointersVisitor::VerifyHeapObjectImpl(
Tagged<HeapObject> heap_object) { … }
void VerifyPointersVisitor::VerifyCodeObjectImpl(
Tagged<HeapObject> heap_object) { … }
template <typename TSlot>
void VerifyPointersVisitor::VerifyPointersImpl(TSlot start, TSlot end) { … }
void VerifyPointersVisitor::VerifyPointers(Tagged<HeapObject> host,
MaybeObjectSlot start,
MaybeObjectSlot end) { … }
void VerifyPointersVisitor::VisitCodeTarget(Tagged<InstructionStream> host,
RelocInfo* rinfo) { … }
void VerifyPointersVisitor::VisitEmbeddedPointer(Tagged<InstructionStream> host,
RelocInfo* rinfo) { … }
class VerifyReadOnlyPointersVisitor : public VerifyPointersVisitor { … };
class VerifySharedHeapObjectVisitor : public VerifyPointersVisitor { … };
class HeapVerification final : public SpaceVerificationVisitor { … };
void HeapVerification::Verify() { … }
void HeapVerification::VerifySpace(BaseSpace* space) { … }
void HeapVerification::VerifyPage(const MemoryChunkMetadata* chunk_metadata) { … }
void HeapVerification::VerifyPageDone(const MemoryChunkMetadata* chunk) { … }
void HeapVerification::VerifyObject(Tagged<HeapObject> object) { … }
void HeapVerification::VerifyOutgoingPointers(Tagged<HeapObject> object) { … }
void HeapVerification::VerifyObjectMap(Tagged<HeapObject> object) { … }
void HeapVerification::VerifyReadOnlyHeap() { … }
class SlotVerifyingVisitor : public ObjectVisitorWithCageBases { … };
class OldToNewSlotVerifyingVisitor : public SlotVerifyingVisitor { … };
class OldToSharedSlotVerifyingVisitor : public SlotVerifyingVisitor { … };
template <RememberedSetType direction>
void CollectSlots(MutablePageMetadata* chunk, Address start, Address end,
std::set<Address>* untyped,
std::set<std::pair<SlotType, Address>>* typed) { … }
class SlotCollectingVisitor final : public ObjectVisitor { … };
void HeapVerification::VerifyRememberedSetFor(Tagged<HeapObject> object) { … }
void HeapVerifier::VerifyHeap(Heap* heap) { … }
void HeapVerifier::VerifyReadOnlyHeap(Heap* heap) { … }
void HeapVerifier::VerifyObjectLayoutChangeIsAllowed(
Heap* heap, Tagged<HeapObject> object) { … }
void HeapVerifier::SetPendingLayoutChangeObject(Heap* heap,
Tagged<HeapObject> object) { … }
void HeapVerifier::VerifyObjectLayoutChange(Heap* heap,
Tagged<HeapObject> object,
Tagged<Map> new_map) { … }
void HeapVerifier::VerifySafeMapTransition(Heap* heap,
Tagged<HeapObject> object,
Tagged<Map> new_map) { … }
}
}
#endif