v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-growing.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_HEAP_GROWING_H_
6
#define V8_HEAP_CPPGC_HEAP_GROWING_H_
7
8
#include "
include/cppgc/heap.h
"
9
#include "
src/base/macros.h
"
10
#include "
src/heap/cppgc/globals.h
"
11
#include "
src/heap/cppgc/raw-heap.h
"
12
13
namespace
cppgc
{
14
15
class
Platform;
16
17
namespace
internal
{
18
19
class
GarbageCollector
;
20
class
StatsCollector;
21
22
// Growing strategy that invokes garbage collection using GarbageCollector based
23
// on allocation statistics provided by StatsCollector and ResourceConstraints.
24
//
25
// Implements a fixed-ratio growing strategy with an initial heap size that the
26
// GC can ignore to avoid excessive GCs for smaller heaps.
27
class
V8_EXPORT_PRIVATE
HeapGrowing
final {
28
public
:
29
// Constant growing factor for growing the heap limit.
30
static
constexpr
double
kGrowingFactor = 1.5;
31
// For smaller heaps, allow allocating at least LAB in each regular space
32
// before triggering GC again.
33
static
constexpr
size_t
kMinLimitIncrease =
34
kPageSize
* RawHeap::kNumberOfRegularSpaces;
35
36
HeapGrowing
(
GarbageCollector
*,
StatsCollector
*,
37
cppgc::Heap::ResourceConstraints
,
cppgc::Heap::MarkingType
,
38
cppgc::Heap::SweepingType
);
39
~HeapGrowing
();
40
41
HeapGrowing
(
const
HeapGrowing
&) =
delete
;
42
HeapGrowing
&
operator=
(
const
HeapGrowing
&) =
delete
;
43
44
size_t
limit_for_atomic_gc()
const
;
45
size_t
limit_for_incremental_gc()
const
;
46
47
void
DisableForTesting();
48
49
private
:
50
class
HeapGrowingImpl
;
51
std::unique_ptr<HeapGrowingImpl>
impl_
;
52
};
53
54
}
// namespace internal
55
}
// namespace cppgc
56
57
#endif
// V8_HEAP_CPPGC_HEAP_GROWING_H_
cppgc::Heap::MarkingType
MarkingType
Definition
heap.h:60
cppgc::Heap::SweepingType
SweepingType
Definition
heap.h:80
cppgc::internal::GarbageCollector
Definition
garbage-collector.h:18
cppgc::internal::HeapGrowing::HeapGrowingImpl
Definition
heap-growing.cc:31
cppgc::internal::HeapGrowing
Definition
heap-growing.h:27
cppgc::internal::HeapGrowing::impl_
std::unique_ptr< HeapGrowingImpl > impl_
Definition
heap-growing.h:51
cppgc::internal::HeapGrowing::~HeapGrowing
~HeapGrowing()
cppgc::internal::HeapGrowing::HeapGrowing
HeapGrowing(const HeapGrowing &)=delete
cppgc::internal::HeapGrowing::operator=
HeapGrowing & operator=(const HeapGrowing &)=delete
cppgc::internal::StatsCollector
Definition
stats-collector.h:84
globals.h
heap.h
cppgc::internal::kPageSize
constexpr size_t kPageSize
Definition
globals.h:42
cppgc
Definition
cross-heap-remembered-set.h:14
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::GarbageCollector
GarbageCollector
Definition
globals.h:1571
raw-heap.h
macros.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
cppgc::Heap::ResourceConstraints
Definition
heap.h:100
src
heap
cppgc
heap-growing.h
Generated on Sun Apr 6 2025 21:08:54 for v8 by
1.12.0