Skip to content

Commit

Permalink
[Gin] Add V8IgnitionEager feature.
Browse files Browse the repository at this point in the history
Make eager or lazy compilation in ignition explicit by adding a V8IgnitionEager
feature. This is to allow us to swap the default in V8 from eager to lazy
without changing the feature trail experimental groups.

BUG=v8:4868
TBR=jochen@chromium.org

Review-Url: https://codereview.chromium.org/1989883002
Cr-Commit-Position: refs/heads/master@{#395059}
  • Loading branch information
rmcilroy authored and Commit bot committed May 20, 2016
1 parent 7966603 commit 19ab48d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
9 changes: 8 additions & 1 deletion gin/gin_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ const base::Feature kV8Ignition {
"V8Ignition", base::FEATURE_DISABLED_BY_DEFAULT
};

// Enables or disables lazy compilation for the V8 Ignition interpreter.
// Enables lazy compilation for the V8 Ignition interpreter. Only
// one of V8IgnitionLazy or V8IgnitionEager should be enabled.
const base::Feature kV8IgnitionLazy {
"V8IgnitionLazy", base::FEATURE_DISABLED_BY_DEFAULT
};

// Enables eager compilation for the V8 Ignition interpreter. Only
// one of V8IgnitionLazy or V8IgnitionEager should be enabled.
const base::Feature kV8IgnitionEager {
"V8IgnitionEager", base::FEATURE_DISABLED_BY_DEFAULT
};

} // namespace features
1 change: 1 addition & 0 deletions gin/public/gin_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace features {

GIN_EXPORT extern const base::Feature kV8Ignition;
GIN_EXPORT extern const base::Feature kV8IgnitionLazy;
GIN_EXPORT extern const base::Feature kV8IgnitionEager;

} // namespace features

Expand Down
16 changes: 12 additions & 4 deletions gin/v8_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,21 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
if (base::FeatureList::IsEnabled(features::kV8Ignition)) {
std::string flag("--ignition");
v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size()));
}

if (base::FeatureList::IsEnabled(features::kV8IgnitionLazy)) {
std::string flag("--no-ignition-eager");
v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size()));
if (base::FeatureList::IsEnabled(features::kV8IgnitionEager)) {
std::string eager_flag("--ignition-eager");
v8::V8::SetFlagsFromString(
eager_flag.c_str(), static_cast<int>(eager_flag.size()));
}

if (base::FeatureList::IsEnabled(features::kV8IgnitionLazy)) {
std::string lazy_flag("--no-ignition-eager");
v8::V8::SetFlagsFromString(
lazy_flag.c_str(), static_cast<int>(lazy_flag.size()));
}
}


#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
v8::StartupData natives;
natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
Expand Down

0 comments on commit 19ab48d

Please sign in to comment.