0

[gin] Add a feature flag for V8's --turbo-direct-heap-access

This is done to set up a reverse Finch trial of V8's
--turbo-direct-heap-access. As a note, it is is dependent of V8's flag
--local-heaps.

Bug: 1125606, v8:7790
Change-Id: Ieede59881b3ef3c762ba0679dccf1b95cc05c1ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2396137
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804897}
This commit is contained in:
Santiago Aboy Solanes
2020-09-08 12:16:58 +00:00
committed by Commit Bot
parent d04688d14d
commit 4aa736b609
3 changed files with 17 additions and 1 deletions

@ -46,4 +46,8 @@ const base::Feature kV8NoReclaimUnmodifiedWrappers{
const base::Feature kV8LocalHeaps{"V8LocalHeaps",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables TurboFan's direct heap access.
const base::Feature kV8TurboDirectHeapAccess{"V8TurboDirectHeapAccess",
base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features

@ -20,6 +20,7 @@ GIN_EXPORT extern const base::Feature kV8FlushEmbeddedBlobICache;
GIN_EXPORT extern const base::Feature kV8ReduceConcurrentMarkingTasks;
GIN_EXPORT extern const base::Feature kV8NoReclaimUnmodifiedWrappers;
GIN_EXPORT extern const base::Feature kV8LocalHeaps;
GIN_EXPORT extern const base::Feature kV8TurboDirectHeapAccess;
} // namespace features

@ -265,9 +265,20 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
if (!base::FeatureList::IsEnabled(features::kV8LocalHeaps)) {
// The --local-heaps flag is enabled by default, so we need to explicitly
// disabled it if kV8LocalHeaps is disabled.
// disable it if kV8LocalHeaps is disabled.
static constexpr char no_local_heaps[] = "--no-local-heaps";
v8::V8::SetFlagsFromString(no_local_heaps, sizeof(no_local_heaps) - 1);
// Also disable TurboFan's direct access if local heaps are not enabled.
static constexpr char no_direct_access[] = "--no-turbo-direct-heap-access";
v8::V8::SetFlagsFromString(no_direct_access, sizeof(no_direct_access) - 1);
}
if (!base::FeatureList::IsEnabled(features::kV8TurboDirectHeapAccess)) {
// The --turbo-direct-heap-access flag is enabled by default, so we need to
// explicitly disable it if kV8TurboDirectHeapAccess is disabled.
static constexpr char no_direct_access[] = "--no-turbo-direct-heap-access";
v8::V8::SetFlagsFromString(no_direct_access, sizeof(no_direct_access) - 1);
}
if (IsolateHolder::kStrictMode == mode) {