Commit 776d9209 authored by Maya Lekova's avatar Maya Lekova Committed by Chromium LUCI CQ

[gin] Add a feature for the V8 experimental regexp engine

The feature is enabled by default, as is the current state of the flag
in V8. This CL is not intended to change the default behavior, but to
allow us to quickly turn the feature off in case of any performance
regressions.

Bug: v8:10765, chromium:1157044
Change-Id: Ib46d487ba094f08c27354c53f8b98e220fec627b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596264
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: default avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841441}
parent 463b4901
......@@ -50,4 +50,8 @@ const base::Feature kV8LocalHeaps{"V8LocalHeaps",
const base::Feature kV8TurboDirectHeapAccess{"V8TurboDirectHeapAccess",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables fallback to a breadth-first regexp engine on excessive backtracking.
const base::Feature kV8ExperimentalRegexpEngine{
"V8ExperimentalRegexpEngine", base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features
......@@ -21,6 +21,7 @@ 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;
GIN_EXPORT extern const base::Feature kV8ExperimentalRegexpEngine;
} // namespace features
......
......@@ -288,6 +288,16 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
v8::V8::SetFlagsFromString(no_direct_access, sizeof(no_direct_access) - 1);
}
if (!base::FeatureList::IsEnabled(features::kV8ExperimentalRegexpEngine)) {
// The --enable-experimental-regexp-engine-on-excessive-backtracks flag is
// enabled by default, so we need to explicitly disable it if
// kV8ExperimentalRegexpEngine is disabled.
static constexpr char no_experimental_regexp_engine[] =
"--no-enable-experimental-regexp-engine-on-excessive-backtracks";
v8::V8::SetFlagsFromString(no_experimental_regexp_engine,
sizeof(no_experimental_regexp_engine) - 1);
}
if (IsolateHolder::kStrictMode == mode) {
static const char use_strict[] = "--use_strict";
v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment