blob: c481324900921832361d891bb47dc9e5b61d0bac [file] [log] [blame]
Avi Drissman468e51b62022-09-13 20:47:011// Copyright 2017 The Chromium Authors
Ross McIlroy45e9500a2018-03-27 17:06:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gin/gin_features.h"
Michael Lippautzdc5c8632024-04-23 16:02:416
Camillo Bruni5e5376f2021-04-01 19:15:097#include "base/metrics/field_trial_params.h"
Ross McIlroy45e9500a2018-03-27 17:06:028
9namespace features {
10
Dominik Inführb13c75a92022-02-18 11:15:5611// Enable code space compaction when finalizing a full GC with stack.
Daniel Chengaab4b01b2022-09-20 14:28:3812BASE_FEATURE(kV8CompactCodeSpaceWithStack,
Leszek Swirski7a6cb1252024-06-19 15:37:3313 ("V8CompactCodeSpaceWithStack"),
14 kFeatureDefaultStateControlledByV8);
Michael Lippautz471f75f22021-11-12 15:30:1115
16// Enable compaction when finalizing a full GC with stack.
Daniel Chengaab4b01b2022-09-20 14:28:3817BASE_FEATURE(kV8CompactWithStack,
Leszek Swirski7a6cb1252024-06-19 15:37:3318 ("V8CompactWithStack"),
19 kFeatureDefaultStateControlledByV8);
Michael Lippautz471f75f22021-11-12 15:30:1120
Benoît Lizé787cd3a2024-05-17 14:47:4621// Decommit (rather than discard) pooled pages.
22BASE_FEATURE(kV8DecommitPooledPages,
Leszek Swirski7a6cb1252024-06-19 15:37:3323 ("DecommitPooledPages"),
24 kFeatureDefaultStateControlledByV8);
Benoît Lizé787cd3a2024-05-17 14:47:4625
Ross McIlroy45e9500a2018-03-27 17:06:0226// Enables optimization of JavaScript in V8.
Daniel Chengaab4b01b2022-09-20 14:28:3827BASE_FEATURE(kV8OptimizeJavascript,
Leszek Swirski7a6cb1252024-06-19 15:37:3328 ("V8OptimizeJavascript"),
29 kFeatureDefaultStateControlledByV8);
Ross McIlroy45e9500a2018-03-27 17:06:0230
Ross McIlroyf4100322019-02-04 11:02:4631// Enables flushing of JS bytecode in V8.
Daniel Chengaab4b01b2022-09-20 14:28:3832BASE_FEATURE(kV8FlushBytecode,
Leszek Swirski7a6cb1252024-06-19 15:37:3333 ("V8FlushBytecode"),
34 kFeatureDefaultStateControlledByV8);
Toon Verwaest60185fc2022-07-27 10:40:3035const base::FeatureParam<int> kV8FlushBytecodeOldAge{
36 &kV8FlushBytecode, "V8FlushBytecodeOldAge", 5};
Ross McIlroyf4100322019-02-04 11:02:4637
Leszek Swirski0eb5dea2021-09-07 11:14:3338// Enables flushing of baseline code in V8.
Daniel Chengaab4b01b2022-09-20 14:28:3839BASE_FEATURE(kV8FlushBaselineCode,
Leszek Swirski7a6cb1252024-06-19 15:37:3340 ("V8FlushBaselineCode"),
41 kFeatureDefaultStateControlledByV8);
Leszek Swirski0eb5dea2021-09-07 11:14:3342
Dominik Inführaa5f5112023-06-07 21:07:3543// Enables code flushing based on tab visibility.
44BASE_FEATURE(kV8FlushCodeBasedOnTabVisibility,
Leszek Swirski7a6cb1252024-06-19 15:37:3345 ("V8FlushCodeBasedOnTabVisibility"),
46 kFeatureDefaultStateControlledByV8);
Dominik Inführaa5f5112023-06-07 21:07:3547
48// Enables code flushing based on time.
49BASE_FEATURE(kV8FlushCodeBasedOnTime,
Leszek Swirski7a6cb1252024-06-19 15:37:3350 ("V8FlushCodeBasedOnTime"),
51 kFeatureDefaultStateControlledByV8);
Dominik Inführaa5f5112023-06-07 21:07:3552const base::FeatureParam<int> kV8FlushCodeOldTime{&kV8FlushCodeBasedOnTime,
53 "V8FlushCodeOldTime", 30};
54
Leszek Swirskide933c192020-04-03 17:30:5355// Enables finalizing streaming JS compilations on a background thread.
Daniel Chengaab4b01b2022-09-20 14:28:3856BASE_FEATURE(kV8OffThreadFinalization,
Leszek Swirski7a6cb1252024-06-19 15:37:3357 ("V8OffThreadFinalization"),
58 kFeatureDefaultStateControlledByV8);
Leszek Swirskide933c192020-04-03 17:30:5359
Mythri A258ae112019-06-05 11:41:1060// Enables lazy feedback allocation in V8.
Daniel Chengaab4b01b2022-09-20 14:28:3861BASE_FEATURE(kV8LazyFeedbackAllocation,
Leszek Swirski7a6cb1252024-06-19 15:37:3362 ("V8LazyFeedbackAllocation"),
63 kFeatureDefaultStateControlledByV8);
Mythri A258ae112019-06-05 11:41:1064
Ulan Degenbaev1e41d4d2020-07-08 12:19:5465// Enables per-context marking worklists in V8 GC.
Daniel Chengaab4b01b2022-09-20 14:28:3866BASE_FEATURE(kV8PerContextMarkingWorklist,
Leszek Swirski7a6cb1252024-06-19 15:37:3367 ("V8PerContextMarkingWorklist"),
68 kFeatureDefaultStateControlledByV8);
Ulan Degenbaev916bc13e2020-07-07 15:07:4869
Ulan Degenbaev1e41d4d2020-07-08 12:19:5470// Enables flushing of the instruction cache for the embedded blob.
Daniel Chengaab4b01b2022-09-20 14:28:3871BASE_FEATURE(kV8FlushEmbeddedBlobICache,
Leszek Swirski7a6cb1252024-06-19 15:37:3372 ("V8FlushEmbeddedBlobICache"),
73 kFeatureDefaultStateControlledByV8);
Ulan Degenbaev1e41d4d2020-07-08 12:19:5474
75// Enables reduced number of concurrent marking tasks.
Daniel Chengaab4b01b2022-09-20 14:28:3876BASE_FEATURE(kV8ReduceConcurrentMarkingTasks,
Leszek Swirski7a6cb1252024-06-19 15:37:3377 ("V8ReduceConcurrentMarkingTasks"),
78 kFeatureDefaultStateControlledByV8);
Ulan Degenbaev1e41d4d2020-07-08 12:19:5479
Michael Lippautza4077272020-07-22 14:24:1780// Disables reclaiming of unmodified wrappers objects.
Daniel Chengaab4b01b2022-09-20 14:28:3881BASE_FEATURE(kV8NoReclaimUnmodifiedWrappers,
Leszek Swirski7a6cb1252024-06-19 15:37:3382 ("V8NoReclaimUnmodifiedWrappers"),
83 kFeatureDefaultStateControlledByV8);
Michael Lippautza4077272020-07-22 14:24:1784
pthier02d48fbc2021-09-27 11:50:1185// Enables W^X code memory protection in V8.
86// This is enabled in V8 by default. To test the performance impact, we are
87// going to disable this feature in a finch experiment.
Daniel Chengaab4b01b2022-09-20 14:28:3888BASE_FEATURE(kV8CodeMemoryWriteProtection,
Leszek Swirski7a6cb1252024-06-19 15:37:3389 ("V8CodeMemoryWriteProtection"),
90 kFeatureDefaultStateControlledByV8);
pthier02d48fbc2021-09-27 11:50:1191
Maya Lekova776d92092021-01-08 11:11:2392// Enables fallback to a breadth-first regexp engine on excessive backtracking.
Daniel Chengaab4b01b2022-09-20 14:28:3893BASE_FEATURE(kV8ExperimentalRegexpEngine,
94 "V8ExperimentalRegexpEngine",
Leszek Swirski7a6cb1252024-06-19 15:37:3395 kFeatureDefaultStateControlledByV8);
Maya Lekova776d92092021-01-08 11:11:2396
Camillo Brunic8566b862023-02-16 09:10:4897// Enables the Turbofan compiler.
Leszek Swirski7a6cb1252024-06-19 15:37:3398BASE_FEATURE(kV8Turbofan, ("V8Turbofan"), kFeatureDefaultStateControlledByV8);
Camillo Brunic8566b862023-02-16 09:10:4899
Nico Hartmannc87b89e2023-06-14 14:29:06100// Enables Turbofan's new compiler IR Turboshaft.
Leszek Swirski7a6cb1252024-06-19 15:37:33101BASE_FEATURE(kV8Turboshaft,
102 ("V8Turboshaft"),
103 kFeatureDefaultStateControlledByV8);
Nico Hartmannc87b89e2023-06-14 14:29:06104
Nico Hartmannd88debc2023-10-25 16:48:30105// Enable running instruction selection on Turboshaft IR directly.
106BASE_FEATURE(kV8TurboshaftInstructionSelection,
Leszek Swirski7a6cb1252024-06-19 15:37:33107 ("V8TurboshaftInstructionSelection"),
108 kFeatureDefaultStateControlledByV8);
Nico Hartmannd88debc2023-10-25 16:48:30109
Victor Gomes6f7554462023-07-17 15:22:37110// Enables Maglev compiler. Note that this only sets the V8 flag when
111// manually overridden; otherwise it defers to whatever the V8 default is.
Leszek Swirski7a6cb1252024-06-19 15:37:33112BASE_FEATURE(kV8Maglev, ("V8Maglev"), kFeatureDefaultStateControlledByV8);
Etienne Pierre-doray21b714df2024-03-21 12:56:16113BASE_FEATURE(kV8ConcurrentMaglevHighPriorityThreads,
Leszek Swirski7a6cb1252024-06-19 15:37:33114 ("V8ConcurrentMaglevHighPriorityThreads"),
115 kFeatureDefaultStateControlledByV8);
Ross McIlroybeaa73b2021-02-03 10:27:34116
Dominik Inführ390e7472023-08-15 07:33:39117BASE_FEATURE(kV8MemoryReducer,
118 "V8MemoryReducer",
119 base::FEATURE_DISABLED_BY_DEFAULT);
120
121const base::FeatureParam<int> kV8MemoryReducerGCCount{
122 &kV8MemoryReducer, "V8MemoryReducerGCCount", 3};
123
Omer Katze72b2982023-05-02 14:43:49124// Enables MinorMC young generation garbage collector.
Leszek Swirski7a6cb1252024-06-19 15:37:33125BASE_FEATURE(kV8MinorMS, ("V8MinorMS"), kFeatureDefaultStateControlledByV8);
Omer Katze72b2982023-05-02 14:43:49126
Omer Katzdd11ac172024-07-12 10:59:23127BASE_FEATURE(kV8ScavengerHigherCapacity,
128 "V8ScavengerHigherCapacity",
129 base::FEATURE_DISABLED_BY_DEFAULT);
130
131const base::FeatureParam<int> kV8ScavengerMaxCapacity{
132 &kV8ScavengerHigherCapacity, "V8ScavengerMaxCapacity", 16};
133
Omer Katzbbffc262024-09-10 16:50:04134BASE_FEATURE(kV8SeparateGCPhases,
135 ("V8SeparateGCPhases"),
136 kFeatureDefaultStateControlledByV8);
137
Leszek Swirskif68e123f2021-07-22 18:23:39138// Enables Sparkplug compiler. Note that this only sets the V8 flag when
139// manually overridden; otherwise it defers to whatever the V8 default is.
Leszek Swirski7a6cb1252024-06-19 15:37:33140BASE_FEATURE(kV8Sparkplug, ("V8Sparkplug"), kFeatureDefaultStateControlledByV8);
Leszek Swirskiaac0b192021-03-03 17:07:13141
Victor Gomes409ef5a2021-12-02 09:47:35142// Enables the concurrent Sparkplug compiler.
Daniel Chengaab4b01b2022-09-20 14:28:38143BASE_FEATURE(kV8ConcurrentSparkplug,
Leszek Swirski7a6cb1252024-06-19 15:37:33144 ("V8ConcurrentSparkplug"),
145 kFeatureDefaultStateControlledByV8);
Victor Gomes409ef5a2021-12-02 09:47:35146const base::FeatureParam<int> kV8ConcurrentSparkplugMaxThreads{
147 &kV8ConcurrentSparkplug, "V8ConcurrentSparkplugMaxThreads", 0};
Daniel Chengaab4b01b2022-09-20 14:28:38148BASE_FEATURE(kV8ConcurrentSparkplugHighPriorityThreads,
Leszek Swirski7a6cb1252024-06-19 15:37:33149 ("V8ConcurrentSparkplugHighPriorityThreads"),
150 kFeatureDefaultStateControlledByV8);
Leszek Swirski4cc40362021-06-25 16:22:04151// Makes sure the experimental Sparkplug compiler is only enabled if short
152// builtin calls are enabled too.
Daniel Chengaab4b01b2022-09-20 14:28:38153BASE_FEATURE(kV8SparkplugNeedsShortBuiltinCalls,
Leszek Swirski7a6cb1252024-06-19 15:37:33154 ("V8SparkplugNeedsShortBuiltinCalls"),
155 kFeatureDefaultStateControlledByV8);
Leszek Swirski4cc40362021-06-25 16:22:04156
Leszek Swirski25757112024-04-09 14:53:31157// Enables batch compilation for Sparkplug (baseline) compilation.
158BASE_FEATURE(kV8BaselineBatchCompilation,
Leszek Swirski7a6cb1252024-06-19 15:37:33159 ("V8BaselineBatchCompilation"),
160 kFeatureDefaultStateControlledByV8);
Leszek Swirski25757112024-04-09 14:53:31161
[email protected]bda533ac2021-03-29 12:14:12162// Enables short builtin calls feature.
Daniel Chengaab4b01b2022-09-20 14:28:38163BASE_FEATURE(kV8ShortBuiltinCalls,
Leszek Swirski7a6cb1252024-06-19 15:37:33164 ("V8ShortBuiltinCalls"),
165 kFeatureDefaultStateControlledByV8);
[email protected]bda533ac2021-03-29 12:14:12166
Maya Lekova232168d2021-01-19 13:43:39167// Enables fast API calls in TurboFan.
Daniel Chengaab4b01b2022-09-20 14:28:38168BASE_FEATURE(kV8TurboFastApiCalls,
Leszek Swirski7a6cb1252024-06-19 15:37:33169 ("V8TurboFastApiCalls"),
170 kFeatureDefaultStateControlledByV8);
Maya Lekova232168d2021-01-19 13:43:39171
Camillo Bruni3a3f7ff2023-02-01 14:35:38172// Enables faster DOM methods for megamorphic ICs
Leszek Swirski7a6cb1252024-06-19 15:37:33173BASE_FEATURE(kV8MegaDomIC, ("V8MegaDomIC"), kFeatureDefaultStateControlledByV8);
Camillo Bruni3a3f7ff2023-02-01 14:35:38174
Olivier Flückigerd772e5d2024-06-07 07:21:25175// Faster object cloning
176BASE_FEATURE(kV8SideStepTransitions,
Leszek Swirski7a6cb1252024-06-19 15:37:33177 ("V8SideStepTransitions"),
178 kFeatureDefaultStateControlledByV8);
Olivier Flückigerd772e5d2024-06-07 07:21:25179
Dominik Inführ99a23d32023-08-02 15:40:29180// Avoids background threads for GC if isolate is in background.
181BASE_FEATURE(kV8SingleThreadedGCInBackground,
Leszek Swirski7a6cb1252024-06-19 15:37:33182 ("V8SingleThreadedGCInBackground"),
183 kFeatureDefaultStateControlledByV8);
Dominik Inführ99a23d32023-08-02 15:40:29184
Dominik Inführ06fa6672024-05-28 16:55:14185BASE_FEATURE(kV8SingleThreadedGCInBackgroundParallelPause,
Leszek Swirski7a6cb1252024-06-19 15:37:33186 ("V8SingleThreadedGCInBackgroundParallelPause"),
187 kFeatureDefaultStateControlledByV8);
Dominik Inführ06fa6672024-05-28 16:55:14188
189BASE_FEATURE(kV8SingleThreadedGCInBackgroundNoIncrementalMarking,
190 "V8SingleThreadedGCInBackgroundNoIncrementalMarking",
Leszek Swirski7a6cb1252024-06-19 15:37:33191 kFeatureDefaultStateControlledByV8);
Dominik Inführ06fa6672024-05-28 16:55:14192
Olivier Flückigerc722bf482023-12-20 12:47:42193// Use V8 efficiency mode for tiering decisions.
194BASE_FEATURE(kV8EfficiencyModeTiering,
195 "V8EfficiencyModeTiering",
Olivier Flückigercad8d5ca2024-04-02 09:53:39196 base::FEATURE_ENABLED_BY_DEFAULT);
Olivier Flückigerc722bf482023-12-20 12:47:42197const base::FeatureParam<int> kV8EfficiencyModeTieringDelayTurbofan{
Olivier Flückigercad8d5ca2024-04-02 09:53:39198 &kV8EfficiencyModeTiering, "V8EfficiencyModeTieringDelayTurbofan", 15000};
Olivier Flückigerc722bf482023-12-20 12:47:42199
Camillo Bruni262a21a2021-08-04 14:36:49200// Enables slow histograms that provide detailed information at increased
201// runtime overheads.
Daniel Chengaab4b01b2022-09-20 14:28:38202BASE_FEATURE(kV8SlowHistograms,
Leszek Swirski7a6cb1252024-06-19 15:37:33203 ("V8SlowHistograms"),
204 kFeatureDefaultStateControlledByV8);
Camillo Brunie04a51e52021-10-04 17:45:09205// Multiple finch experiments might use slow-histograms. We introduce
206// separate feature flags to circumvent finch limitations.
Daniel Chengaab4b01b2022-09-20 14:28:38207BASE_FEATURE(kV8SlowHistogramsCodeMemoryWriteProtection,
208 "V8SlowHistogramsCodeMemoryWriteProtection",
209 base::FEATURE_DISABLED_BY_DEFAULT);
Daniel Lehmannc9370852024-03-18 12:55:50210BASE_FEATURE(kV8SlowHistogramsIntelJCCErratumMitigation,
211 "V8SlowHistogramsIntelJCCErratumMitigation",
212 base::FEATURE_DISABLED_BY_DEFAULT);
Daniel Chengaab4b01b2022-09-20 14:28:38213BASE_FEATURE(kV8SlowHistogramsSparkplug,
214 "V8SlowHistogramsSparkplug",
215 base::FEATURE_DISABLED_BY_DEFAULT);
216BASE_FEATURE(kV8SlowHistogramsSparkplugAndroid,
217 "V8SlowHistogramsSparkplugAndroid",
218 base::FEATURE_DISABLED_BY_DEFAULT);
Camillo Brunic8566b862023-02-16 09:10:48219BASE_FEATURE(kV8SlowHistogramsNoTurbofan,
220 "V8SlowHistogramsNoTurbofan",
221 base::FEATURE_DISABLED_BY_DEFAULT);
Camillo Bruni262a21a2021-08-04 14:36:49222
Anton Bikineev2bc9146d2024-07-08 10:17:14223// Enable 16GB heap reservation for Oilpan.
224BASE_FEATURE(kV8CppGCEnableLargerCage,
225 "V8CppGCEnableLargerCage",
226 kFeatureDefaultStateControlledByV8);
227
Daniel Chengaab4b01b2022-09-20 14:28:38228BASE_FEATURE(kV8DelayMemoryReducer,
229 "V8DelayMemoryReducer",
François Doraye38ec6c2022-12-13 17:12:40230 base::FEATURE_ENABLED_BY_DEFAULT);
Etienne Pierre-doray87b4b84b2022-08-09 20:04:48231const base::FeatureParam<base::TimeDelta> kV8MemoryReducerStartDelay{
François Doraye38ec6c2022-12-13 17:12:40232 &kV8DelayMemoryReducer, "delay", base::Seconds(30)};
Etienne Pierre-doray87b4b84b2022-08-09 20:04:48233
Etienne Pierre-doray89f75072023-05-13 15:08:44234BASE_FEATURE(kV8ConcurrentMarkingHighPriorityThreads,
Leszek Swirski7a6cb1252024-06-19 15:37:33235 ("V8ConcurrentMarkingHighPriorityThreads"),
236 kFeatureDefaultStateControlledByV8);
Etienne Pierre-doray89f75072023-05-13 15:08:44237
Omer Katz30f15332024-06-14 17:13:27238BASE_FEATURE(kV8UpdateLimitAfterLoading,
Leszek Swirski7a6cb1252024-06-19 15:37:33239 ("V8UpdateLimitAfterLoading"),
240 kFeatureDefaultStateControlledByV8);
Omer Katz30f15332024-06-14 17:13:27241
Scott Violet744f9f872022-12-15 20:24:51242BASE_FEATURE(kV8UseLibmTrigFunctions,
Leszek Swirski7a6cb1252024-06-19 15:37:33243 ("V8UseLibmTrigFunctions"),
244 kFeatureDefaultStateControlledByV8);
Scott Violet744f9f872022-12-15 20:24:51245
Simon Zünd09d366b2024-03-21 14:53:37246BASE_FEATURE(kV8UseOriginalMessageForStackTrace,
Leszek Swirski7a6cb1252024-06-19 15:37:33247 ("V8UseOriginalMessageForStackTrace"),
248 kFeatureDefaultStateControlledByV8);
Simon Zünd09d366b2024-03-21 14:53:37249
Etienne Pierre-doray3976b762024-08-27 17:47:50250BASE_FEATURE(kV8IncrementalMarkingStartUserVisible,
251 ("V8IncrementalMarkingStartUserVisible"),
252 kFeatureDefaultStateControlledByV8);
253
Michael Lippautzdc5c8632024-04-23 16:02:41254BASE_FEATURE(kV8IdleGcOnContextDisposal,
Leszek Swirski7a6cb1252024-06-19 15:37:33255 ("V8IdleGcOnContextDisposal"),
256 kFeatureDefaultStateControlledByV8);
Michael Lippautzdc5c8632024-04-23 16:02:41257
Shu-yu Guo07bdfb42023-05-11 21:01:54258// Elide redundant TDZ hole checks in bytecode. This only sets the V8 flag when
259// manually overridden.
260BASE_FEATURE(kV8IgnitionElideRedundantTdzChecks,
Leszek Swirski7a6cb1252024-06-19 15:37:33261 ("V8IgnitionElideRedundantTdzChecks"),
262 kFeatureDefaultStateControlledByV8);
Shu-yu Guo07bdfb42023-05-11 21:01:54263
Daniel Lehmann456950c2024-02-09 14:05:54264// Add additional alignment for some jumps in generated x64 code, to mitigate
265// the performance impact of the Intel JCC erratum (https://crbug.com/v8/14225).
266// Currently disabled by default in V8, but adding here temporarily to test
267// real-world performance impact via a Finch experiment.
268BASE_FEATURE(kV8IntelJCCErratumMitigation,
Leszek Swirski7a6cb1252024-06-19 15:37:33269 ("V8IntelJCCErratumMitigation"),
270 kFeatureDefaultStateControlledByV8);
Daniel Lehmann456950c2024-02-09 14:05:54271
Shu-yu Guo61ae6bfa2022-11-04 15:13:31272// JavaScript language features.
273
Marja Hölttä24a0eb52023-04-17 13:57:25274// Enables the experiment with compile hints as magic comments.
275BASE_FEATURE(kJavaScriptCompileHintsMagic,
Leszek Swirski7a6cb1252024-06-19 15:37:33276 ("JavaScriptCompileHintsMagic"),
277 kFeatureDefaultStateControlledByV8);
Marja Hölttä24a0eb52023-04-17 13:57:25278
Rezvan Mahdavi Hezaveh777441c72023-06-15 23:42:31279// Enables the iterator helpers proposal.
280BASE_FEATURE(kJavaScriptIteratorHelpers,
Leszek Swirski7a6cb1252024-06-19 15:37:33281 ("kJavaScriptIteratorHelpers"),
282 kFeatureDefaultStateControlledByV8);
Rezvan Mahdavi Hezaveh777441c72023-06-15 23:42:31283
Shu-yu Guo75a1e352023-09-15 01:04:51284// Enables the Promise.withResolvers proposal.
285BASE_FEATURE(kJavaScriptPromiseWithResolvers,
Leszek Swirski7a6cb1252024-06-19 15:37:33286 ("JavaScriptPromiseWithResolvers"),
287 kFeatureDefaultStateControlledByV8);
Shu-yu Guo75a1e352023-09-15 01:04:51288
Shu-yu Guo924f2732023-12-20 23:32:14289// Enables the RegExp modifiers proposal.
290BASE_FEATURE(kJavaScriptRegExpModifiers,
Leszek Swirski7a6cb1252024-06-19 15:37:33291 ("JavaScriptRegExpModifiers"),
292 kFeatureDefaultStateControlledByV8);
Shu-yu Guo924f2732023-12-20 23:32:14293
Nicolò Ribaudocc6f95722024-01-09 16:44:57294// Enables the `with` syntax for the Import Attributes proposal.
295BASE_FEATURE(kJavaScriptImportAttributes,
Leszek Swirski7a6cb1252024-06-19 15:37:33296 ("JavaScriptImportAttributes"),
297 kFeatureDefaultStateControlledByV8);
Nicolò Ribaudocc6f95722024-01-09 16:44:57298
Rezvan Mahdavi Hezavehdde47212024-01-12 22:21:44299// Enables the set methods proposal.
300BASE_FEATURE(kJavaScriptSetMethods,
Leszek Swirski7a6cb1252024-06-19 15:37:33301 ("JavaScriptSetMethods"),
302 kFeatureDefaultStateControlledByV8);
Rezvan Mahdavi Hezavehdde47212024-01-12 22:21:44303
Shu-yu Guobf2f7aa2024-01-31 19:01:55304// Enables the RegExp duplicate named capture groups proposal.
305BASE_FEATURE(kJavaScriptRegExpDuplicateNamedGroups,
Leszek Swirski7a6cb1252024-06-19 15:37:33306 ("JavaScriptRegExpDuplicateNamedGroups"),
307 kFeatureDefaultStateControlledByV8);
Shu-yu Guobf2f7aa2024-01-31 19:01:55308
Shu-yu Guo160b2ae2024-07-10 18:02:59309// Enables the Promise.try proposal.
310BASE_FEATURE(kJavaScriptPromiseTry,
311 ("JavaScriptPromiseTry"),
312 kFeatureDefaultStateControlledByV8);
313
Thibaud Michauda76870a2023-01-31 18:48:38314// WebAssembly features.
315
Matthias Liedtke2c83e3f42024-08-07 13:10:36316// Enable WebAssembly deoptimization support (not user visible), see
317// https://crbug.com/42204618.
318BASE_FEATURE(kWebAssemblyDeopt,
319 "WebAssemblyDeopt",
320 kFeatureDefaultStateControlledByV8);
321
Clemens Backesb63dded2023-03-15 12:51:54322// Enable WebAssembly inlining (not user visible).
323BASE_FEATURE(kWebAssemblyInlining,
Leszek Swirski7a6cb1252024-06-19 15:37:33324 ("WebAssemblyInlining"),
325 kFeatureDefaultStateControlledByV8);
Clemens Backesb63dded2023-03-15 12:51:54326
Daniel Lehmann4205b352024-07-15 11:01:49327// Feature for WebAssembly speculative inlining of indirect calls (see
328// https://crbug.com/335082212; and https://crbug.com/40898108 for direct call
329// and call_ref inlining, which has already launched above). Not user visible.
330BASE_FEATURE(kWebAssemblyInliningCallIndirect,
331 "WebAssemblyInliningCallIndirect",
332 kFeatureDefaultStateControlledByV8);
333
Eva Herencsarovaf3c64ba2024-05-10 10:47:29334// Enable WebAssembly code flushing.
335BASE_FEATURE(kWebAssemblyLiftoffCodeFlushing,
Leszek Swirski7a6cb1252024-06-19 15:37:33336 ("WebAssemblyLiftoffCodeFlushing"),
337 kFeatureDefaultStateControlledByV8);
Eva Herencsarovaf3c64ba2024-05-10 10:47:29338
Andreas Haas79abc462023-10-04 08:17:57339// Enable the generic wasm-to-js wrapper.
340BASE_FEATURE(kWebAssemblyGenericWrapper,
Leszek Swirski7a6cb1252024-06-19 15:37:33341 ("WebAssemblyGenericWrapper"),
342 kFeatureDefaultStateControlledByV8);
Clemens Backesc94fd762023-10-23 15:14:07343
344// Enable support for multiple memories according to the multi-memory proposal:
345// https://github.com/WebAssembly/multi-memory. See
346// https://chromestatus.com/feature/5106389887746048.
347BASE_FEATURE(kWebAssemblyMultipleMemories,
Leszek Swirski7a6cb1252024-06-19 15:37:33348 ("WebAssemblyMultipleMemories"),
349 kFeatureDefaultStateControlledByV8);
Clemens Backesc94fd762023-10-23 15:14:07350
Manos Koukoutos582a5b7632023-10-28 07:05:41351BASE_FEATURE(kWebAssemblyTurboshaft,
Leszek Swirski7a6cb1252024-06-19 15:37:33352 ("WebAssemblyTurboshaft"),
353 kFeatureDefaultStateControlledByV8);
Manos Koukoutos582a5b7632023-10-28 07:05:41354
Manos Koukoutos183e9302023-12-01 15:43:05355BASE_FEATURE(kWebAssemblyTurboshaftInstructionSelection,
Leszek Swirski7a6cb1252024-06-19 15:37:33356 ("WebAssemblyTurboshaftInstructionSelection"),
357 kFeatureDefaultStateControlledByV8);
Manos Koukoutos183e9302023-12-01 15:43:05358
Clemens Backes859c9692024-06-05 15:44:54359// Feature for more aggressive code caching (https://crbug.com/v8/14411,
360// https://crbug.com/40945417) and three parameters to control caching behavior.
Clemens Backes6cdcedb2023-11-24 08:22:40361BASE_FEATURE(kWebAssemblyMoreAggressiveCodeCaching,
362 "WebAssemblyMoreAggressiveCodeCaching",
363 base::FEATURE_DISABLED_BY_DEFAULT);
364const base::FeatureParam<int> kWebAssemblyMoreAggressiveCodeCachingThreshold{
Clemens Backes61c7f592023-11-24 14:51:20365 &kWebAssemblyMoreAggressiveCodeCaching, "WebAssemblyCodeCachingThreshold",
Clemens Backes8ce673062023-11-24 15:38:34366 1'000};
Clemens Backes6cdcedb2023-11-24 08:22:40367const base::FeatureParam<int> kWebAssemblyMoreAggressiveCodeCachingTimeoutMs{
Clemens Backes61c7f592023-11-24 14:51:20368 &kWebAssemblyMoreAggressiveCodeCaching, "WebAssemblyCodeCachingTimeoutMs",
Clemens Backes859c9692024-06-05 15:44:54369 2000};
Clemens Backes6cdcedb2023-11-24 08:22:40370const base::FeatureParam<int>
371 kWebAssemblyMoreAggressiveCodeCachingHardThreshold{
Clemens Backes61c7f592023-11-24 14:51:20372 &kWebAssemblyMoreAggressiveCodeCaching,
Clemens Backes859c9692024-06-05 15:44:54373 "WebAssemblyCodeCachingHardThreshold", 1'000'000};
Clemens Backes6cdcedb2023-11-24 08:22:40374
Ross McIlroy45e9500a2018-03-27 17:06:02375} // namespace features