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
9#include "src/base/macros.h"
12
13namespace cppgc {
14
15class Platform;
16
17namespace internal {
18
20class 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.
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
40
41 HeapGrowing(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_
MarkingType
Definition heap.h:60
SweepingType
Definition heap.h:80
std::unique_ptr< HeapGrowingImpl > impl_
HeapGrowing(const HeapGrowing &)=delete
HeapGrowing & operator=(const HeapGrowing &)=delete
constexpr size_t kPageSize
Definition globals.h:42
#define V8_EXPORT_PRIVATE
Definition macros.h:460