Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2161)

Unified Diff: content/renderer/render_process_impl.cc

Issue 1876903002: [v8] Fix Chrome's "Experimental JavaScript" switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_process_impl.cc
diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc
index 123799c81f1ec4cb0610067c6941e1b4929838f6..c9d0d5325a1ed1fa44d362f67c3dd5bcf4258dd0 100644
--- a/content/renderer/render_process_impl.cc
+++ b/content/renderer/render_process_impl.cc
@@ -14,6 +14,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/feature_list.h"
#include "base/sys_info.h"
#include "content/child/site_isolation_stats_gatherer.h"
#include "content/public/common/content_switches.h"
@@ -21,6 +22,32 @@
#include "third_party/WebKit/public/web/WebFrame.h"
#include "v8/include/v8.h"
+namespace {
+
+const base::Feature kV8_ES2015_TailCalls_Feature {
+ "V8_ES2015_TailCalls", base::FEATURE_DISABLED_BY_DEFAULT
+};
+
+const base::Feature kV8SerializeEagerFeature{"V8_Serialize_Eager",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+
+const base::Feature kV8SerializeAgeCodeFeature{
+ "V8_Serialize_Age_Code", base::FEATURE_DISABLED_BY_DEFAULT};
+
+void SetV8FlagIfFeature(const base::Feature& feature, const char* v8_flag) {
+ if (base::FeatureList::IsEnabled(feature)) {
+ v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag));
+ }
+}
+
+void SetV8FlagIfHasSwitch(const char* switch_name, const char* v8_flag) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) {
+ v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag));
+ }
+}
+
+} // namespace
+
namespace content {
RenderProcessImpl::RenderProcessImpl()
@@ -48,8 +75,17 @@ RenderProcessImpl::RenderProcessImpl()
static_cast<int>(optimize_flag.size()));
}
+ SetV8FlagIfFeature(kV8_ES2015_TailCalls_Feature, "--harmony-tailcalls");
+ SetV8FlagIfFeature(kV8SerializeEagerFeature, "--serialize_eager");
+ SetV8FlagIfFeature(kV8SerializeAgeCodeFeature, "--serialize_age_code");
+ SetV8FlagIfHasSwitch(switches::kDisableJavaScriptHarmonyShipping,
+ "--noharmony-shipping");
+ SetV8FlagIfHasSwitch(switches::kJavaScriptHarmony, "--harmony");
+ SetV8FlagIfHasSwitch(switches::kEnableWasm, "--expose-wasm");
+
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
+
if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
std::string flags(
command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698