#ifndef V8_BASE_PLATFORM_MEMORY_H_
#define V8_BASE_PLATFORM_MEMORY_H_
#include <cstddef>
#include <cstdlib>
#include "include/v8config.h"
#include "src/base/bits.h"
#include "src/base/logging.h"
#include "src/base/macros.h"
#if V8_OS_STARBOARD
#include "starboard/memory.h"
#endif
#if V8_OS_DARWIN
#include <malloc/malloc.h>
#elif V8_OS_OPENBSD
#include <sys/malloc.h>
#elif V8_OS_ZOS
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_ZOS && !V8_OS_OPENBSD) || V8_OS_WIN
#define V8_HAS_MALLOC_USABLE_SIZE …
#endif
namespace v8::base {
inline void* Malloc(size_t size) { … }
inline void* Realloc(void* memory, size_t size) { … }
inline void Free(void* memory) { … }
inline void* Calloc(size_t count, size_t size) { … }
inline void* AlignedAlloc(size_t size, size_t alignment) { … }
inline void AlignedFree(void* ptr) { … }
#if V8_HAS_MALLOC_USABLE_SIZE
inline size_t MallocUsableSize(void* ptr) { … }
#endif
template <class Pointer>
struct AllocationResult { … };
template <typename T>
V8_NODISCARD AllocationResult<T*> AllocateAtLeast(size_t n) { … }
}
#undef V8_HAS_MALLOC_USABLE_SIZE
#endif