v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-controller.h
Go to the documentation of this file.
1// Copyright 2012 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_HEAP_CONTROLLER_H_
6#define V8_HEAP_HEAP_CONTROLLER_H_
7
8#include <cstddef>
9#include "src/heap/heap.h"
11#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
12
13namespace v8 {
14namespace internal {
15
17 static constexpr size_t kMinSize = 128u * Heap::kHeapLimitMultiplier * MB;
18 static constexpr size_t kMaxSize = 1024u * Heap::kHeapLimitMultiplier * MB;
19
20 static constexpr double kMinGrowingFactor = 1.1;
21 static constexpr double kMaxGrowingFactor = 4.0;
22 static constexpr double kConservativeGrowingFactor = 1.3;
23 static constexpr double kTargetMutatorUtilization = 0.97;
24};
25
27 static constexpr char kName[] = "HeapController";
28};
29
31 static constexpr char kName[] = "GlobalMemoryController";
32};
33
34template <typename Trait>
36 public:
37 // Computes the growing step when the limit increases.
38 static size_t MinimumAllocationLimitGrowingStep(
39 Heap::HeapGrowingMode growing_mode);
40
41 static double GrowingFactor(Heap* heap, size_t max_heap_size,
42 std::optional<double> gc_speed,
43 double mutator_speed,
44 Heap::HeapGrowingMode growing_mode);
45
46 static size_t BoundAllocationLimit(Heap* heap, size_t current_size,
47 uint64_t limit, size_t min_size,
48 size_t max_size, size_t new_space_capacity,
49 Heap::HeapGrowingMode growing_mode);
50
51 private:
52 static double MaxGrowingFactor(size_t max_heap_size);
53 static double DynamicGrowingFactor(std::optional<double> gc_speed,
54 double mutator_speed, double max_factor);
55
56 FRIEND_TEST(MemoryControllerTest, HeapGrowingFactor);
57 FRIEND_TEST(MemoryControllerTest, MaxHeapGrowingFactor);
58};
59
60} // namespace internal
61} // namespace v8
62
63#endif // V8_HEAP_HEAP_CONTROLLER_H_
FRIEND_TEST(MemoryControllerTest, MaxHeapGrowingFactor)
FRIEND_TEST(MemoryControllerTest, HeapGrowingFactor)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage * MB
Definition flags.cc:2197
#define V8_EXPORT_PRIVATE
Definition macros.h:460
static constexpr size_t kMaxSize
static constexpr size_t kMinSize
static constexpr double kTargetMutatorUtilization
static constexpr double kMaxGrowingFactor
static constexpr double kMinGrowingFactor
static constexpr double kConservativeGrowingFactor
static constexpr char kName[]
static constexpr char kName[]