#include <stdlib.h>
#include <string.h>
#if V8_OS_POSIX
#include <setjmp.h>
#include <signal.h>
#include <unistd.h>
#endif
#include "src/init/v8.h"
#include "test/cctest/cctest.h"
AccountingAllocator;
IdleTask;
Isolate;
Task;
#include "src/utils/allocation.h"
#include "src/zone/accounting-allocator.h"
#if !defined(V8_USE_ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
!defined(THREAD_SANITIZER)
namespace {
class AllocationPlatform : public TestPlatform { … };
AllocationPlatform* AllocationPlatform::current_platform = …;
bool DidCallOnCriticalMemoryPressure() { … }
size_t GetHugeMemoryAmount() { … }
void OnMallocedOperatorNewOOM(const char* location, const char* message) { … }
void OnNewArrayOOM(const char* location, const char* message) { … }
void OnAlignedAllocOOM(const char* location, const char* message) { … }
}
TEST_WITH_PLATFORM(AccountingAllocatorOOM, AllocationPlatform) { … }
TEST_WITH_PLATFORM(AccountingAllocatorCurrentAndMax, AllocationPlatform) { … }
TEST_WITH_PLATFORM(MallocedOperatorNewOOM, AllocationPlatform) { … }
TEST_WITH_PLATFORM(NewArrayOOM, AllocationPlatform) { … }
TEST_WITH_PLATFORM(AlignedAllocOOM, AllocationPlatform) { … }
TEST_WITH_PLATFORM(AllocVirtualMemoryOOM, AllocationPlatform) { … }
TEST_WITH_PLATFORM(AlignedAllocVirtualMemoryOOM, AllocationPlatform) { … }
#endif