#ifndef V8_HEAP_CPPGC_MEMORY_H_
#define V8_HEAP_CPPGC_MEMORY_H_
#include <cstddef>
#include <cstdint>
#include <cstring>
#include "src/base/macros.h"
#include "src/base/sanitizer/asan.h"
#include "src/base/sanitizer/msan.h"
#include "src/heap/cppgc/globals.h"
namespace cppgc {
namespace internal {
V8_NOINLINE DISABLE_ASAN void NoSanitizeMemset(void* address, char c,
size_t bytes);
static constexpr uint8_t kZappedValue = …;
V8_INLINE void ZapMemory(void* address, size_t size) { … }
V8_INLINE void CheckMemoryIsZapped(const void* address, size_t size) { … }
V8_INLINE void CheckMemoryIsZero(const void* address, size_t size) { … }
#if defined(V8_USE_MEMORY_SANITIZER) || defined(V8_USE_ADDRESS_SANITIZER) || \
DEBUG
void SetMemoryAccessible(void* address, size_t size);
void SetMemoryInaccessible(void* address, size_t size);
void CheckMemoryIsInaccessible(const void* address, size_t size);
constexpr bool CheckMemoryIsInaccessibleIsNoop() { … }
#else
V8_INLINE void SetMemoryAccessible(void* address, size_t size) {}
V8_INLINE void CheckMemoryIsInaccessible(const void* address, size_t size) {}
constexpr bool CheckMemoryIsInaccessibleIsNoop() { return true; }
V8_INLINE void SetMemoryInaccessible(void* address, size_t size) {
memset(address, 0, size);
}
#endif
}
}
#endif