From 7172c0172dc158a6db546bc1f6a3cc774d56f00f Mon Sep 17 00:00:00 2001 From: Maggie Chen Date: Wed, 8 May 2019 03:10:50 +0000 Subject: [PATCH] Reland "Add a Finch experiment V8HugeMaxOldGenerationSizefor V8 heap size increase" This reverts commit 4a3bc42c93bcc500af2d4e7d634c671057bbf657. Reason for revert: Original change's description: > Revert "Add a Finch experiment V8HugeMaxOldGenerationSizefor V8 heap size increase" > > This reverts commit 239711874254aced3197862b1bb1ed9fdce999c2. > > Reason for revert: > > Original change's description: > > Add a Finch experiment V8HugeMaxOldGenerationSizefor V8 heap size increase > > > > Increase max_old_space_size to 4 GB based on availability of physical memory. > > The purpose of this finch is to support web apps that require more heap space > > for their data sets > > > > Bug:958974 > > > > Change-Id: I7f6bb9e69a306331242434cfc03acd68ad32333d > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1592792 > > Reviewed-by: Zhenyao Mo > > Reviewed-by: Scott Violet > > Reviewed-by: Brian White > > Commit-Queue: Maggie Chen > > Cr-Commit-Position: refs/heads/master@{#656851} > > TBR=sky@chromium.org,zmo@chromium.org,bcwhite@chromium.org,magchen@chromium.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: 958974 > Change-Id: I304ebbd702a000ee5f4a6d5956d3c61075144711 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598484 > Reviewed-by: Maggie Chen > Commit-Queue: Maggie Chen > Cr-Commit-Position: refs/heads/master@{#657461} TBR=sky@chromium.org,zmo@chromium.org,bcwhite@chromium.org,magchen@chromium.org Change-Id: Ifdd7cee050d3e9855539fee14dfd5dee608029ff No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 958974 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1600715 Reviewed-by: Maggie Chen Commit-Queue: Maggie Chen Cr-Commit-Position: refs/heads/master@{#657581} --- gin/gin_features.cc | 4 ++++ gin/gin_features.h | 1 + gin/v8_initializer.cc | 7 +++++++ .../variations/fieldtrial_testing_config.json | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/gin/gin_features.cc b/gin/gin_features.cc index 0000db391df365..3e6f1cc2fe2225 100644 --- a/gin/gin_features.cc +++ b/gin/gin_features.cc @@ -18,4 +18,8 @@ const base::Feature kV8FlushBytecode{"V8FlushBytecode", const base::Feature kV8MemoryReducerForSmallHeaps{ "V8MemoryReducerForSmallHeaps", base::FEATURE_ENABLED_BY_DEFAULT}; +// Increase V8 heap size to 4GB if the physical memory is bigger than 16 GB. +const base::Feature kV8HugeMaxOldGenerationSize{ + "V8HugeMaxOldGenerationSize", base::FEATURE_DISABLED_BY_DEFAULT}; + } // namespace features diff --git a/gin/gin_features.h b/gin/gin_features.h index 9edc5ffe34389c..f5f18b3ab25cce 100644 --- a/gin/gin_features.h +++ b/gin/gin_features.h @@ -13,6 +13,7 @@ namespace features { GIN_EXPORT extern const base::Feature kV8OptimizeJavascript; GIN_EXPORT extern const base::Feature kV8FlushBytecode; GIN_EXPORT extern const base::Feature kV8MemoryReducerForSmallHeaps; +GIN_EXPORT extern const base::Feature kV8HugeMaxOldGenerationSize; } // namespace features diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index c8baaa5e75582d..770f3cb52990e2 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc @@ -232,6 +232,13 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) { sizeof(no_memory_reducer) - 1); } + if (base::FeatureList::IsEnabled(features::kV8HugeMaxOldGenerationSize)) { + static const char huge_max_old_generation_size[] = + "--huge_max_old_generation_size"; + v8::V8::SetFlagsFromString(huge_max_old_generation_size, + sizeof(huge_max_old_generation_size) - 1); + } + if (IsolateHolder::kStrictMode == mode) { static const char use_strict[] = "--use_strict"; v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 1ed802e2a8ff84..2a77e53b6242ad 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json @@ -5401,6 +5401,25 @@ ] } ], + "V8HugeMaxOldGenerationSize": [ + { + "platforms": [ + "android", + "chromeos", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "V8HugeMaxOldGenerationSize" + ] + } + ] + } + ], "V8Ignition": [ { "platforms": [