Skip to content

Commit

Permalink
[v8] Add feature flag for off-thread streaming finalization
Browse files Browse the repository at this point in the history
Adds a feature flag for enabling off-thread finalization of V8 streaming
compilation tasks. This feature should reduce main-thread script
compilation time.

Bug: 1011762
Change-Id: I64bb986e07dae8d68dc61269e69096c368b1aac8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135629
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756313}
  • Loading branch information
LeszekSwirski authored and Commit Bot committed Apr 3, 2020
1 parent 2152472 commit de933c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gin/gin_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const base::Feature kV8OptimizeJavascript{"V8OptimizeJavascript",
const base::Feature kV8FlushBytecode{"V8FlushBytecode",
base::FEATURE_ENABLED_BY_DEFAULT};

// Enables finalizing streaming JS compilations on a background thread.
const base::Feature kV8OffThreadFinalization{"V8OffThreadFinalization",
base::FEATURE_DISABLED_BY_DEFAULT};

// Enables lazy feedback allocation in V8.
const base::Feature kV8LazyFeedbackAllocation{"V8LazyFeedbackAllocation",
base::FEATURE_ENABLED_BY_DEFAULT};
Expand Down
1 change: 1 addition & 0 deletions gin/gin_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace features {

GIN_EXPORT extern const base::Feature kV8OptimizeJavascript;
GIN_EXPORT extern const base::Feature kV8FlushBytecode;
GIN_EXPORT extern const base::Feature kV8OffThreadFinalization;
GIN_EXPORT extern const base::Feature kV8LazyFeedbackAllocation;
GIN_EXPORT extern const base::Feature kV8ConcurrentInlining;
GIN_EXPORT extern const base::Feature kV8PerContextMarkingWorklist;
Expand Down
7 changes: 7 additions & 0 deletions gin/v8_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
sizeof(no_flush_bytecode) - 1);
}

if (base::FeatureList::IsEnabled(features::kV8OffThreadFinalization)) {
static const char finalize_streaming_on_background[] =
"--finalize-streaming-on-background";
v8::V8::SetFlagsFromString(finalize_streaming_on_background,
sizeof(finalize_streaming_on_background) - 1);
}

if (!base::FeatureList::IsEnabled(features::kV8LazyFeedbackAllocation)) {
static const char no_lazy_feedback_allocation[] =
"--no-lazy-feedback-allocation";
Expand Down

0 comments on commit de933c1

Please sign in to comment.