1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gin/gin_features.h"
6 #include "base/metrics/field_trial_params.h"
10 // Enable code space compaction when finalizing a full GC with stack.
11 BASE_FEATURE(kV8CompactCodeSpaceWithStack,
12 "V8CompactCodeSpaceWithStack",
13 base::FEATURE_ENABLED_BY_DEFAULT);
15 // Enable compaction when finalizing a full GC with stack.
16 BASE_FEATURE(kV8CompactWithStack,
18 base::FEATURE_ENABLED_BY_DEFAULT);
20 // Enables optimization of JavaScript in V8.
21 BASE_FEATURE(kV8OptimizeJavascript,
22 "V8OptimizeJavascript",
23 base::FEATURE_ENABLED_BY_DEFAULT);
25 // Enables flushing of JS bytecode in V8.
26 BASE_FEATURE(kV8FlushBytecode,
28 base::FEATURE_ENABLED_BY_DEFAULT);
29 const base::FeatureParam<int> kV8FlushBytecodeOldAge{
30 &kV8FlushBytecode, "V8FlushBytecodeOldAge", 5};
32 // Enables flushing of baseline code in V8.
33 BASE_FEATURE(kV8FlushBaselineCode,
34 "V8FlushBaselineCode",
35 base::FEATURE_DISABLED_BY_DEFAULT);
37 // Enables code flushing based on tab visibility.
38 BASE_FEATURE(kV8FlushCodeBasedOnTabVisibility,
39 "V8FlushCodeBasedOnTabVisibility",
40 base::FEATURE_DISABLED_BY_DEFAULT);
42 // Enables code flushing based on time.
43 BASE_FEATURE(kV8FlushCodeBasedOnTime,
44 "V8FlushCodeBasedOnTime",
45 base::FEATURE_DISABLED_BY_DEFAULT);
46 const base::FeatureParam<int> kV8FlushCodeOldTime{&kV8FlushCodeBasedOnTime,
47 "V8FlushCodeOldTime", 30};
49 // Enables finalizing streaming JS compilations on a background thread.
50 BASE_FEATURE(kV8OffThreadFinalization,
51 "V8OffThreadFinalization",
52 base::FEATURE_ENABLED_BY_DEFAULT);
54 // Enables lazy feedback allocation in V8.
55 BASE_FEATURE(kV8LazyFeedbackAllocation,
56 "V8LazyFeedbackAllocation",
57 base::FEATURE_ENABLED_BY_DEFAULT);
59 // Enables per-context marking worklists in V8 GC.
60 BASE_FEATURE(kV8PerContextMarkingWorklist,
61 "V8PerContextMarkingWorklist",
62 base::FEATURE_DISABLED_BY_DEFAULT);
64 // Enables flushing of the instruction cache for the embedded blob.
65 BASE_FEATURE(kV8FlushEmbeddedBlobICache,
66 "V8FlushEmbeddedBlobICache",
67 base::FEATURE_DISABLED_BY_DEFAULT);
69 // Enables reduced number of concurrent marking tasks.
70 BASE_FEATURE(kV8ReduceConcurrentMarkingTasks,
71 "V8ReduceConcurrentMarkingTasks",
72 base::FEATURE_DISABLED_BY_DEFAULT);
74 // Disables reclaiming of unmodified wrappers objects.
75 BASE_FEATURE(kV8NoReclaimUnmodifiedWrappers,
76 "V8NoReclaimUnmodifiedWrappers",
77 base::FEATURE_DISABLED_BY_DEFAULT);
79 // Enables W^X code memory protection in V8.
80 // This is enabled in V8 by default. To test the performance impact, we are
81 // going to disable this feature in a finch experiment.
82 BASE_FEATURE(kV8CodeMemoryWriteProtection,
83 "V8CodeMemoryWriteProtection",
84 base::FEATURE_ENABLED_BY_DEFAULT);
86 // Enables fallback to a breadth-first regexp engine on excessive backtracking.
87 BASE_FEATURE(kV8ExperimentalRegexpEngine,
88 "V8ExperimentalRegexpEngine",
89 base::FEATURE_ENABLED_BY_DEFAULT);
91 // Enables the Turbofan compiler.
92 BASE_FEATURE(kV8Turbofan, "V8Turbofan", base::FEATURE_ENABLED_BY_DEFAULT);
94 // Enables Turbofan's new compiler IR Turboshaft.
95 BASE_FEATURE(kV8Turboshaft, "V8Turboshaft", base::FEATURE_ENABLED_BY_DEFAULT);
97 // Enable running instruction selection on Turboshaft IR directly.
98 BASE_FEATURE(kV8TurboshaftInstructionSelection,
99 "V8TurboshaftInstructionSelection",
100 base::FEATURE_DISABLED_BY_DEFAULT);
102 // Enables Maglev compiler. Note that this only sets the V8 flag when
103 // manually overridden; otherwise it defers to whatever the V8 default is.
104 BASE_FEATURE(kV8Maglev, "V8Maglev", base::FEATURE_ENABLED_BY_DEFAULT);
106 BASE_FEATURE(kV8MemoryReducer,
108 base::FEATURE_DISABLED_BY_DEFAULT);
110 const base::FeatureParam<int> kV8MemoryReducerGCCount{
111 &kV8MemoryReducer, "V8MemoryReducerGCCount", 3};
113 // Enables MinorMC young generation garbage collector.
114 BASE_FEATURE(kV8MinorMS, "V8MinorMS", base::FEATURE_DISABLED_BY_DEFAULT);
116 // Enables Sparkplug compiler. Note that this only sets the V8 flag when
117 // manually overridden; otherwise it defers to whatever the V8 default is.
118 BASE_FEATURE(kV8Sparkplug, "V8Sparkplug", base::FEATURE_ENABLED_BY_DEFAULT);
120 // Enables the concurrent Sparkplug compiler.
121 BASE_FEATURE(kV8ConcurrentSparkplug,
122 "V8ConcurrentSparkplug",
123 base::FEATURE_DISABLED_BY_DEFAULT);
124 const base::FeatureParam<int> kV8ConcurrentSparkplugMaxThreads{
125 &kV8ConcurrentSparkplug, "V8ConcurrentSparkplugMaxThreads", 0};
126 BASE_FEATURE(kV8ConcurrentSparkplugHighPriorityThreads,
127 "V8ConcurrentSparkplugHighPriorityThreads",
128 base::FEATURE_DISABLED_BY_DEFAULT);
129 // Makes sure the experimental Sparkplug compiler is only enabled if short
130 // builtin calls are enabled too.
131 BASE_FEATURE(kV8SparkplugNeedsShortBuiltinCalls,
132 "V8SparkplugNeedsShortBuiltinCalls",
133 base::FEATURE_DISABLED_BY_DEFAULT);
135 // Enables short builtin calls feature.
136 BASE_FEATURE(kV8ShortBuiltinCalls,
137 "V8ShortBuiltinCalls",
138 base::FEATURE_ENABLED_BY_DEFAULT);
140 // Enables fast API calls in TurboFan.
141 BASE_FEATURE(kV8TurboFastApiCalls,
142 "V8TurboFastApiCalls",
143 base::FEATURE_ENABLED_BY_DEFAULT);
145 // Enables faster DOM methods for megamorphic ICs
146 BASE_FEATURE(kV8MegaDomIC, "V8MegaDomIC", base::FEATURE_DISABLED_BY_DEFAULT);
148 // Avoids background threads for GC if isolate is in background.
149 BASE_FEATURE(kV8SingleThreadedGCInBackground,
150 "V8SingleThreadedGCInBackground",
151 base::FEATURE_DISABLED_BY_DEFAULT);
153 // Enables slow histograms that provide detailed information at increased
154 // runtime overheads.
155 BASE_FEATURE(kV8SlowHistograms,
157 base::FEATURE_DISABLED_BY_DEFAULT);
158 // Multiple finch experiments might use slow-histograms. We introduce
159 // separate feature flags to circumvent finch limitations.
160 BASE_FEATURE(kV8SlowHistogramsCodeMemoryWriteProtection,
161 "V8SlowHistogramsCodeMemoryWriteProtection",
162 base::FEATURE_DISABLED_BY_DEFAULT);
163 BASE_FEATURE(kV8SlowHistogramsSparkplug,
164 "V8SlowHistogramsSparkplug",
165 base::FEATURE_DISABLED_BY_DEFAULT);
166 BASE_FEATURE(kV8SlowHistogramsSparkplugAndroid,
167 "V8SlowHistogramsSparkplugAndroid",
168 base::FEATURE_DISABLED_BY_DEFAULT);
169 BASE_FEATURE(kV8SlowHistogramsNoTurbofan,
170 "V8SlowHistogramsNoTurbofan",
171 base::FEATURE_DISABLED_BY_DEFAULT);
173 BASE_FEATURE(kV8DelayMemoryReducer,
174 "V8DelayMemoryReducer",
175 base::FEATURE_ENABLED_BY_DEFAULT);
176 const base::FeatureParam<base::TimeDelta> kV8MemoryReducerStartDelay{
177 &kV8DelayMemoryReducer, "delay", base::Seconds(30)};
179 BASE_FEATURE(kV8ConcurrentMarkingHighPriorityThreads,
180 "V8ConcurrentMarkingHighPriorityThreads",
181 base::FEATURE_DISABLED_BY_DEFAULT);
183 BASE_FEATURE(kV8UseLibmTrigFunctions,
184 "V8UseLibmTrigFunctions",
185 base::FEATURE_ENABLED_BY_DEFAULT);
187 // Elide redundant TDZ hole checks in bytecode. This only sets the V8 flag when
188 // manually overridden.
189 BASE_FEATURE(kV8IgnitionElideRedundantTdzChecks,
190 "V8IgnitionElideRedundantTdzChecks",
191 base::FEATURE_ENABLED_BY_DEFAULT);
193 // The currently enabled fallback to the mid-tier register allocator for huge
194 // Wasm functions. We want to remove this fallback in the future.
195 BASE_FEATURE(kV8MidtierRegallocFallback,
196 "V8MidtierRegallocFallback",
197 base::FEATURE_DISABLED_BY_DEFAULT);
199 // JavaScript language features.
201 // Enables the Symbols-as-WeakMap-keys proposal.
202 BASE_FEATURE(kJavaScriptSymbolAsWeakMapKey,
203 "JavaScriptSymbolAsWeakMapKey",
204 base::FEATURE_ENABLED_BY_DEFAULT);
206 // Enables the change-Array-by-copy proposal.
207 BASE_FEATURE(kJavaScriptChangeArrayByCopy,
208 "JavaScriptChangeArrayByCopy",
209 base::FEATURE_ENABLED_BY_DEFAULT);
211 // Enables the Resizable ArrayBuffer proposal.
212 BASE_FEATURE(kJavaScriptRabGsab,
214 base::FEATURE_ENABLED_BY_DEFAULT);
216 // Enables the JavaScript RegExp Unicode set notation proposal.
217 BASE_FEATURE(kJavaScriptRegExpUnicodeSets,
218 "JavaScriptRegExpUnicodeSets",
219 base::FEATURE_ENABLED_BY_DEFAULT);
221 // Enables the JSON.parse with source proposal.
222 BASE_FEATURE(kJavaScriptJsonParseWithSource,
223 "JavaScriptJsonParseWithSource",
224 base::FEATURE_ENABLED_BY_DEFAULT);
226 // Enables the ArrayBuffer transfer proposal.
227 BASE_FEATURE(kJavaScriptArrayBufferTransfer,
228 "JavaScriptArrayBufferTransfer",
229 base::FEATURE_ENABLED_BY_DEFAULT);
231 // Enables the experiment with compile hints as magic comments.
232 BASE_FEATURE(kJavaScriptCompileHintsMagic,
233 "JavaScriptCompileHintsMagic",
234 base::FEATURE_DISABLED_BY_DEFAULT);
236 // Enables the iterator helpers proposal.
237 BASE_FEATURE(kJavaScriptIteratorHelpers,
238 "kJavaScriptIteratorHelpers",
239 base::FEATURE_ENABLED_BY_DEFAULT);
241 // Enables the Promise.withResolvers proposal.
242 BASE_FEATURE(kJavaScriptPromiseWithResolvers,
243 "JavaScriptPromiseWithResolvers",
244 base::FEATURE_ENABLED_BY_DEFAULT);
246 // WebAssembly features.
248 // Enable support for the WebAssembly tail-call proposal:
249 // https://github.com/WebAssembly/tail-call.
250 BASE_FEATURE(kWebAssemblyTailCall,
251 "WebAssemblyTailCall",
252 base::FEATURE_ENABLED_BY_DEFAULT);
254 // Enable WebAssembly inlining (not user visible).
255 BASE_FEATURE(kWebAssemblyInlining,
256 "WebAssemblyInlining",
257 base::FEATURE_DISABLED_BY_DEFAULT);
259 // Enable the generic wasm-to-js wrapper.
260 BASE_FEATURE(kWebAssemblyGenericWrapper,
261 "WebAssemblyGenericWrapper",
262 base::FEATURE_DISABLED_BY_DEFAULT);
264 // Enable support for multiple memories according to the multi-memory proposal:
265 // https://github.com/WebAssembly/multi-memory. See
266 // https://chromestatus.com/feature/5106389887746048.
267 BASE_FEATURE(kWebAssemblyMultipleMemories,
268 "WebAssemblyMultipleMemories",
269 base::FEATURE_ENABLED_BY_DEFAULT);
271 BASE_FEATURE(kWebAssemblyTurboshaft,
272 "WebAssemblyTurboshaft",
273 base::FEATURE_DISABLED_BY_DEFAULT);
275 } // namespace features