summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/cppgc/platform.cc
blob: 90516d6065e6bb3504cc9fd53822c0061a572919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "include/cppgc/platform.h"

#include "src/base/lazy-instance.h"
#include "src/base/platform/platform.h"
#include "src/heap/cppgc/gc-info-table.h"

namespace cppgc {

namespace {
PageAllocator* g_page_allocator = nullptr;
}  // namespace

TracingController* Platform::GetTracingController() {
  static v8::base::LeakyObject<TracingController> tracing_controller;
  return tracing_controller.get();
}

void InitializeProcess(PageAllocator* page_allocator) {
  CHECK(!g_page_allocator);
  internal::GlobalGCInfoTable::Initialize(page_allocator);
  g_page_allocator = page_allocator;
}

void ShutdownProcess() { g_page_allocator = nullptr; }

namespace internal {

void Abort() { v8::base::OS::Abort(); }

}  // namespace internal
}  // namespace cppgc