v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-config.h
Go to the documentation of this file.
1// Copyright 2022 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_HEAP_CONFIG_H_
6#define V8_HEAP_CPPGC_HEAP_CONFIG_H_
7
10
11namespace cppgc::internal {
12
14
15enum class CollectionType : uint8_t {
16 kMinor,
17 kMajor,
18};
19
20// Specifies whether free memory should be transparently discarded when it is
21// not yet released. This is generally enabled for free list entries on memory
22// reducing GCs. Windows is the exception where these calls are too expensive.
23//
24// In order to minimize actual discard calls various components optimize the
25// calls here. E.g., we assume that whole pages are freed through a page pool
26// (which doesn't discard on adding) that is fully released after a GC cycle.
27enum class FreeMemoryHandling : uint8_t {
30};
31
34 enum class IsForcedGC : uint8_t {
36 kForced,
37 };
38
39 static constexpr MarkingConfig Default() { return {}; }
40
42 StackState stack_state = StackState::kMayContainHeapPointers;
43 MarkingType marking_type = MarkingType::kIncremental;
45};
46
57
58struct GCConfig {
63
65 return {CollectionType::kMajor, StackState::kMayContainHeapPointers,
66 MarkingType::kAtomic, SweepingType::kAtomic};
67 }
68
69 static constexpr GCConfig PreciseAtomicConfig() {
70 return {CollectionType::kMajor, StackState::kNoHeapPointers,
71 MarkingType::kAtomic, SweepingType::kAtomic};
72 }
73
75 return {CollectionType::kMajor, StackState::kMayContainHeapPointers,
76 MarkingType::kIncremental, SweepingType::kAtomic};
77 }
78
80 return {CollectionType::kMajor, StackState::kNoHeapPointers,
81 MarkingType::kIncremental, SweepingType::kAtomic};
82 }
83
84 static constexpr GCConfig
86 return {CollectionType::kMajor, StackState::kNoHeapPointers,
87 MarkingType::kIncremental, SweepingType::kIncrementalAndConcurrent};
88 }
89
90 static constexpr GCConfig PreciseConcurrentConfig() {
91 return {CollectionType::kMajor, StackState::kNoHeapPointers,
92 MarkingType::kIncrementalAndConcurrent,
93 SweepingType::kIncrementalAndConcurrent};
94 }
95
97 return {CollectionType::kMinor, StackState::kNoHeapPointers,
98 MarkingType::kAtomic, SweepingType::kAtomic};
99 }
100
102 return {CollectionType::kMinor, StackState::kMayContainHeapPointers,
103 MarkingType::kAtomic, SweepingType::kAtomic};
104 }
105
107 StackState stack_state = StackState::kMayContainHeapPointers;
108 MarkingType marking_type = MarkingType::kAtomic;
109 SweepingType sweeping_type = SweepingType::kAtomic;
111 IsForcedGC is_forced_gc = IsForcedGC::kNotForced;
112};
113
114} // namespace cppgc::internal
115
116#endif // V8_HEAP_CPPGC_HEAP_CONFIG_H_
MarkingType
Definition heap.h:60
SweepingType
Definition heap.h:80
EmbedderStackState StackState
Definition heap.h:40
EmbedderStackState
Definition common.h:15
static constexpr GCConfig ConservativeIncrementalConfig()
Definition heap-config.h:74
static constexpr GCConfig PreciseIncrementalMarkingConcurrentSweepingConfig()
Definition heap-config.h:85
static constexpr GCConfig PreciseConcurrentConfig()
Definition heap-config.h:90
static constexpr GCConfig MinorPreciseAtomicConfig()
Definition heap-config.h:96
CollectionType collection_type
static constexpr GCConfig MinorConservativeAtomicConfig()
static constexpr GCConfig PreciseAtomicConfig()
Definition heap-config.h:69
static constexpr GCConfig ConservativeAtomicConfig()
Definition heap-config.h:64
static constexpr GCConfig PreciseIncrementalConfig()
Definition heap-config.h:79
FreeMemoryHandling free_memory_handling
const CollectionType collection_type
Definition heap-config.h:41
static constexpr MarkingConfig Default()
Definition heap-config.h:39
cppgc::Heap::MarkingType MarkingType
Definition heap-config.h:33
cppgc::internal::FreeMemoryHandling FreeMemoryHandling
Definition heap-config.h:50
cppgc::Heap::SweepingType SweepingType
Definition heap-config.h:48
FreeMemoryHandling free_memory_handling
Definition heap-config.h:55
CompactableSpaceHandling compactable_space_handling
Definition heap-config.h:53