Skip to content

Commit

Permalink
gin: Add features for code flushing
Browse files Browse the repository at this point in the history
Bug: v8:13842
Change-Id: Ifb9398bc55e9039c4ac13c789e76f9ab07b08ef2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598010
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1154607}
  • Loading branch information
Dominik Inführ authored and Chromium LUCI CQ committed Jun 7, 2023
1 parent 9ad5b78 commit aa5f511
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gin/gin_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ BASE_FEATURE(kV8FlushBaselineCode,
"V8FlushBaselineCode",
base::FEATURE_DISABLED_BY_DEFAULT);

// Enables code flushing based on tab visibility.
BASE_FEATURE(kV8FlushCodeBasedOnTabVisibility,
"V8FlushCodeBasedOnTabVisibility",
base::FEATURE_DISABLED_BY_DEFAULT);

// Enables code flushing based on time.
BASE_FEATURE(kV8FlushCodeBasedOnTime,
"V8FlushCodeBasedOnTime",
base::FEATURE_DISABLED_BY_DEFAULT);
const base::FeatureParam<int> kV8FlushCodeOldTime{&kV8FlushCodeBasedOnTime,
"V8FlushCodeOldTime", 30};

// Enables finalizing streaming JS compilations on a background thread.
BASE_FEATURE(kV8OffThreadFinalization,
"V8OffThreadFinalization",
Expand Down
3 changes: 3 additions & 0 deletions gin/gin_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ GIN_EXPORT BASE_DECLARE_FEATURE(kV8ExperimentalRegexpEngine);
GIN_EXPORT extern const base::FeatureParam<int> kV8FlushBytecodeOldAge;
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushBaselineCode);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushBytecode);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushCodeBasedOnTabVisibility);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushCodeBasedOnTime);
GIN_EXPORT extern const base::FeatureParam<int> kV8FlushCodeOldTime;
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushEmbeddedBlobICache);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8IgnitionElideRedundantTdzChecks);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8LazyFeedbackAllocation);
Expand Down
12 changes: 12 additions & 0 deletions gin/v8_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ void SetFlags(IsolateHolder::ScriptMode mode,
"--no-flush-bytecode");
SetV8FlagsIfOverridden(features::kV8FlushBaselineCode,
"--flush-baseline-code", "--no-flush-baseline-code");
SetV8FlagsIfOverridden(features::kV8FlushCodeBasedOnTabVisibility,
"--flush-code-based-on-tab-visibility",
"--no-flush-code-based-on-tab-visibility");
SetV8FlagsIfOverridden(features::kV8FlushCodeBasedOnTime,
"--flush-code-based-on-time",
"--no-flush-code-based-on-time");
SetV8FlagsIfOverridden(features::kV8OffThreadFinalization,
"--finalize-streaming-on-background",
"--no-finalize-streaming-on-background");
Expand Down Expand Up @@ -320,6 +326,12 @@ void SetFlags(IsolateHolder::ScriptMode mode,
}
}

if (base::FeatureList::IsEnabled(features::kV8FlushCodeBasedOnTime)) {
if (int old_time = features::kV8FlushCodeOldTime.Get()) {
SetV8FlagsFormatted("--bytecode-old-time=%i", old_time);
}
}

// Make sure aliases of kV8SlowHistograms only enable the feature to
// avoid contradicting settings between multiple finch experiments.
bool any_slow_histograms_alias =
Expand Down

0 comments on commit aa5f511

Please sign in to comment.