0

cppgc: Introduce feature for 16GB cage size

The CL introduces a disabled-by-default feature named
'V8CppGCEnableLargerCage'.

Bug: 343959927
Change-Id: I1a39b9d6cc222c02973c95d87227f8e1c6e85a17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677043
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324126}
This commit is contained in:
Anton Bikineev
2024-07-08 10:17:14 +00:00
committed by Chromium LUCI CQ
parent 36a44e742c
commit 2bc9146d62
3 changed files with 29 additions and 4 deletions

@@ -5,6 +5,8 @@
#include "gin/public/cppgc.h"
#include "base/check_op.h"
#include "base/feature_list.h"
#include "gin/gin_features.h"
#include "gin/public/v8_platform.h"
#include "v8/include/cppgc/platform.h"
@@ -17,11 +19,28 @@ int g_init_count = 0;
} // namespace
void InitializeCppgcFromV8Platform() {
DCHECK_GE(g_init_count, 0);
if (g_init_count++ > 0)
return;
static constexpr size_t kRegularCageSize =
static_cast<size_t>(4) * 1024 * 1024 * 1024;
static constexpr size_t kLargerCageSize =
static_cast<size_t>(16) * 1024 * 1024 * 1024;
cppgc::InitializeProcess(gin::V8Platform::Get()->GetPageAllocator());
DCHECK_GE(g_init_count, 0);
if (g_init_count++ > 0) {
return;
}
size_t desired_cage_size = kRegularCageSize;
auto overridden_state = base::FeatureList::GetStateIfOverridden(
features::kV8CppGCEnableLargerCage);
if (overridden_state.has_value()) {
if (overridden_state.value()) {
desired_cage_size = kLargerCageSize;
} else {
}
}
cppgc::InitializeProcess(gin::V8Platform::Get()->GetPageAllocator(),
desired_cage_size);
}
void MaybeShutdownCppgc() {

@@ -209,6 +209,11 @@ BASE_FEATURE(kV8SlowHistogramsNoTurbofan,
"V8SlowHistogramsNoTurbofan",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enable 16GB heap reservation for Oilpan.
BASE_FEATURE(kV8CppGCEnableLargerCage,
"V8CppGCEnableLargerCage",
kFeatureDefaultStateControlledByV8);
BASE_FEATURE(kV8DelayMemoryReducer,
"V8DelayMemoryReducer",
base::FEATURE_ENABLED_BY_DEFAULT);

@@ -28,6 +28,7 @@ GIN_EXPORT extern const base::FeatureParam<int>
GIN_EXPORT BASE_DECLARE_FEATURE(kV8BaselineBatchCompilation);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8CodeMemoryWriteProtection);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8ConcurrentSparkplugHighPriorityThreads);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8CppGCEnableLargerCage);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8DelayMemoryReducer);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8ConcurrentMarkingHighPriorityThreads);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8DecommitPooledPages);