#ifndef V8_HEAP_CPPGC_OBJECT_POISONER_H_
#define V8_HEAP_CPPGC_OBJECT_POISONER_H_
#include "src/base/sanitizer/asan.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/heap-page.h"
#include "src/heap/cppgc/heap-visitor.h"
#include "src/heap/cppgc/object-view.h"
namespace cppgc {
namespace internal {
#ifdef V8_USE_ADDRESS_SANITIZER
class UnmarkedObjectsPoisoner : public HeapVisitor<UnmarkedObjectsPoisoner> {
friend class HeapVisitor<UnmarkedObjectsPoisoner>;
private:
bool VisitHeapObjectHeader(HeapObjectHeader& header) {
if (header.IsFree() || header.IsMarked()) return true;
ASAN_POISON_MEMORY_REGION(header.ObjectStart(),
ObjectView<>(header).Size());
return true;
}
};
#endif
}
}
#endif