chromium/v8/test/cctest/cctest.cc

// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
//       copyright notice, this list of conditions and the following
//       disclaimer in the documentation and/or other materials provided
//       with the distribution.
//     * Neither the name of Google Inc. nor the names of its
//       contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#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  // V8_ENABLE_TURBOFAN
#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  // V8_USE_PERFETTO

#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) {}

// This indirection is needed because HandleScopes cannot be heap-allocated, and
// we don't want any unnecessary #includes in cctest.h.
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  // V8_ENABLE_TURBOFAN

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 {};

}  // namespace