From a407727b22ebe5114ea224f5c714fc99e9297549 Mon Sep 17 00:00:00 2001 From: Michael Lippautz Date: Wed, 22 Jul 2020 14:24:17 +0000 Subject: [PATCH] Add flag for disabling reclamation of unmodified wrappers Will be used in a Finch experiment. Bug: chromium:1107901 Change-Id: I68ea04be372ef2a931519c6d63916ed6001d7a26 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2312816 Reviewed-by: Ross McIlroy Commit-Queue: Michael Lippautz Cr-Commit-Position: refs/heads/master@{#790833} --- gin/gin_features.cc | 4 ++++ gin/gin_features.h | 1 + gin/v8_initializer.cc | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/gin/gin_features.cc b/gin/gin_features.cc index 98a0d7b00ea132..a5bb3251e3ca87 100644 --- a/gin/gin_features.cc +++ b/gin/gin_features.cc @@ -38,4 +38,8 @@ const base::Feature kV8FlushEmbeddedBlobICache{ const base::Feature kV8ReduceConcurrentMarkingTasks{ "V8ReduceConcurrentMarkingTasks", base::FEATURE_DISABLED_BY_DEFAULT}; +// Disables reclaiming of unmodified wrappers objects. +const base::Feature kV8NoReclaimUnmodifiedWrappers{ + "V8NoReclaimUnmodifiedWrappers", base::FEATURE_DISABLED_BY_DEFAULT}; + } // namespace features diff --git a/gin/gin_features.h b/gin/gin_features.h index 68d6457ed2b5b4..1279aa3b2475ec 100644 --- a/gin/gin_features.h +++ b/gin/gin_features.h @@ -18,6 +18,7 @@ GIN_EXPORT extern const base::Feature kV8ConcurrentInlining; GIN_EXPORT extern const base::Feature kV8PerContextMarkingWorklist; GIN_EXPORT extern const base::Feature kV8FlushEmbeddedBlobICache; GIN_EXPORT extern const base::Feature kV8ReduceConcurrentMarkingTasks; +GIN_EXPORT extern const base::Feature kV8NoReclaimUnmodifiedWrappers; } // namespace features diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index 630814e5af46ab..e68d4861f3d121 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc @@ -256,6 +256,13 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) { sizeof(gc_experiment_reduce_concurrent_marking_tasks) - 1); } + if (base::FeatureList::IsEnabled(features::kV8NoReclaimUnmodifiedWrappers)) { + static constexpr char no_reclaim_unmodified_wrappers[] = + "--no-reclaim-unmodified-wrappers"; + v8::V8::SetFlagsFromString(no_reclaim_unmodified_wrappers, + sizeof(no_reclaim_unmodified_wrappers) - 1); + } + if (IsolateHolder::kStrictMode == mode) { static const char use_strict[] = "--use_strict"; v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1);