v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
garbage-collector.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_
6#define V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_
7
8#include <optional>
9
12
13namespace cppgc {
14namespace internal {
15
16// GC interface that allows abstraction over the actual GC invocation. This is
17// needed to mock/fake GC for testing.
19 public:
20 // Executes a garbage collection specified in config.
21 virtual void CollectGarbage(GCConfig) = 0;
23
24 // The current epoch that the GC maintains. The epoch is increased on every
25 // GC invocation.
26 virtual size_t epoch() const = 0;
27
28 // Returns if the stack state is overridden.
29 virtual std::optional<EmbedderStackState> overridden_stack_state() const = 0;
30
31 // These virtual methods are also present in class HeapBase.
33 virtual void clear_overridden_stack_state() = 0;
34
35#ifdef V8_ENABLE_ALLOCATION_TIMEOUT
36 virtual std::optional<int> UpdateAllocationTimeout() = 0;
37#endif // V8_ENABLE_ALLOCATION_TIMEOUT
38};
39
40} // namespace internal
41} // namespace cppgc
42
43#endif // V8_HEAP_CPPGC_GARBAGE_COLLECTOR_H_
virtual void StartIncrementalGarbageCollection(GCConfig)=0
virtual void clear_overridden_stack_state()=0
virtual std::optional< EmbedderStackState > overridden_stack_state() const =0
virtual size_t epoch() const =0
virtual void set_override_stack_state(EmbedderStackState state)=0
virtual void CollectGarbage(GCConfig)=0
EmbedderStackState
Definition common.h:15