#ifndef V8_UNITTESTS_TEST_UTILS_H_
#define V8_UNITTESTS_TEST_UTILS_H_
#include <memory>
#include <vector>
#include "include/libplatform/libplatform.h"
#include "include/v8-array-buffer.h"
#include "include/v8-context.h"
#include "include/v8-extension.h"
#include "include/v8-local-handle.h"
#include "include/v8-object.h"
#include "include/v8-primitive.h"
#include "include/v8-template.h"
#include "src/api/api-inl.h"
#include "src/base/macros.h"
#include "src/base/utils/random-number-generator.h"
#include "src/handles/handles.h"
#include "src/heap/parked-scope.h"
#include "src/logging/log.h"
#include "src/objects/objects-inl.h"
#include "src/objects/objects.h"
#include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h"
#include "testing/gtest-support.h"
namespace v8 {
class ArrayBufferAllocator;
template <typename TMixin>
class WithDefaultPlatformMixin : public TMixin { … };
template <typename TMixin>
class WithJSSharedMemoryFeatureFlagsMixin : public TMixin { … };
using CounterMap = std::map<std::string, int>;
enum CountersMode { … };
class IsolateWrapper final { … };
class IsolateWithContextWrapper final { … };
template <typename TMixin, CountersMode kCountersMode = kNoCounters>
class WithIsolateMixin : public TMixin { … };
template <typename TMixin>
class WithIsolateScopeMixin : public TMixin { … };
template <typename TMixin>
class WithContextMixin : public TMixin { … };
TestWithPlatform;
using TestWithIsolate =
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>;
using TestWithContext =
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>;
using TestJSSharedMemoryWithContext =
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
WithJSSharedMemoryFeatureFlagsMixin<
::testing::Test>>>>>;
class PrintExtension : public v8::Extension { … };
template <typename TMixin>
class WithPrintExtensionMixin : public TMixin { … };
class StreamerThread : public v8::base::Thread { … };
namespace internal {
class Factory;
template <typename TMixin>
class WithInternalIsolateMixin : public TMixin { … };
template <typename TMixin>
class WithZoneMixin : public TMixin { … };
using TestWithIsolate =
WithInternalIsolateMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>;
TestWithZone;
using TestWithIsolateAndZone =
WithZoneMixin<
WithInternalIsolateMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>>;
using TestWithContextAndZone =
WithZoneMixin<
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>>;
using TestWithNativeContext =
WithInternalIsolateMixin<
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>>;
TestWithNativeContextAndCounters;
using TestWithNativeContextAndZone =
WithZoneMixin<
WithInternalIsolateMixin<
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>>>;
TestJSSharedMemoryWithPlatform;
using TestJSSharedMemoryWithIsolate =
WithInternalIsolateMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
TestJSSharedMemoryWithPlatform>>>;
using TestJSSharedMemoryWithNativeContext =
WithInternalIsolateMixin<
WithContextMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
TestJSSharedMemoryWithPlatform>>>>;
class V8_NODISCARD SaveFlags { … };
inline void PrintTo(Tagged<Object> o, ::std::ostream* os) { … }
inline void PrintTo(Tagged<Smi> o, ::std::ostream* os) { … }
static inline uint16_t* AsciiToTwoByteString(const char* source) { … }
class TestTransitionsAccessor : public TransitionsAccessor { … };
class FeedbackVectorHelper { … };
template <typename Spec>
Handle<FeedbackVector> NewFeedbackVector(Isolate* isolate, Spec* spec) { … }
class FakeCodeEventLogger : public i::CodeEventLogger { … };
#ifdef V8_CC_GNU
#if V8_HOST_ARCH_X64
#define GET_STACK_POINTER_TO(sp_addr) …
#elif V8_HOST_ARCH_IA32
#define GET_STACK_POINTER_TO …
#elif V8_HOST_ARCH_ARM
#define GET_STACK_POINTER_TO …
#elif V8_HOST_ARCH_ARM64
#define GET_STACK_POINTER_TO …
#elif V8_HOST_ARCH_MIPS
#define GET_STACK_POINTER_TO …
#elif V8_HOST_ARCH_MIPS64
#define GET_STACK_POINTER_TO …
#elif V8_OS_ZOS
#define GET_STACK_POINTER_TO …
#elif defined(__s390x__) || defined(_ARCH_S390X)
#define GET_STACK_POINTER_TO …
#elif defined(__s390__) || defined(_ARCH_S390)
#define GET_STACK_POINTER_TO …
#elif defined(__PPC64__) || defined(_ARCH_PPC64)
#define GET_STACK_POINTER_TO …
#elif V8_TARGET_ARCH_RISCV64
#define GET_STACK_POINTER_TO …
#elif V8_HOST_ARCH_LOONG64
#define GET_STACK_POINTER_TO …
#else
#error Host architecture was not detected as supported by v8
#endif
#endif
}
}
#endif