#include "test/cctest/cctest.h"
#include "include/cppgc/platform.h"
#include "include/libplatform/libplatform.h"
#include "include/v8-array-buffer.h"
#include "include/v8-context.h"
#include "include/v8-function.h"
#include "include/v8-isolate.h"
#include "include/v8-local-handle.h"
#include "include/v8-locker.h"
#include "src/base/lazy-instance.h"
#include "src/base/logging.h"
#include "src/base/platform/condition-variable.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/semaphore.h"
#include "src/base/strings.h"
#include "src/codegen/compiler.h"
#include "src/codegen/optimized-compilation-info.h"
#include "src/common/globals.h"
#include "src/init/v8.h"
#ifdef V8_ENABLE_TURBOFAN
#include "src/compiler/pipeline.h"
#endif
#include "src/flags/flags.h"
#include "src/objects/objects-inl.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/heap/heap-utils.h"
#include "test/cctest/print-extension.h"
#include "test/cctest/profiler-extension.h"
#include "test/cctest/trace-extension.h"
#ifdef V8_USE_PERFETTO
#include "src/tracing/trace-event.h"
#endif
#if V8_OS_WIN
#include <windows.h>
#if V8_CC_MSVC
#include <crtdbg.h>
#endif
#endif
enum InitializationState { … };
static InitializationState initialization_state_ = …;
static v8::base::LazyInstance<CcTestMapType>::type g_cctests =
LAZY_INSTANCE_INITIALIZER;
std::unordered_map<std::string, CcTest*>* tests_ =
new std::unordered_map<std::string, CcTest*>();
bool CcTest::initialize_called_ = …;
v8::base::Atomic32 CcTest::isolate_used_ = …;
v8::ArrayBuffer::Allocator* CcTest::allocator_ = …;
v8::Isolate* CcTest::isolate_ = …;
v8::Platform* CcTest::default_platform_ = …;
CcTest::CcTest(TestFunction* callback, const char* file, const char* name,
bool enabled, bool initialize,
TestPlatformFactory* test_platform_factory)
: … { … }
void CcTest::Run(const char* snapshot_directory) { … }
i::Heap* CcTest::heap() { … }
i::ReadOnlyHeap* CcTest::read_only_heap() { … }
void CcTest::AddGlobalFunction(v8::Local<v8::Context> env, const char* name,
v8::FunctionCallback callback) { … }
i::Handle<i::String> CcTest::MakeString(const char* str) { … }
i::Handle<i::String> CcTest::MakeName(const char* str, int suffix) { … }
v8::base::RandomNumberGenerator* CcTest::random_number_generator() { … }
v8::Local<v8::Object> CcTest::global() { … }
void CcTest::InitializeVM() { … }
v8::Local<v8::Context> CcTest::NewContext(CcTestExtensionFlags extension_flags,
v8::Isolate* isolate) { … }
LocalContext::~LocalContext() { … }
void LocalContext::Initialize(v8::Isolate* isolate,
v8::ExtensionConfiguration* extensions,
v8::Local<v8::ObjectTemplate> global_template,
v8::Local<v8::Value> global_object) { … }
class V8_NODISCARD InitializedHandleScopeImpl { … };
InitializedHandleScope::InitializedHandleScope(i::Isolate* isolate)
: … { … }
InitializedHandleScope::~InitializedHandleScope() = default;
HandleAndZoneScope::HandleAndZoneScope(bool support_zone_compression)
: … { … }
HandleAndZoneScope::~HandleAndZoneScope() = default;
#ifdef V8_ENABLE_TURBOFAN
i::Handle<i::JSFunction> Optimize(i::Handle<i::JSFunction> function,
i::Zone* zone, i::Isolate* isolate,
uint32_t flags) { … }
#endif
static void PrintTestList() { … }
int main(int argc, char* argv[]) { … }
std::vector<const RegisterThreadedTest*> RegisterThreadedTest::tests_;
bool IsValidUnwrapObject(v8::Object* object) { … }
v8::PageAllocator* TestPlatform::GetPageAllocator() { … }
void TestPlatform::OnCriticalMemoryPressure() { … }
int TestPlatform::NumberOfWorkerThreads() { … }
std::shared_ptr<v8::TaskRunner> TestPlatform::GetForegroundTaskRunner(
v8::Isolate* isolate, v8::TaskPriority priority) { … }
void TestPlatform::PostTaskOnWorkerThreadImpl(
v8::TaskPriority priority, std::unique_ptr<v8::Task> task,
const v8::SourceLocation& location) { … }
void TestPlatform::PostDelayedTaskOnWorkerThreadImpl(
v8::TaskPriority priority, std::unique_ptr<v8::Task> task,
double delay_in_seconds, const v8::SourceLocation& location) { … }
std::unique_ptr<v8::JobHandle> TestPlatform::CreateJobImpl(
v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task,
const v8::SourceLocation& location) { … }
double TestPlatform::MonotonicallyIncreasingTime() { … }
double TestPlatform::CurrentClockTimeMillis() { … }
bool TestPlatform::IdleTasksEnabled(v8::Isolate* isolate) { … }
v8::TracingController* TestPlatform::GetTracingController() { … }
namespace {
class ShutdownTask final : public v8::Task { … };
}