1// Copyright 2012 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This file defines all of the flags. It is separated into different section,
6// for Debug, Release, Logging and Profiling, etc. To add a new flag, find the
7// correct section, and use one of the DEFINE_ macros, without a trailing ';'.
8//
9// This include does not have a guard, because it is a template-style include,
10// which can be included multiple times in different modes. It expects to have
11// a mode defined before it's included. The modes are FLAG_MODE_... below:
12//
13// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD
14
15#define DEFINE_IMPLICATION(whenflag, thenflag) \
16 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, true)
17
18#define DEFINE_NEG_IMPLICATION(whenflag, thenflag) \
19 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, false)
20
21#define DEFINE_NEG_NEG_IMPLICATION(whenflag, thenflag) \
22 DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, false)
23
24// We want to declare the names of the variables for the header file. Normally
25// this will just be an extern declaration, but for a readonly flag we let the
26// compiler make better optimizations by giving it the value.
27#if defined(FLAG_MODE_DECLARE)
28#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
29 V8_EXPORT_PRIVATE extern ctype FLAG_##nam;
30#define FLAG_READONLY(ftype, ctype, nam, def, cmt) \
31 static constexpr ctype FLAG_##nam = def;
32
33// We want to supply the actual storage and value for the flag variable in the
34// .cc file. We only do this for writable flags.
35#elif defined(FLAG_MODE_DEFINE)
36#ifdef USING_V8_SHARED
37#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
38 V8_EXPORT_PRIVATE extern ctype FLAG_##nam;
39#else
40#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
41 V8_EXPORT_PRIVATE ctype FLAG_##nam = def;
42#endif
43
44// We need to define all of our default values so that the Flag structure can
45// access them by pointer. These are just used internally inside of one .cc,
46// for MODE_META, so there is no impact on the flags interface.
47#elif defined(FLAG_MODE_DEFINE_DEFAULTS)
48#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
49 static constexpr ctype FLAGDEFAULT_##nam = def;
50
51// We want to write entries into our meta data table, for internal parsing and
52// printing / etc in the flag parser code. We only do this for writable flags.
53#elif defined(FLAG_MODE_META)
54#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
55 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false } \
56 ,
57#define FLAG_ALIAS(ftype, ctype, alias, nam) \
58 { \
59 Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \
60 "alias for --" #nam, false \
61 } \
62 ,
63
64// We produce the code to set flags when it is implied by another flag.
65#elif defined(FLAG_MODE_DEFINE_IMPLICATIONS)
66#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) \
67 if (FLAG_##whenflag) FLAG_##thenflag = value;
68
69#define DEFINE_GENERIC_IMPLICATION(whenflag, statement) \
70 if (FLAG_##whenflag) statement;
71
72#define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value) \
73 if (!FLAG_##whenflag) FLAG_##thenflag = value;
74
75// We apply a generic macro to the flags.
76#elif defined(FLAG_MODE_APPLY)
77
78#define FLAG_FULL FLAG_MODE_APPLY
79
80#else
81#error No mode supplied when including flags.defs
82#endif
83
84// Dummy defines for modes where it is not relevant.
85#ifndef FLAG_FULL
86#define FLAG_FULL(ftype, ctype, nam, def, cmt)
87#endif
88
89#ifndef FLAG_READONLY
90#define FLAG_READONLY(ftype, ctype, nam, def, cmt)
91#endif
92
93#ifndef FLAG_ALIAS
94#define FLAG_ALIAS(ftype, ctype, alias, nam)
95#endif
96
97#ifndef DEFINE_VALUE_IMPLICATION
98#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value)
99#endif
100
101#ifndef DEFINE_GENERIC_IMPLICATION
102#define DEFINE_GENERIC_IMPLICATION(whenflag, statement)
103#endif
104
105#ifndef DEFINE_NEG_VALUE_IMPLICATION
106#define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value)
107#endif
108
109#define COMMA ,
110
111#ifdef FLAG_MODE_DECLARE
112
113struct MaybeBoolFlag {
114 static MaybeBoolFlag Create(bool has_value, bool value) {
115 MaybeBoolFlag flag;
116 flag.has_value = has_value;
117 flag.value = value;
118 return flag;
119 }
120 bool has_value;
121 bool value;
122
123 bool operator!=(const MaybeBoolFlag& other) const {
124 return has_value != other.has_value || value != other.value;
125 }
126};
127#endif
128
129#ifdef DEBUG
130#define DEBUG_BOOL true
131#else
132#define DEBUG_BOOL false
133#endif
134
135#ifdef V8_COMPRESS_POINTERS
136#define COMPRESS_POINTERS_BOOL true
137#else
138#define COMPRESS_POINTERS_BOOL false
139#endif
140
141// Supported ARM configurations are:
142// "armv6": ARMv6 + VFPv2
143// "armv7": ARMv7 + VFPv3-D32 + NEON
144// "armv7+sudiv": ARMv7 + VFPv4-D32 + NEON + SUDIV
145// "armv8": ARMv8 (including all of the above)
146#if !defined(ARM_TEST_NO_FEATURE_PROBE) || \
147 (defined(CAN_USE_ARMV8_INSTRUCTIONS) && \
148 defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(CAN_USE_SUDIV) && \
149 defined(CAN_USE_NEON) && defined(CAN_USE_VFP3_INSTRUCTIONS))
150#define ARM_ARCH_DEFAULT "armv8"
151#elif defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(CAN_USE_SUDIV) && \
152 defined(CAN_USE_NEON) && defined(CAN_USE_VFP3_INSTRUCTIONS)
153#define ARM_ARCH_DEFAULT "armv7+sudiv"
154#elif defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(CAN_USE_NEON) && \
155 defined(CAN_USE_VFP3_INSTRUCTIONS)
156#define ARM_ARCH_DEFAULT "armv7"
157#else
158#define ARM_ARCH_DEFAULT "armv6"
159#endif
160
161#ifdef V8_OS_WIN
162# define ENABLE_LOG_COLOUR false
163#else
164# define ENABLE_LOG_COLOUR true
165#endif
166
167#define DEFINE_BOOL(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
168#define DEFINE_BOOL_READONLY(nam, def, cmt) \
169 FLAG_READONLY(BOOL, bool, nam, def, cmt)
170#define DEFINE_MAYBE_BOOL(nam, cmt) \
171 FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, {false COMMA false}, cmt)
172#define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
173#define DEFINE_UINT(nam, def, cmt) FLAG(UINT, unsigned int, nam, def, cmt)
174#define DEFINE_UINT64(nam, def, cmt) FLAG(UINT64, uint64_t, nam, def, cmt)
175#define DEFINE_FLOAT(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
176#define DEFINE_SIZE_T(nam, def, cmt) FLAG(SIZE_T, size_t, nam, def, cmt)
177#define DEFINE_STRING(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
178#define DEFINE_ALIAS_BOOL(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam)
179#define DEFINE_ALIAS_INT(alias, nam) FLAG_ALIAS(INT, int, alias, nam)
180#define DEFINE_ALIAS_FLOAT(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam)
181#define DEFINE_ALIAS_SIZE_T(alias, nam) FLAG_ALIAS(SIZE_T, size_t, alias, nam)
182#define DEFINE_ALIAS_STRING(alias, nam) \
183 FLAG_ALIAS(STRING, const char*, alias, nam)
184
185#ifdef DEBUG
186#define DEFINE_DEBUG_BOOL DEFINE_BOOL
187#else
188#define DEFINE_DEBUG_BOOL DEFINE_BOOL_READONLY
189#endif
190
191//
192// Flags in all modes.
193//
194#define FLAG FLAG_FULL
195
196// Flags for language modes and experimental language features.
197DEFINE_BOOL(use_strict, false, "enforce strict mode")
198
199DEFINE_BOOL(es_staging, false,
200 "enable test-worthy harmony features (for internal use only)")
201DEFINE_BOOL(harmony, false, "enable all completed harmony features")
202DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
203DEFINE_IMPLICATION(es_staging, harmony)
204// Enabling import.meta requires to also enable import()
205DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
206
207DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
208DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields)
209DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields)
210
211DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
212
213// Update bootstrapper.cc whenever adding a new feature flag.
214
215// Features that are still work in progress (behind individual flags).
216#define HARMONY_INPROGRESS_BASE(V) \
217 V(harmony_class_fields, "harmony fields in class literals") \
218 V(harmony_private_methods, "harmony private methods in class literals") \
219 V(harmony_regexp_sequence, "RegExp Unicode sequence properties") \
220 V(harmony_weak_refs, "harmony weak references")
221
222#ifdef V8_INTL_SUPPORT
223#define HARMONY_INPROGRESS(V) \
224 HARMONY_INPROGRESS_BASE(V) \
225 V(harmony_intl_date_format_range, "DateTimeFormat formatRange")
226#else
227#define HARMONY_INPROGRESS(V) HARMONY_INPROGRESS_BASE(V)
228#endif
229
230// Features that are complete (but still behind --harmony/es-staging flag).
231#define HARMONY_STAGED_BASE(V) \
232 V(harmony_promise_all_settled, "harmony Promise.allSettled")
233
234#ifdef V8_INTL_SUPPORT
235#define HARMONY_STAGED(V) \
236 HARMONY_STAGED_BASE(V) \
237 V(harmony_intl_bigint, "BigInt.prototype.toLocaleString") \
238 V(harmony_intl_datetime_style, "dateStyle timeStyle for DateTimeFormat") \
239 V(harmony_intl_segmenter, "Intl.Segmenter")
240#else
241#define HARMONY_STAGED(V) HARMONY_STAGED_BASE(V)
242#endif
243
244// Features that are shipping (turned on by default, but internal flag remains).
245#define HARMONY_SHIPPING_BASE(V) \
246 V(harmony_namespace_exports, \
247 "harmony namespace exports (export * as foo from 'bar')") \
248 V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
249 V(harmony_import_meta, "harmony import.meta property") \
250 V(harmony_dynamic_import, "harmony dynamic import") \
251 V(harmony_global, "harmony global") \
252 V(harmony_json_stringify, "well-formed JSON.stringify") \
253 V(harmony_public_fields, "harmony public instance fields in class literals") \
254 V(harmony_static_fields, "harmony static fields in class literals") \
255 V(harmony_string_matchall, "harmony String.prototype.matchAll") \
256 V(harmony_object_from_entries, "harmony Object.fromEntries()") \
257 V(harmony_await_optimization, "harmony await taking 1 tick") \
258 V(harmony_private_fields, "harmony private fields in class literals") \
259 V(harmony_hashbang, "harmony hashbang syntax") \
260 V(harmony_numeric_separator, "harmony numeric separator between digits")
261
262#ifdef V8_INTL_SUPPORT
263#define HARMONY_SHIPPING(V) \
264 HARMONY_SHIPPING_BASE(V) \
265 V(harmony_locale, "Intl.Locale")
266#else
267#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
268#endif
269
270// Once a shipping feature has proved stable in the wild, it will be dropped
271// from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed,
272// and associated tests are moved from the harmony directory to the appropriate
273// esN directory.
274
275
276#define FLAG_INPROGRESS_FEATURES(id, description) \
277 DEFINE_BOOL(id, false, "enable " #description " (in progress)")
278HARMONY_INPROGRESS(FLAG_INPROGRESS_FEATURES)
279#undef FLAG_INPROGRESS_FEATURES
280
281#define FLAG_STAGED_FEATURES(id, description) \
282 DEFINE_BOOL(id, false, "enable " #description) \
283 DEFINE_IMPLICATION(harmony, id)
284HARMONY_STAGED(FLAG_STAGED_FEATURES)
285#undef FLAG_STAGED_FEATURES
286
287#define FLAG_SHIPPING_FEATURES(id, description) \
288 DEFINE_BOOL(id, true, "enable " #description) \
289 DEFINE_NEG_NEG_IMPLICATION(harmony_shipping, id)
290HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
291#undef FLAG_SHIPPING_FEATURES
292
293#ifdef V8_INTL_SUPPORT
294DEFINE_BOOL(icu_timezone_data, true, "get information about timezones from ICU")
295#endif
296
297#ifdef V8_ENABLE_RAW_HEAP_SNAPSHOTS
298#define V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL true
299#else
300#define V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL false
301#endif // V8_ENABLE_RAW_HEAP_SNAPSHOTS
302
303#ifdef V8_LITE_MODE
304#define V8_LITE_BOOL true
305#else
306#define V8_LITE_BOOL false
307#endif
308
309#ifdef V8_ENABLE_FUTURE
310#define FUTURE_BOOL true
311#else
312#define FUTURE_BOOL false
313#endif
314DEFINE_BOOL(future, FUTURE_BOOL,
315 "Implies all staged features that we want to ship in the "
316 "not-too-far future")
317
318DEFINE_IMPLICATION(future, write_protect_code_memory)
319
320// Flags for experimental implementation features.
321DEFINE_BOOL(allocation_site_pretenuring, true,
322 "pretenure with allocation sites")
323DEFINE_BOOL(page_promotion, true, "promote pages based on utilization")
324DEFINE_INT(page_promotion_threshold, 70,
325 "min percentage of live bytes on a page to enable fast evacuation")
326DEFINE_BOOL(trace_pretenuring, false,
327 "trace pretenuring decisions of HAllocate instructions")
328DEFINE_BOOL(trace_pretenuring_statistics, false,
329 "trace allocation site pretenuring statistics")
330DEFINE_BOOL(track_fields, true, "track fields with only smi values")
331DEFINE_BOOL(track_double_fields, true, "track fields with double values")
332DEFINE_BOOL(track_heap_object_fields, true, "track fields with heap values")
333DEFINE_BOOL(track_computed_fields, true, "track computed boilerplate fields")
334DEFINE_IMPLICATION(track_double_fields, track_fields)
335DEFINE_IMPLICATION(track_heap_object_fields, track_fields)
336DEFINE_IMPLICATION(track_computed_fields, track_fields)
337DEFINE_BOOL(track_field_types, true, "track field types")
338DEFINE_IMPLICATION(track_field_types, track_fields)
339DEFINE_IMPLICATION(track_field_types, track_heap_object_fields)
340DEFINE_BOOL(trace_block_coverage, false,
341 "trace collected block coverage information")
342DEFINE_BOOL(feedback_normalization, false,
343 "feed back normalization to constructors")
344// TODO(jkummerow): This currently adds too much load on the stub cache.
345DEFINE_BOOL_READONLY(internalize_on_the_fly, true,
346 "internalize string keys for generic keyed ICs on the fly")
347
348// Flag to faster calls with arguments mismatches (https://crbug.com/v8/8895)
349DEFINE_BOOL(fast_calls_with_arguments_mismatches, true,
350 "skip arguments adaptor frames when it's provably safe")
351
352// Flag for one shot optimiztions.
353DEFINE_BOOL(enable_one_shot_optimization, true,
354 "Enable size optimizations for the code that will "
355 "only be executed once")
356
357
358// Flags for data representation optimizations
359DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles")
360DEFINE_BOOL_READONLY(string_slices, true, "use string slices")
361
362DEFINE_INT(interrupt_budget, 144 * KB,
363 "interrupt budget which should be used for the profiler counter")
364
365DEFINE_INT(budget_for_feedback_vector_allocation, 1 * KB,
366 "The budget in amount of bytecode executed by a function before we "
367 "decide to allocate feedback vectors")
368DEFINE_BOOL(lazy_feedback_allocation, false, "Allocate feedback vectors lazily")
369
370// Flags for Ignition.
371DEFINE_BOOL(ignition_elide_noneffectful_bytecodes, true,
372 "elide bytecodes which won't have any external effect")
373DEFINE_BOOL(ignition_reo, true, "use ignition register equivalence optimizer")
374DEFINE_BOOL(ignition_filter_expression_positions, true,
375 "filter expression positions before the bytecode pipeline")
376DEFINE_BOOL(ignition_share_named_property_feedback, true,
377 "share feedback slots when loading the same named property from "
378 "the same object")
379DEFINE_BOOL(print_bytecode, false,
380 "print bytecode generated by ignition interpreter")
381DEFINE_BOOL(enable_lazy_source_positions, V8_LITE_BOOL,
382 "skip generating source positions during initial compile but "
383 "regenerate when actually required")
384DEFINE_STRING(print_bytecode_filter, "*",
385 "filter for selecting which functions to print bytecode")
386#ifdef V8_TRACE_IGNITION
387DEFINE_BOOL(trace_ignition, false,
388 "trace the bytecodes executed by the ignition interpreter")
389#endif
390#ifdef V8_TRACE_FEEDBACK_UPDATES
391DEFINE_BOOL(
392 trace_feedback_updates, false,
393 "trace updates to feedback vectors during ignition interpreter execution.")
394#endif
395DEFINE_BOOL(trace_ignition_codegen, false,
396 "trace the codegen of ignition interpreter bytecode handlers")
397DEFINE_BOOL(trace_ignition_dispatches, false,
398 "traces the dispatches to bytecode handlers by the ignition "
399 "interpreter")
400DEFINE_STRING(trace_ignition_dispatches_output_file, nullptr,
401 "the file to which the bytecode handler dispatch table is "
402 "written (by default, the table is not written to a file)")
403
404DEFINE_BOOL(fast_math, true, "faster (but maybe less accurate) math functions")
405DEFINE_BOOL(trace_track_allocation_sites, false,
406 "trace the tracking of allocation sites")
407DEFINE_BOOL(trace_migration, false, "trace object migration")
408DEFINE_BOOL(trace_generalization, false, "trace map generalization")
409
410// Flags for concurrent recompilation.
411DEFINE_BOOL(concurrent_recompilation, true,
412 "optimizing hot functions asynchronously on a separate thread")
413DEFINE_BOOL(trace_concurrent_recompilation, false,
414 "track concurrent recompilation")
415DEFINE_INT(concurrent_recompilation_queue_length, 8,
416 "the length of the concurrent compilation queue")
417DEFINE_INT(concurrent_recompilation_delay, 0,
418 "artificial compilation delay in ms")
419DEFINE_BOOL(block_concurrent_recompilation, false,
420 "block queued jobs until released")
421DEFINE_BOOL(concurrent_inlining, false,
422 "run optimizing compiler's inlining phase on a separate thread")
423DEFINE_IMPLICATION(future, concurrent_inlining)
424DEFINE_BOOL(trace_heap_broker_verbose, false,
425 "trace the heap broker verbosely (all reports)")
426DEFINE_BOOL(trace_heap_broker, false,
427 "trace the heap broker (reports on missing data only)")
428DEFINE_IMPLICATION(trace_heap_broker_verbose, trace_heap_broker)
429
430// Flags for stress-testing the compiler.
431DEFINE_INT(stress_runs, 0, "number of stress runs")
432DEFINE_INT(deopt_every_n_times, 0,
433 "deoptimize every n times a deopt point is passed")
434DEFINE_BOOL(print_deopt_stress, false, "print number of possible deopt points")
435
436// Flags for TurboFan.
437DEFINE_BOOL(turbo_sp_frame_access, false,
438 "use stack pointer-relative access to frame wherever possible")
439DEFINE_BOOL(turbo_preprocess_ranges, true,
440 "run pre-register allocation heuristics")
441DEFINE_BOOL(turbo_control_flow_aware_allocation, false,
442 "consider control flow while allocating registers")
443DEFINE_NEG_IMPLICATION(turbo_control_flow_aware_allocation,
444 turbo_preprocess_ranges)
445
446DEFINE_STRING(turbo_filter, "*", "optimization filter for TurboFan compiler")
447DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
448DEFINE_STRING(trace_turbo_path, nullptr,
449 "directory to dump generated TurboFan IR to")
450DEFINE_STRING(trace_turbo_filter, "*",
451 "filter for tracing turbofan compilation")
452DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs")
453DEFINE_BOOL(trace_turbo_scheduled, false, "trace TurboFan IR with schedule")
454DEFINE_IMPLICATION(trace_turbo_scheduled, trace_turbo_graph)
455DEFINE_STRING(trace_turbo_cfg_file, nullptr,
456 "trace turbo cfg graph (for C1 visualizer) to a given file name")
457DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types")
458DEFINE_BOOL(trace_turbo_scheduler, false, "trace TurboFan's scheduler")
459DEFINE_BOOL(trace_turbo_reduction, false, "trace TurboFan's various reducers")
460DEFINE_BOOL(trace_turbo_trimming, false, "trace TurboFan's graph trimmer")
461DEFINE_BOOL(trace_turbo_jt, false, "trace TurboFan's jump threading")
462DEFINE_BOOL(trace_turbo_ceq, false, "trace TurboFan's control equivalence")
463DEFINE_BOOL(trace_turbo_loop, false, "trace TurboFan's loop optimizations")
464DEFINE_BOOL(trace_alloc, false, "trace register allocator")
465DEFINE_BOOL(trace_all_uses, false, "trace all use positions")
466DEFINE_BOOL(trace_representation, false, "trace representation types")
467DEFINE_BOOL(turbo_verify, DEBUG_BOOL, "verify TurboFan graphs at each phase")
468DEFINE_STRING(turbo_verify_machine_graph, nullptr,
469 "verify TurboFan machine graph before instruction selection")
470#ifdef ENABLE_VERIFY_CSA
471DEFINE_BOOL(verify_csa, DEBUG_BOOL,
472 "verify TurboFan machine graph of code stubs")
473#else
474// Define the flag as read-only-false so that code still compiles even in the
475// non-ENABLE_VERIFY_CSA configuration.
476DEFINE_BOOL_READONLY(verify_csa, false,
477 "verify TurboFan machine graph of code stubs")
478#endif
479DEFINE_BOOL(trace_verify_csa, false, "trace code stubs verification")
480DEFINE_STRING(csa_trap_on_node, nullptr,
481 "trigger break point when a node with given id is created in "
482 "given stub. The format is: StubName,NodeId")
483DEFINE_BOOL_READONLY(fixed_array_bounds_checks, true,
484 "enable FixedArray bounds checks")
485DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics")
486DEFINE_BOOL(turbo_stats_nvp, false,
487 "print TurboFan statistics in machine-readable format")
488DEFINE_BOOL(turbo_stats_wasm, false,
489 "print TurboFan statistics of wasm compilations")
490DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan")
491DEFINE_BOOL(function_context_specialization, false,
492 "enable function context specialization in TurboFan")
493DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan")
494DEFINE_INT(max_inlined_bytecode_size, 500,
495 "maximum size of bytecode for a single inlining")
496DEFINE_INT(max_inlined_bytecode_size_cumulative, 1000,
497 "maximum cumulative size of bytecode considered for inlining")
498DEFINE_INT(max_inlined_bytecode_size_absolute, 5000,
499 "maximum cumulative size of bytecode considered for inlining")
500DEFINE_FLOAT(reserve_inline_budget_scale_factor, 1.2,
501 "maximum cumulative size of bytecode considered for inlining")
502DEFINE_INT(max_inlined_bytecode_size_small, 30,
503 "maximum size of bytecode considered for small function inlining")
504DEFINE_INT(max_optimized_bytecode_size, 60 * KB,
505 "maximum bytecode size to "
506 "be considered for optimization; too high values may cause "
507 "the compiler to hit (release) assertions")
508DEFINE_FLOAT(min_inlining_frequency, 0.15, "minimum frequency for inlining")
509DEFINE_BOOL(polymorphic_inlining, true, "polymorphic inlining")
510DEFINE_BOOL(stress_inline, false,
511 "set high thresholds for inlining to inline as much as possible")
512DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size, 999999)
513DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size_cumulative,
514 999999)
515DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size_absolute,
516 999999)
517DEFINE_VALUE_IMPLICATION(stress_inline, min_inlining_frequency, 0)
518DEFINE_VALUE_IMPLICATION(stress_inline, polymorphic_inlining, true)
519DEFINE_BOOL(trace_turbo_inlining, false, "trace TurboFan inlining")
520DEFINE_BOOL(inline_accessors, true, "inline JavaScript accessors")
521DEFINE_BOOL(inline_into_try, true, "inline into try blocks")
522DEFINE_BOOL(turbo_inline_array_builtins, true,
523 "inline array builtins in TurboFan code")
524DEFINE_BOOL(use_osr, true, "use on-stack replacement")
525DEFINE_BOOL(trace_osr, false, "trace on-stack replacement")
526DEFINE_BOOL(analyze_environment_liveness, true,
527 "analyze liveness of environment slots and zap dead values")
528DEFINE_BOOL(trace_environment_liveness, false,
529 "trace liveness of local variable slots")
530DEFINE_BOOL(turbo_load_elimination, true, "enable load elimination in TurboFan")
531DEFINE_BOOL(trace_turbo_load_elimination, false,
532 "trace TurboFan load elimination")
533DEFINE_BOOL(turbo_profiling, false, "enable profiling in TurboFan")
534DEFINE_BOOL(turbo_verify_allocation, DEBUG_BOOL,
535 "verify register allocation in TurboFan")
536DEFINE_BOOL(turbo_move_optimization, true, "optimize gap moves in TurboFan")
537DEFINE_BOOL(turbo_jt, true, "enable jump threading in TurboFan")
538DEFINE_BOOL(turbo_loop_peeling, true, "Turbofan loop peeling")
539DEFINE_BOOL(turbo_loop_variable, true, "Turbofan loop variable optimization")
540DEFINE_BOOL(turbo_loop_rotation, true, "Turbofan loop rotation")
541DEFINE_BOOL(turbo_cf_optimization, true, "optimize control flow in TurboFan")
542DEFINE_BOOL(turbo_escape, true, "enable escape analysis")
543DEFINE_BOOL(turbo_allocation_folding, true, "Turbofan allocation folding")
544DEFINE_BOOL(turbo_instruction_scheduling, false,
545 "enable instruction scheduling in TurboFan")
546DEFINE_BOOL(turbo_stress_instruction_scheduling, false,
547 "randomly schedule instructions to stress dependency tracking")
548DEFINE_BOOL(turbo_store_elimination, true,
549 "enable store-store elimination in TurboFan")
550DEFINE_BOOL(trace_store_elimination, false, "trace store elimination")
551DEFINE_BOOL(turbo_rewrite_far_jumps, true,
552 "rewrite far to near jumps (ia32,x64)")
553DEFINE_BOOL(experimental_inline_promise_constructor, true,
554 "inline the Promise constructor in TurboFan")
555DEFINE_BOOL(
556 stress_gc_during_compilation, false,
557 "simulate GC/compiler thread race related to https://crbug.com/v8/8520")
558
559#ifdef DISABLE_UNTRUSTED_CODE_MITIGATIONS
560#define V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS false
561#else
562#define V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS true
563#endif
564DEFINE_BOOL(untrusted_code_mitigations, V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS,
565 "Enable mitigations for executing untrusted code")
566#undef V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS
567
568// Flags for native WebAssembly.
569DEFINE_BOOL(expose_wasm, true, "expose wasm interface to JavaScript")
570DEFINE_BOOL(assume_asmjs_origin, false,
571 "force wasm decoder to assume input is internal asm-wasm format")
572DEFINE_BOOL(wasm_disable_structured_cloning, false,
573 "disable wasm structured cloning")
574DEFINE_INT(wasm_num_compilation_tasks, 10,
575 "number of parallel compilation tasks for wasm")
576DEFINE_DEBUG_BOOL(trace_wasm_native_heap, false,
577 "trace wasm native heap events")
578DEFINE_BOOL(wasm_write_protect_code_memory, false,
579 "write protect code memory on the wasm native heap")
580DEFINE_BOOL(trace_wasm_serialization, false,
581 "trace serialization/deserialization")
582DEFINE_BOOL(wasm_async_compilation, true,
583 "enable actual asynchronous compilation for WebAssembly.compile")
584DEFINE_BOOL(wasm_test_streaming, false,
585 "use streaming compilation instead of async compilation for tests")
586DEFINE_UINT(wasm_max_mem_pages, v8::internal::wasm::kV8MaxWasmMemoryPages,
587 "maximum number of 64KiB memory pages of a wasm instance")
588DEFINE_UINT(wasm_max_table_size, v8::internal::wasm::kV8MaxWasmTableSize,
589 "maximum table size of a wasm instance")
590DEFINE_UINT(wasm_max_code_space, v8::internal::kMaxWasmCodeMB,
591 "maximum committed code space for wasm (in MB)")
592// Enable Liftoff by default on ia32 and x64. More architectures will follow
593// once they are implemented and sufficiently tested.
594#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
595DEFINE_BOOL(
596 wasm_tier_up, true,
597 "enable wasm baseline compilation and tier up to the optimizing compiler")
598#else
599DEFINE_BOOL(
600 wasm_tier_up, false,
601 "enable wasm baseline compilation and tier up to the optimizing compiler")
602DEFINE_IMPLICATION(future, wasm_tier_up)
603#endif
604DEFINE_IMPLICATION(wasm_tier_up, liftoff)
605DEFINE_DEBUG_BOOL(trace_wasm_decoder, false, "trace decoding of wasm code")
606DEFINE_DEBUG_BOOL(trace_wasm_decode_time, false,
607 "trace decoding time of wasm code")
608DEFINE_DEBUG_BOOL(trace_wasm_compiler, false, "trace compiling of wasm code")
609DEFINE_DEBUG_BOOL(trace_wasm_interpreter, false,
610 "trace interpretation of wasm code")
611DEFINE_DEBUG_BOOL(trace_wasm_streaming, false,
612 "trace streaming compilation of wasm code")
613DEFINE_INT(trace_wasm_ast_start, 0,
614 "start function for wasm AST trace (inclusive)")
615DEFINE_INT(trace_wasm_ast_end, 0, "end function for wasm AST trace (exclusive)")
616DEFINE_BOOL(liftoff, false,
617 "enable Liftoff, the baseline compiler for WebAssembly")
618DEFINE_DEBUG_BOOL(trace_liftoff, false,
619 "trace Liftoff, the baseline compiler for WebAssembly")
620DEFINE_DEBUG_BOOL(wasm_break_on_decoder_error, false,
621 "debug break when wasm decoder encounters an error")
622DEFINE_BOOL(trace_wasm_memory, false,
623 "print all memory updates performed in wasm code")
624// Fuzzers use {wasm_tier_mask_for_testing} together with {liftoff} and
625// {no_wasm_tier_up} to force some functions to be compiled with Turbofan.
626DEFINE_INT(wasm_tier_mask_for_testing, 0,
627 "bitmask of functions to compile with TurboFan instead of Liftoff")
628
629DEFINE_BOOL(validate_asm, true, "validate asm.js modules before compiling")
630DEFINE_BOOL(suppress_asm_messages, false,
631 "don't emit asm.js related messages (for golden file testing)")
632DEFINE_BOOL(trace_asm_time, false, "log asm.js timing info to the console")
633DEFINE_BOOL(trace_asm_scanner, false,
634 "log tokens encountered by asm.js scanner")
635DEFINE_BOOL(trace_asm_parser, false, "verbose logging of asm.js parse failures")
636DEFINE_BOOL(stress_validate_asm, false, "try to validate everything as asm.js")
637
638DEFINE_DEBUG_BOOL(dump_wasm_module, false, "dump wasm module bytes")
639DEFINE_STRING(dump_wasm_module_path, nullptr,
640 "directory to dump wasm modules to")
641
642// Declare command-line flags for WASM features. Warning: avoid using these
643// flags directly in the implementation. Instead accept wasm::WasmFeatures
644// for configurability.
645#include "src/wasm/wasm-feature-flags.h"
646
647#define SPACE
648#define DECL_WASM_FLAG(feat, desc, val) \
649 DEFINE_BOOL(experimental_wasm_##feat, val, \
650 "enable prototype " desc " for wasm")
651FOREACH_WASM_FEATURE_FLAG(DECL_WASM_FLAG, SPACE)
652#undef DECL_WASM_FLAG
653#undef SPACE
654
655DEFINE_BOOL(wasm_opt, false, "enable wasm optimization")
656DEFINE_BOOL(wasm_no_bounds_checks, false,
657 "disable bounds checks (performance testing only)")
658DEFINE_BOOL(wasm_no_stack_checks, false,
659 "disable stack checks (performance testing only)")
660DEFINE_BOOL(wasm_math_intrinsics, true,
661 "intrinsify some Math imports into wasm")
662
663DEFINE_BOOL(wasm_shared_engine, true,
664 "shares one wasm engine between all isolates within a process")
665DEFINE_IMPLICATION(future, wasm_shared_engine)
666DEFINE_BOOL(wasm_shared_code, true,
667 "shares code underlying a wasm module when it is transferred")
668DEFINE_IMPLICATION(future, wasm_shared_code)
669DEFINE_BOOL(wasm_trap_handler, true,
670 "use signal handlers to catch out of bounds memory access in wasm"
671 " (currently Linux x86_64 only)")
672DEFINE_BOOL(wasm_trap_handler_fallback, false,
673 "Use bounds checks if guarded memory is not available")
674DEFINE_BOOL(wasm_fuzzer_gen_test, false,
675 "Generate a test case when running a wasm fuzzer")
676DEFINE_IMPLICATION(wasm_fuzzer_gen_test, single_threaded)
677DEFINE_BOOL(print_wasm_code, false, "Print WebAssembly code")
678DEFINE_BOOL(print_wasm_stub_code, false, "Print WebAssembly stub code")
679DEFINE_BOOL(wasm_interpret_all, false,
680 "Execute all wasm code in the wasm interpreter")
681DEFINE_BOOL(asm_wasm_lazy_compilation, false,
682 "enable lazy compilation for asm-wasm modules")
683DEFINE_IMPLICATION(validate_asm, asm_wasm_lazy_compilation)
684DEFINE_BOOL(wasm_lazy_compilation, false,
685 "enable lazy compilation for all wasm modules")
686DEFINE_DEBUG_BOOL(trace_wasm_lazy_compilation, false,
687 "trace lazy compilation of wasm functions")
688// wasm-interpret-all resets {asm-,}wasm-lazy-compilation.
689DEFINE_NEG_IMPLICATION(wasm_interpret_all, asm_wasm_lazy_compilation)
690DEFINE_NEG_IMPLICATION(wasm_interpret_all, wasm_lazy_compilation)
691DEFINE_NEG_IMPLICATION(wasm_interpret_all, wasm_tier_up)
692DEFINE_BOOL(wasm_code_gc, false, "enable garbage collection of wasm code")
693DEFINE_IMPLICATION(future, wasm_code_gc)
694
695// Profiler flags.
696DEFINE_INT(frame_count, 1, "number of stack frames inspected by the profiler")
697
698DEFINE_INT(stress_sampling_allocation_profiler, 0,
699 "Enables sampling allocation profiler with X as a sample interval")
700
701// Garbage collections flags.
702DEFINE_SIZE_T(min_semi_space_size, 0,
703 "min size of a semi-space (in MBytes), the new space consists of "
704 "two semi-spaces")
705DEFINE_SIZE_T(max_semi_space_size, 0,
706 "max size of a semi-space (in MBytes), the new space consists of "
707 "two semi-spaces")
708DEFINE_INT(semi_space_growth_factor, 2, "factor by which to grow the new space")
709DEFINE_BOOL(experimental_new_space_growth_heuristic, false,
710 "Grow the new space based on the percentage of survivors instead "
711 "of their absolute value.")
712DEFINE_SIZE_T(max_old_space_size, 0, "max size of the old space (in Mbytes)")
713DEFINE_SIZE_T(initial_old_space_size, 0, "initial old space size (in Mbytes)")
714DEFINE_BOOL(gc_global, false, "always perform global GCs")
715DEFINE_INT(random_gc_interval, 0,
716 "Collect garbage after random(0, X) allocations. It overrides "
717 "gc_interval.")
718DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
719DEFINE_INT(retain_maps_for_n_gc, 2,
720 "keeps maps alive for <n> old space garbage collections")
721DEFINE_BOOL(trace_gc, false,
722 "print one trace line following each garbage collection")
723DEFINE_BOOL(trace_gc_nvp, false,
724 "print one detailed trace line in name=value format "
725 "after each garbage collection")
726DEFINE_BOOL(trace_gc_ignore_scavenger, false,
727 "do not print trace line after scavenger collection")
728DEFINE_BOOL(trace_idle_notification, false,
729 "print one trace line following each idle notification")
730DEFINE_BOOL(trace_idle_notification_verbose, false,
731 "prints the heap state used by the idle notification")
732DEFINE_BOOL(trace_gc_verbose, false,
733 "print more details following each garbage collection")
734DEFINE_IMPLICATION(trace_gc_verbose, trace_gc)
735
736DEFINE_INT(trace_allocation_stack_interval, -1,
737 "print stack trace after <n> free-list allocations")
738DEFINE_INT(trace_duplicate_threshold_kb, 0,
739 "print duplicate objects in the heap if their size is more than "
740 "given threshold")
741DEFINE_BOOL(trace_fragmentation, false, "report fragmentation for old space")
742DEFINE_BOOL(trace_fragmentation_verbose, false,
743 "report fragmentation for old space (detailed)")
744DEFINE_BOOL(trace_evacuation, false, "report evacuation statistics")
745DEFINE_BOOL(trace_mutator_utilization, false,
746 "print mutator utilization, allocation speed, gc speed")
747DEFINE_BOOL(incremental_marking, true, "use incremental marking")
748DEFINE_BOOL(incremental_marking_wrappers, true,
749 "use incremental marking for marking wrappers")
750DEFINE_BOOL(trace_unmapper, false, "Trace the unmapping")
751DEFINE_BOOL(parallel_scavenge, true, "parallel scavenge")
752DEFINE_BOOL(trace_parallel_scavenge, false, "trace parallel scavenge")
753DEFINE_BOOL(write_protect_code_memory, true, "write protect code memory")
754#ifdef V8_CONCURRENT_MARKING
755#define V8_CONCURRENT_MARKING_BOOL true
756#else
757#define V8_CONCURRENT_MARKING_BOOL false
758#endif
759DEFINE_BOOL(concurrent_marking, V8_CONCURRENT_MARKING_BOOL,
760 "use concurrent marking")
761DEFINE_BOOL(parallel_marking, true, "use parallel marking in atomic pause")
762DEFINE_INT(ephemeron_fixpoint_iterations, 10,
763 "number of fixpoint iterations it takes to switch to linear "
764 "ephemeron algorithm")
765DEFINE_BOOL(trace_concurrent_marking, false, "trace concurrent marking")
766DEFINE_BOOL(concurrent_store_buffer, true,
767 "use concurrent store buffer processing")
768DEFINE_BOOL(concurrent_sweeping, true, "use concurrent sweeping")
769DEFINE_BOOL(parallel_compaction, true, "use parallel compaction")
770DEFINE_BOOL(parallel_pointer_update, true,
771 "use parallel pointer update during compaction")
772DEFINE_BOOL(detect_ineffective_gcs_near_heap_limit, true,
773 "trigger out-of-memory failure to avoid GC storm near heap limit")
774DEFINE_BOOL(trace_incremental_marking, false,
775 "trace progress of the incremental marking")
776DEFINE_BOOL(trace_stress_marking, false, "trace stress marking progress")
777DEFINE_BOOL(trace_stress_scavenge, false, "trace stress scavenge progress")
778DEFINE_BOOL(track_gc_object_stats, false,
779 "track object counts and memory usage")
780DEFINE_BOOL(trace_gc_object_stats, false,
781 "trace object counts and memory usage")
782DEFINE_BOOL(trace_zone_stats, false, "trace zone memory usage")
783DEFINE_BOOL(track_retaining_path, false,
784 "enable support for tracking retaining path")
785DEFINE_BOOL(concurrent_array_buffer_freeing, true,
786 "free array buffer allocations on a background thread")
787DEFINE_INT(gc_stats, 0, "Used by tracing internally to enable gc statistics")
788DEFINE_IMPLICATION(trace_gc_object_stats, track_gc_object_stats)
789DEFINE_GENERIC_IMPLICATION(
790 track_gc_object_stats,
791 TracingFlags::gc_stats.store(
792 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE))
793DEFINE_GENERIC_IMPLICATION(
794 trace_gc_object_stats,
795 TracingFlags::gc_stats.store(
796 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE))
797DEFINE_NEG_IMPLICATION(trace_gc_object_stats, incremental_marking)
798DEFINE_NEG_IMPLICATION(track_retaining_path, incremental_marking)
799DEFINE_NEG_IMPLICATION(track_retaining_path, parallel_marking)
800DEFINE_NEG_IMPLICATION(track_retaining_path, concurrent_marking)
801DEFINE_BOOL(track_detached_contexts, true,
802 "track native contexts that are expected to be garbage collected")
803DEFINE_BOOL(trace_detached_contexts, false,
804 "trace native contexts that are expected to be garbage collected")
805DEFINE_IMPLICATION(trace_detached_contexts, track_detached_contexts)
806#ifdef VERIFY_HEAP
807DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC")
808DEFINE_BOOL(verify_heap_skip_remembered_set, false,
809 "disable remembered set verification")
810#endif
811DEFINE_BOOL(move_object_start, true, "enable moving of object starts")
812DEFINE_BOOL(memory_reducer, true, "use memory reducer")
813DEFINE_BOOL(memory_reducer_for_small_heaps, true,
814 "use memory reducer for small heaps")
815DEFINE_INT(heap_growing_percent, 0,
816 "specifies heap growing factor as (1 + heap_growing_percent/100)")
817DEFINE_INT(v8_os_page_size, 0, "override OS page size (in KBytes)")
818DEFINE_BOOL(always_compact, false, "Perform compaction on every full GC")
819DEFINE_BOOL(never_compact, false,
820 "Never perform compaction on full GC - testing only")
821DEFINE_BOOL(compact_code_space, true, "Compact code space on full collections")
822DEFINE_BOOL(flush_bytecode, true,
823 "flush of bytecode when it has not been executed recently")
824DEFINE_BOOL(stress_flush_bytecode, false, "stress bytecode flushing")
825DEFINE_IMPLICATION(stress_flush_bytecode, flush_bytecode)
826DEFINE_BOOL(use_marking_progress_bar, true,
827 "Use a progress bar to scan large objects in increments when "
828 "incremental marking is active.")
829DEFINE_BOOL(force_marking_deque_overflows, false,
830 "force overflows of marking deque by reducing it's size "
831 "to 64 words")
832DEFINE_BOOL(stress_compaction, false,
833 "stress the GC compactor to flush out bugs (implies "
834 "--force_marking_deque_overflows)")
835DEFINE_BOOL(stress_compaction_random, false,
836 "Stress GC compaction by selecting random percent of pages as "
837 "evacuation candidates. It overrides stress_compaction.")
838DEFINE_BOOL(stress_incremental_marking, false,
839 "force incremental marking for small heaps and run it more often")
840
841DEFINE_BOOL(fuzzer_gc_analysis, false,
842 "prints number of allocations and enables analysis mode for gc "
843 "fuzz testing, e.g. --stress-marking, --stress-scavenge")
844DEFINE_INT(stress_marking, 0,
845 "force marking at random points between 0 and X (inclusive) percent "
846 "of the regular marking start limit")
847DEFINE_INT(stress_scavenge, 0,
848 "force scavenge at random points between 0 and X (inclusive) "
849 "percent of the new space capacity")
850DEFINE_IMPLICATION(fuzzer_gc_analysis, stress_marking)
851DEFINE_IMPLICATION(fuzzer_gc_analysis, stress_scavenge)
852
853DEFINE_BOOL(disable_abortjs, false, "disables AbortJS runtime function")
854
855DEFINE_BOOL(manual_evacuation_candidates_selection, false,
856 "Test mode only flag. It allows an unit test to select evacuation "
857 "candidates pages (requires --stress_compaction).")
858DEFINE_BOOL(fast_promotion_new_space, false,
859 "fast promote new space on high survival rates")
860
861DEFINE_BOOL(clear_free_memory, false, "initialize free memory with 0")
862
863DEFINE_BOOL(young_generation_large_objects, true,
864 "allocates large objects by default in the young generation large "
865 "object space")
866
867DEFINE_BOOL(idle_time_scavenge, true, "Perform scavenges in idle time.")
868
869// assembler-ia32.cc / assembler-arm.cc / assembler-x64.cc
870DEFINE_BOOL(debug_code, DEBUG_BOOL,
871 "generate extra code (assertions) for debugging")
872DEFINE_BOOL(code_comments, false,
873 "emit comments in code disassembly; for more readable source "
874 "positions you should add --no-concurrent_recompilation")
875DEFINE_BOOL(enable_sse3, true, "enable use of SSE3 instructions if available")
876DEFINE_BOOL(enable_ssse3, true, "enable use of SSSE3 instructions if available")
877DEFINE_BOOL(enable_sse4_1, true,
878 "enable use of SSE4.1 instructions if available")
879DEFINE_BOOL(enable_sahf, true,
880 "enable use of SAHF instruction if available (X64 only)")
881DEFINE_BOOL(enable_avx, true, "enable use of AVX instructions if available")
882DEFINE_BOOL(enable_fma3, true, "enable use of FMA3 instructions if available")
883DEFINE_BOOL(enable_bmi1, true, "enable use of BMI1 instructions if available")
884DEFINE_BOOL(enable_bmi2, true, "enable use of BMI2 instructions if available")
885DEFINE_BOOL(enable_lzcnt, true, "enable use of LZCNT instruction if available")
886DEFINE_BOOL(enable_popcnt, true,
887 "enable use of POPCNT instruction if available")
888DEFINE_STRING(arm_arch, ARM_ARCH_DEFAULT,
889 "generate instructions for the selected ARM architecture if "
890 "available: armv6, armv7, armv7+sudiv or armv8")
891DEFINE_BOOL(force_long_branches, false,
892 "force all emitted branches to be in long mode (MIPS/PPC only)")
893DEFINE_STRING(mcpu, "auto", "enable optimization for specific cpu")
894DEFINE_BOOL(partial_constant_pool, true,
895 "enable use of partial constant pools (X64 only)")
896
897// Controlling source positions for Torque/CSA code.
898DEFINE_BOOL(enable_source_at_csa_bind, false,
899 "Include source information in the binary at CSA bind locations.")
900
901// Deprecated ARM flags (replaced by arm_arch).
902DEFINE_MAYBE_BOOL(enable_armv7, "deprecated (use --arm_arch instead)")
903DEFINE_MAYBE_BOOL(enable_vfp3, "deprecated (use --arm_arch instead)")
904DEFINE_MAYBE_BOOL(enable_32dregs, "deprecated (use --arm_arch instead)")
905DEFINE_MAYBE_BOOL(enable_neon, "deprecated (use --arm_arch instead)")
906DEFINE_MAYBE_BOOL(enable_sudiv, "deprecated (use --arm_arch instead)")
907DEFINE_MAYBE_BOOL(enable_armv8, "deprecated (use --arm_arch instead)")
908
909// regexp-macro-assembler-*.cc
910DEFINE_BOOL(enable_regexp_unaligned_accesses, true,
911 "enable unaligned accesses for the regexp engine")
912
913// api.cc
914DEFINE_BOOL(script_streaming, true, "enable parsing on background")
915DEFINE_BOOL(disable_old_api_accessors, false,
916 "Disable old-style API accessors whose setters trigger through the "
917 "prototype chain")
918
919// bootstrapper.cc
920DEFINE_BOOL(expose_free_buffer, false, "expose freeBuffer extension")
921DEFINE_BOOL(expose_gc, false, "expose gc extension")
922DEFINE_STRING(expose_gc_as, nullptr,
923 "expose gc extension under the specified name")
924DEFINE_IMPLICATION(expose_gc_as, expose_gc)
925DEFINE_BOOL(expose_externalize_string, false,
926 "expose externalize string extension")
927DEFINE_BOOL(expose_trigger_failure, false, "expose trigger-failure extension")
928DEFINE_INT(stack_trace_limit, 10, "number of stack frames to capture")
929DEFINE_BOOL(builtins_in_stack_traces, false,
930 "show built-in functions in stack traces")
931DEFINE_BOOL(disallow_code_generation_from_strings, false,
932 "disallow eval and friends")
933DEFINE_BOOL(expose_async_hooks, false, "expose async_hooks object")
934
935// builtins.cc
936DEFINE_BOOL(allow_unsafe_function_constructor, false,
937 "allow invoking the function constructor without security checks")
938DEFINE_BOOL(force_slow_path, false, "always take the slow path for builtins")
939DEFINE_BOOL(test_small_max_function_context_stub_size, false,
940 "enable testing the function context size overflow path "
941 "by making the maximum size smaller")
942
943// builtins-ia32.cc
944DEFINE_BOOL(inline_new, true, "use fast inline allocation")
945
946// codegen-ia32.cc / codegen-arm.cc
947DEFINE_BOOL(trace, false, "trace function calls")
948
949// codegen.cc
950DEFINE_BOOL(lazy, true, "use lazy compilation")
951DEFINE_BOOL(max_lazy, false, "ignore eager compilation hints")
952DEFINE_IMPLICATION(max_lazy, lazy)
953DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
954DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
955DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
956DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics")
957DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
958DEFINE_BOOL(trace_file_names, false,
959 "include file names in trace-opt/trace-deopt output")
960DEFINE_BOOL(always_opt, false, "always try to optimize functions")
961DEFINE_BOOL(always_osr, false, "always try to OSR functions")
962DEFINE_BOOL(prepare_always_opt, false, "prepare for turning on always opt")
963
964DEFINE_BOOL(trace_serializer, false, "print code serializer trace")
965#ifdef DEBUG
966DEFINE_BOOL(external_reference_stats, false,
967 "print statistics on external references used during serialization")
968#endif // DEBUG
969
970// compilation-cache.cc
971DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
972
973DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
974
975// compiler-dispatcher.cc
976DEFINE_BOOL(parallel_compile_tasks, false, "enable parallel compile tasks")
977DEFINE_BOOL(compiler_dispatcher, false, "enable compiler dispatcher")
978DEFINE_IMPLICATION(parallel_compile_tasks, compiler_dispatcher)
979DEFINE_BOOL(trace_compiler_dispatcher, false,
980 "trace compiler dispatcher activity")
981
982// cpu-profiler.cc
983DEFINE_INT(cpu_profiler_sampling_interval, 1000,
984 "CPU profiler sampling interval in microseconds")
985
986// Array abuse tracing
987DEFINE_BOOL(trace_js_array_abuse, false,
988 "trace out-of-bounds accesses to JS arrays")
989DEFINE_BOOL(trace_external_array_abuse, false,
990 "trace out-of-bounds-accesses to external arrays")
991DEFINE_BOOL(trace_array_abuse, false,
992 "trace out-of-bounds accesses to all arrays")
993DEFINE_IMPLICATION(trace_array_abuse, trace_js_array_abuse)
994DEFINE_IMPLICATION(trace_array_abuse, trace_external_array_abuse)
995
996// debugger
997DEFINE_BOOL(
998 trace_side_effect_free_debug_evaluate, false,
999 "print debug messages for side-effect-free debug-evaluate for testing")
1000DEFINE_BOOL(hard_abort, true, "abort by crashing")
1001
1002// inspector
1003DEFINE_BOOL(expose_inspector_scripts, false,
1004 "expose injected-script-source.js for debugging")
1005
1006// execution.cc
1007DEFINE_INT(stack_size, V8_DEFAULT_STACK_SIZE_KB,
1008 "default size of stack region v8 is allowed to use (in kBytes)")
1009
1010// frames.cc
1011DEFINE_INT(max_stack_trace_source_length, 300,
1012 "maximum length of function source code printed in a stack trace.")
1013
1014// execution.cc, messages.cc
1015DEFINE_BOOL(clear_exceptions_on_js_entry, false,
1016 "clear pending exceptions when entering JavaScript")
1017
1018// counters.cc
1019DEFINE_INT(histogram_interval, 600000,
1020 "time interval in ms for aggregating memory histograms")
1021
1022// heap-snapshot-generator.cc
1023DEFINE_BOOL(heap_profiler_trace_objects, false,
1024 "Dump heap object allocations/movements/size_updates")
1025DEFINE_BOOL(heap_profiler_use_embedder_graph, true,
1026 "Use the new EmbedderGraph API to get embedder nodes")
1027DEFINE_INT(heap_snapshot_string_limit, 1024,
1028 "truncate strings to this length in the heap snapshot")
1029
1030// sampling-heap-profiler.cc
1031DEFINE_BOOL(sampling_heap_profiler_suppress_randomness, false,
1032 "Use constant sample intervals to eliminate test flakiness")
1033
1034// v8.cc
1035DEFINE_BOOL(use_idle_notification, true,
1036 "Use idle notification to reduce memory footprint.")
1037// ic.cc
1038DEFINE_BOOL(trace_ic, false,
1039 "trace inline cache state transitions for tools/ic-processor")
1040DEFINE_IMPLICATION(trace_ic, log_code)
1041DEFINE_GENERIC_IMPLICATION(
1042 trace_ic, TracingFlags::ic_stats.store(
1043 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE))
1044DEFINE_BOOL_READONLY(track_constant_fields, true,
1045 "enable constant field tracking")
1046DEFINE_BOOL_READONLY(fast_map_update, false,
1047 "enable fast map update by caching the migration target")
1048DEFINE_BOOL(modify_field_representation_inplace, true,
1049 "enable in-place field representation updates")
1050DEFINE_INT(max_polymorphic_map_count, 4,
1051 "maximum number of maps to track in POLYMORPHIC state")
1052
1053DEFINE_BOOL(native_code_counters, DEBUG_BOOL,
1054 "generate extra code for manipulating stats counters")
1055
1056// objects.cc
1057DEFINE_BOOL(thin_strings, true, "Enable ThinString support")
1058DEFINE_BOOL(trace_prototype_users, false,
1059 "Trace updates to prototype user tracking")
1060DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
1061DEFINE_BOOL(trace_for_in_enumerate, false, "Trace for-in enumerate slow-paths")
1062DEFINE_BOOL(trace_maps, false, "trace map creation")
1063DEFINE_BOOL(trace_maps_details, true, "also log map details")
1064DEFINE_IMPLICATION(trace_maps, log_code)
1065
1066// parser.cc
1067DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
1068DEFINE_BOOL(parse_only, false, "only parse the sources")
1069
1070// simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
1071DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
1072DEFINE_BOOL(debug_sim, false, "Enable debugging the simulator")
1073DEFINE_BOOL(check_icache, false,
1074 "Check icache flushes in ARM and MIPS simulator")
1075DEFINE_INT(stop_sim_at, 0, "Simulator stop after x number of instructions")
1076#if defined(V8_TARGET_ARCH_ARM64) || defined(V8_TARGET_ARCH_MIPS64) || \
1077 defined(V8_TARGET_ARCH_PPC64)
1078DEFINE_INT(sim_stack_alignment, 16,
1079 "Stack alignment in bytes in simulator. This must be a power of two "
1080 "and it must be at least 16. 16 is default.")
1081#else
1082DEFINE_INT(sim_stack_alignment, 8,
1083 "Stack alingment in bytes in simulator (4 or 8, 8 is default)")
1084#endif
1085DEFINE_INT(sim_stack_size, 2 * MB / KB,
1086 "Stack size of the ARM64, MIPS64 and PPC64 simulator "
1087 "in kBytes (default is 2 MB)")
1088DEFINE_BOOL(log_colour, ENABLE_LOG_COLOUR,
1089 "When logging, try to use coloured output.")
1090DEFINE_BOOL(ignore_asm_unimplemented_break, false,
1091 "Don't break for ASM_UNIMPLEMENTED_BREAK macros.")
1092DEFINE_BOOL(trace_sim_messages, false,
1093 "Trace simulator debug messages. Implied by --trace-sim.")
1094
1095// isolate.cc
1096DEFINE_BOOL(async_stack_traces, true,
1097 "include async stack traces in Error.stack")
1098DEFINE_IMPLICATION(async_stack_traces, harmony_await_optimization)
1099DEFINE_BOOL(stack_trace_on_illegal, false,
1100 "print stack trace when an illegal exception is thrown")
1101DEFINE_BOOL(abort_on_uncaught_exception, false,
1102 "abort program (dump core) when an uncaught exception is thrown")
1103// TODO(jgruber,machenbach): Rename to --correctness-fuzzer-suppressions.
1104DEFINE_BOOL(abort_on_stack_or_string_length_overflow, false,
1105 "Abort program when the stack overflows or a string exceeds "
1106 "maximum length (as opposed to throwing RangeError). This is "
1107 "useful for fuzzing where the spec behaviour would introduce "
1108 "nondeterminism.")
1109DEFINE_BOOL(randomize_hashes, true,
1110 "randomize hashes to avoid predictable hash collisions "
1111 "(with snapshots this option cannot override the baked-in seed)")
1112DEFINE_BOOL(rehash_snapshot, true,
1113 "rehash strings from the snapshot to override the baked-in seed")
1114DEFINE_UINT64(hash_seed, 0,
1115 "Fixed seed to use to hash property keys (0 means random)"
1116 "(with snapshots this option cannot override the baked-in seed)")
1117DEFINE_INT(random_seed, 0,
1118 "Default seed for initializing random generator "
1119 "(0, the default, means to use system random).")
1120DEFINE_INT(fuzzer_random_seed, 0,
1121 "Default seed for initializing fuzzer random generator "
1122 "(0, the default, means to use v8's random number generator seed).")
1123DEFINE_BOOL(trace_rail, false, "trace RAIL mode")
1124DEFINE_BOOL(print_all_exceptions, false,
1125 "print exception object and stack trace on each thrown exception")
1126DEFINE_BOOL(
1127 detailed_error_stack_trace, false,
1128 "includes arguments for each function call in the error stack frames array")
1129
1130// runtime.cc
1131DEFINE_BOOL(runtime_call_stats, false, "report runtime call counts and times")
1132DEFINE_GENERIC_IMPLICATION(
1133 runtime_call_stats,
1134 TracingFlags::runtime_stats.store(
1135 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE))
1136
1137// snapshot-common.cc
1138#ifdef V8_EMBEDDED_BUILTINS
1139#define V8_EMBEDDED_BUILTINS_BOOL true
1140#else
1141#define V8_EMBEDDED_BUILTINS_BOOL false
1142#endif
1143DEFINE_BOOL_READONLY(embedded_builtins, V8_EMBEDDED_BUILTINS_BOOL,
1144 "Embed builtin code into the binary.")
1145DEFINE_BOOL(profile_deserialization, false,
1146 "Print the time it takes to deserialize the snapshot.")
1147DEFINE_BOOL(serialization_statistics, false,
1148 "Collect statistics on serialized objects.")
1149DEFINE_UINT(serialization_chunk_size, 4096,
1150 "Custom size for serialization chunks")
1151
1152// Regexp
1153DEFINE_BOOL(regexp_optimization, true, "generate optimized regexp code")
1154DEFINE_BOOL(regexp_mode_modifiers, false, "enable inline flags in regexp.")
1155DEFINE_BOOL(regexp_interpret_all, false, "interpret all regexp code")
1156
1157// Testing flags test/cctest/test-{flags,api,serialization}.cc
1158DEFINE_BOOL(testing_bool_flag, true, "testing_bool_flag")
1159DEFINE_MAYBE_BOOL(testing_maybe_bool_flag, "testing_maybe_bool_flag")
1160DEFINE_INT(testing_int_flag, 13, "testing_int_flag")
1161DEFINE_FLOAT(testing_float_flag, 2.5, "float-flag")
1162DEFINE_STRING(testing_string_flag, "Hello, world!", "string-flag")
1163DEFINE_INT(testing_prng_seed, 42, "Seed used for threading test randomness")
1164
1165// mksnapshot.cc
1166DEFINE_STRING(embedded_src, nullptr,
1167 "Path for the generated embedded data file. (mksnapshot only)")
1168DEFINE_STRING(
1169 embedded_variant, nullptr,
1170 "Label to disambiguate symbols in embedded data file. (mksnapshot only)")
1171DEFINE_STRING(startup_src, nullptr,
1172 "Write V8 startup as C++ src. (mksnapshot only)")
1173DEFINE_STRING(startup_blob, nullptr,
1174 "Write V8 startup blob file. (mksnapshot only)")
1175DEFINE_STRING(target_os, nullptr, "The mksnapshot target os. (mksnapshot only)")
1176
1177//
1178// Minor mark compact collector flags.
1179//
1180#ifdef ENABLE_MINOR_MC
1181DEFINE_BOOL(minor_mc_parallel_marking, true,
1182 "use parallel marking for the young generation")
1183DEFINE_BOOL(trace_minor_mc_parallel_marking, false,
1184 "trace parallel marking for the young generation")
1185DEFINE_BOOL(minor_mc, false, "perform young generation mark compact GCs")
1186#endif // ENABLE_MINOR_MC
1187
1188//
1189// Dev shell flags
1190//
1191
1192DEFINE_BOOL(help, false, "Print usage message, including flags, on console")
1193DEFINE_BOOL(dump_counters, false, "Dump counters on exit")
1194DEFINE_BOOL(dump_counters_nvp, false,
1195 "Dump counters as name-value pairs on exit")
1196DEFINE_BOOL(use_external_strings, false, "Use external strings for source code")
1197
1198DEFINE_STRING(map_counters, "", "Map counters to a file")
1199DEFINE_BOOL(mock_arraybuffer_allocator, false,
1200 "Use a mock ArrayBuffer allocator for testing.")
1201DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
1202 "Memory limit for mock ArrayBuffer allocator used to simulate "
1203 "OOM for testing.")
1204
1205//
1206// Flags only available in non-Lite modes.
1207//
1208#undef FLAG
1209#ifdef V8_LITE_MODE
1210#define FLAG FLAG_READONLY
1211#else
1212#define FLAG FLAG_FULL
1213#endif
1214
1215DEFINE_BOOL(jitless, V8_LITE_BOOL,
1216 "Disable runtime allocation of executable memory.")
1217
1218// Jitless V8 has a few implications:
1219#ifndef V8_LITE_MODE
1220// Optimizations (i.e. jitting) are disabled.
1221DEFINE_NEG_IMPLICATION(jitless, opt)
1222#endif
1223// Field representation tracking is only used by TurboFan.
1224DEFINE_NEG_IMPLICATION(jitless, track_field_types)
1225DEFINE_NEG_IMPLICATION(jitless, track_heap_object_fields)
1226// Regexps are interpreted.
1227DEFINE_IMPLICATION(jitless, regexp_interpret_all)
1228// asm.js validation is disabled since it triggers wasm code generation.
1229DEFINE_NEG_IMPLICATION(jitless, validate_asm)
1230// Wasm is put into interpreter-only mode. We repeat flag implications down
1231// here to ensure they're applied correctly by setting the --jitless flag.
1232DEFINE_IMPLICATION(jitless, wasm_interpret_all)
1233DEFINE_NEG_IMPLICATION(jitless, asm_wasm_lazy_compilation)
1234DEFINE_NEG_IMPLICATION(jitless, wasm_lazy_compilation)
1235// --jitless also implies --no-expose-wasm, see InitializeOncePerProcessImpl.
1236
1237// Enable recompilation of function with optimized code.
1238DEFINE_BOOL(opt, !V8_LITE_BOOL, "use adaptive optimizations")
1239
1240// Enable use of inline caches to optimize object access operations.
1241DEFINE_BOOL(use_ic, true, "use inline caching")
1242
1243// Favor memory over execution speed.
1244DEFINE_BOOL(optimize_for_size, V8_LITE_BOOL,
1245 "Enables optimizations which favor memory size over execution "
1246 "speed")
1247DEFINE_VALUE_IMPLICATION(optimize_for_size, max_semi_space_size, 1)
1248
1249//
1250// GDB JIT integration flags.
1251//
1252#undef FLAG
1253#ifdef ENABLE_GDB_JIT_INTERFACE
1254#define FLAG FLAG_FULL
1255#else
1256#define FLAG FLAG_READONLY
1257#endif
1258
1259DEFINE_BOOL(gdbjit, false, "enable GDBJIT interface")
1260DEFINE_BOOL(gdbjit_full, false, "enable GDBJIT interface for all code objects")
1261DEFINE_BOOL(gdbjit_dump, false, "dump elf objects with debug info to disk")
1262DEFINE_STRING(gdbjit_dump_filter, "",
1263 "dump only objects containing this substring")
1264
1265#ifdef ENABLE_GDB_JIT_INTERFACE
1266DEFINE_IMPLICATION(gdbjit_full, gdbjit)
1267DEFINE_IMPLICATION(gdbjit_dump, gdbjit)
1268#endif
1269DEFINE_NEG_IMPLICATION(gdbjit, compact_code_space)
1270
1271//
1272// Debug only flags
1273//
1274#undef FLAG
1275#ifdef DEBUG
1276#define FLAG FLAG_FULL
1277#else
1278#define FLAG FLAG_READONLY
1279#endif
1280
1281// checks.cc
1282#ifdef ENABLE_SLOW_DCHECKS
1283DEFINE_BOOL(enable_slow_asserts, true,
1284 "enable asserts that are slow to execute")
1285#endif
1286
1287// codegen-ia32.cc / codegen-arm.cc / macro-assembler-*.cc
1288DEFINE_BOOL(print_ast, false, "print source AST")
1289DEFINE_BOOL(trap_on_abort, false, "replace aborts by breakpoints")
1290
1291// compiler.cc
1292DEFINE_BOOL(print_scopes, false, "print scopes")
1293
1294// contexts.cc
1295DEFINE_BOOL(trace_contexts, false, "trace contexts operations")
1296
1297// heap.cc
1298DEFINE_BOOL(gc_verbose, false, "print stuff during garbage collection")
1299DEFINE_BOOL(code_stats, false, "report code statistics after GC")
1300DEFINE_BOOL(print_handles, false, "report handles after GC")
1301DEFINE_BOOL(check_handle_count, false,
1302 "Check that there are not too many handles at GC")
1303DEFINE_BOOL(print_global_handles, false, "report global handles after GC")
1304
1305// TurboFan debug-only flags.
1306DEFINE_BOOL(trace_turbo_escape, false, "enable tracing in escape analysis")
1307
1308// objects.cc
1309DEFINE_BOOL(trace_module_status, false,
1310 "Trace status transitions of ECMAScript modules")
1311DEFINE_BOOL(trace_normalization, false,
1312 "prints when objects are turned into dictionaries.")
1313
1314// runtime.cc
1315DEFINE_BOOL(trace_lazy, false, "trace lazy compilation")
1316
1317// spaces.cc
1318DEFINE_BOOL(collect_heap_spill_statistics, false,
1319 "report heap spill statistics along with heap_stats "
1320 "(requires heap_stats)")
1321DEFINE_BOOL(trace_isolates, false, "trace isolate state changes")
1322
1323// Regexp
1324DEFINE_BOOL(regexp_possessive_quantifier, false,
1325 "enable possessive quantifier syntax for testing")
1326DEFINE_BOOL(trace_regexp_bytecodes, false, "trace regexp bytecode execution")
1327DEFINE_BOOL(trace_regexp_assembler, false,
1328 "trace regexp macro assembler calls.")
1329DEFINE_BOOL(trace_regexp_parser, false, "trace regexp parsing")
1330
1331// Debugger
1332DEFINE_BOOL(print_break_location, false, "print source location on debug break")
1333
1334// wasm instance management
1335DEFINE_DEBUG_BOOL(trace_wasm_instances, false,
1336 "trace creation and collection of wasm instances")
1337
1338//
1339// Logging and profiling flags
1340//
1341#undef FLAG
1342#define FLAG FLAG_FULL
1343
1344// log.cc
1345DEFINE_BOOL(log, false,
1346 "Minimal logging (no API, code, GC, suspect, or handles samples).")
1347DEFINE_BOOL(log_all, false, "Log all events to the log file.")
1348DEFINE_BOOL(log_api, false, "Log API events to the log file.")
1349DEFINE_BOOL(log_code, false,
1350 "Log code events to the log file without profiling.")
1351DEFINE_BOOL(log_handles, false, "Log global handle events.")
1352DEFINE_BOOL(log_suspect, false, "Log suspect operations.")
1353DEFINE_BOOL(log_source_code, false, "Log source code.")
1354DEFINE_BOOL(log_function_events, false,
1355 "Log function events "
1356 "(parse, compile, execute) separately.")
1357DEFINE_BOOL(prof, false,
1358 "Log statistical profiling information (implies --log-code).")
1359
1360DEFINE_BOOL(detailed_line_info, false,
1361 "Always generate detailed line information for CPU profiling.")
1362
1363#if defined(ANDROID)
1364// Phones and tablets have processors that are much slower than desktop
1365// and laptop computers for which current heuristics are tuned.
1366#define DEFAULT_PROF_SAMPLING_INTERVAL 5000
1367#else
1368#define DEFAULT_PROF_SAMPLING_INTERVAL 1000
1369#endif
1370DEFINE_INT(prof_sampling_interval, DEFAULT_PROF_SAMPLING_INTERVAL,
1371 "Interval for --prof samples (in microseconds).")
1372#undef DEFAULT_PROF_SAMPLING_INTERVAL
1373
1374DEFINE_BOOL(prof_cpp, false, "Like --prof, but ignore generated code.")
1375DEFINE_IMPLICATION(prof, prof_cpp)
1376DEFINE_BOOL(prof_browser_mode, true,
1377 "Used with --prof, turns on browser-compatible mode for profiling.")
1378DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
1379DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
1380DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
1381DEFINE_BOOL(perf_basic_prof, false,
1382 "Enable perf linux profiler (basic support).")
1383DEFINE_NEG_IMPLICATION(perf_basic_prof, compact_code_space)
1384DEFINE_BOOL(perf_basic_prof_only_functions, false,
1385 "Only report function code ranges to perf (i.e. no stubs).")
1386DEFINE_IMPLICATION(perf_basic_prof_only_functions, perf_basic_prof)
1387DEFINE_BOOL(perf_prof, false,
1388 "Enable perf linux profiler (experimental annotate support).")
1389DEFINE_NEG_IMPLICATION(perf_prof, compact_code_space)
1390// TODO(v8:8462) Remove implication once perf supports remapping.
1391DEFINE_NEG_IMPLICATION(perf_prof, write_protect_code_memory)
1392DEFINE_NEG_IMPLICATION(perf_prof, wasm_write_protect_code_memory)
1393DEFINE_BOOL(perf_prof_unwinding_info, false,
1394 "Enable unwinding info for perf linux profiler (experimental).")
1395DEFINE_IMPLICATION(perf_prof, perf_prof_unwinding_info)
1396DEFINE_STRING(gc_fake_mmap, "/tmp/__v8_gc__",
1397 "Specify the name of the file for fake gc mmap used in ll_prof")
1398DEFINE_BOOL(log_internal_timer_events, false, "Time internal events.")
1399DEFINE_BOOL(log_timer_events, false,
1400 "Time events including external callbacks.")
1401DEFINE_IMPLICATION(log_timer_events, log_internal_timer_events)
1402DEFINE_IMPLICATION(log_internal_timer_events, prof)
1403DEFINE_BOOL(log_instruction_stats, false, "Log AArch64 instruction statistics.")
1404DEFINE_STRING(log_instruction_file, "arm64_inst.csv",
1405 "AArch64 instruction statistics log file.")
1406DEFINE_INT(log_instruction_period, 1 << 22,
1407 "AArch64 instruction statistics logging period.")
1408
1409DEFINE_BOOL(redirect_code_traces, false,
1410 "output deopt information and disassembly into file "
1411 "code-<pid>-<isolate id>.asm")
1412DEFINE_STRING(redirect_code_traces_to, nullptr,
1413 "output deopt information and disassembly into the given file")
1414
1415DEFINE_BOOL(print_opt_source, false,
1416 "print source code of optimized and inlined functions")
1417
1418DEFINE_BOOL(win64_unwinding_info, false,
1419 "Enable unwinding info for Windows/x64 (experimental).")
1420
1421#ifdef V8_TARGET_ARCH_ARM
1422// Unsupported on arm. See https://crbug.com/v8/8713.
1423DEFINE_BOOL_READONLY(
1424 interpreted_frames_native_stack, false,
1425 "Show interpreted frames on the native stack (useful for external "
1426 "profilers).")
1427#else
1428DEFINE_BOOL(interpreted_frames_native_stack, false,
1429 "Show interpreted frames on the native stack (useful for external "
1430 "profilers).")
1431#endif
1432
1433//
1434// Disassembler only flags
1435//
1436#undef FLAG
1437#ifdef ENABLE_DISASSEMBLER
1438#define FLAG FLAG_FULL
1439#else
1440#define FLAG FLAG_READONLY
1441#endif
1442
1443// elements.cc
1444DEFINE_BOOL(trace_elements_transitions, false, "trace elements transitions")
1445
1446DEFINE_BOOL(trace_creation_allocation_sites, false,
1447 "trace the creation of allocation sites")
1448
1449// codegen-ia32.cc / codegen-arm.cc
1450DEFINE_BOOL(print_code, false, "print generated code")
1451DEFINE_BOOL(print_opt_code, false, "print optimized code")
1452DEFINE_STRING(print_opt_code_filter, "*", "filter for printing optimized code")
1453DEFINE_BOOL(print_code_verbose, false, "print more information for code")
1454DEFINE_BOOL(print_builtin_code, false, "print generated code for builtins")
1455DEFINE_STRING(print_builtin_code_filter, "*",
1456 "filter for printing builtin code")
1457DEFINE_BOOL(print_builtin_size, false, "print code size for builtins")
1458
1459#ifdef ENABLE_DISASSEMBLER
1460DEFINE_BOOL(sodium, false,
1461 "print generated code output suitable for use with "
1462 "the Sodium code viewer")
1463
1464DEFINE_IMPLICATION(sodium, print_code)
1465DEFINE_IMPLICATION(sodium, print_opt_code)
1466DEFINE_IMPLICATION(sodium, code_comments)
1467
1468DEFINE_BOOL(print_all_code, false, "enable all flags related to printing code")
1469DEFINE_IMPLICATION(print_all_code, print_code)
1470DEFINE_IMPLICATION(print_all_code, print_opt_code)
1471DEFINE_IMPLICATION(print_all_code, print_code_verbose)
1472DEFINE_IMPLICATION(print_all_code, print_builtin_code)
1473DEFINE_IMPLICATION(print_all_code, code_comments)
1474#endif
1475
1476#undef FLAG
1477#define FLAG FLAG_FULL
1478
1479//
1480// Predictable mode related flags.
1481//
1482
1483DEFINE_BOOL(predictable, false, "enable predictable mode")
1484DEFINE_IMPLICATION(predictable, single_threaded)
1485DEFINE_NEG_IMPLICATION(predictable, memory_reducer)
1486DEFINE_VALUE_IMPLICATION(single_threaded, wasm_num_compilation_tasks, 0)
1487DEFINE_NEG_IMPLICATION(single_threaded, wasm_async_compilation)
1488
1489DEFINE_BOOL(predictable_gc_schedule, false,
1490 "Predictable garbage collection schedule. Fixes heap growing, "
1491 "idle, and memory reducing behavior.")
1492DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, min_semi_space_size, 4)
1493DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, max_semi_space_size, 4)
1494DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, heap_growing_percent, 30)
1495DEFINE_NEG_IMPLICATION(predictable_gc_schedule, idle_time_scavenge)
1496DEFINE_NEG_IMPLICATION(predictable_gc_schedule, memory_reducer)
1497
1498//
1499// Threading related flags.
1500//
1501
1502DEFINE_BOOL(single_threaded, false, "disable the use of background tasks")
1503DEFINE_IMPLICATION(single_threaded, single_threaded_gc)
1504DEFINE_NEG_IMPLICATION(single_threaded, concurrent_recompilation)
1505DEFINE_NEG_IMPLICATION(single_threaded, compiler_dispatcher)
1506
1507//
1508// Parallel and concurrent GC (Orinoco) related flags.
1509//
1510DEFINE_BOOL(single_threaded_gc, false, "disable the use of background gc tasks")
1511DEFINE_NEG_IMPLICATION(single_threaded_gc, concurrent_marking)
1512DEFINE_NEG_IMPLICATION(single_threaded_gc, concurrent_sweeping)
1513DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_compaction)
1514DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_marking)
1515DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_pointer_update)
1516DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_scavenge)
1517DEFINE_NEG_IMPLICATION(single_threaded_gc, concurrent_store_buffer)
1518#ifdef ENABLE_MINOR_MC
1519DEFINE_NEG_IMPLICATION(single_threaded_gc, minor_mc_parallel_marking)
1520#endif // ENABLE_MINOR_MC
1521DEFINE_NEG_IMPLICATION(single_threaded_gc, concurrent_array_buffer_freeing)
1522
1523#undef FLAG
1524
1525#ifdef VERIFY_PREDICTABLE
1526#define FLAG FLAG_FULL
1527#else
1528#define FLAG FLAG_READONLY
1529#endif
1530
1531DEFINE_BOOL(verify_predictable, false,
1532 "this mode is used for checking that V8 behaves predictably")
1533DEFINE_INT(dump_allocations_digest_at_alloc, -1,
1534 "dump allocations digest each n-th allocation")
1535
1536//
1537// Read-only flags
1538//
1539#undef FLAG
1540#define FLAG FLAG_READONLY
1541
1542// assembler.h
1543DEFINE_BOOL(enable_embedded_constant_pool, V8_EMBEDDED_CONSTANT_POOL,
1544 "enable use of embedded constant pools (PPC only)")
1545
1546DEFINE_BOOL(unbox_double_fields, V8_DOUBLE_FIELDS_UNBOXING,
1547 "enable in-object double fields unboxing (64-bit only)")
1548DEFINE_IMPLICATION(unbox_double_fields, track_double_fields)
1549
1550DEFINE_BOOL(raw_heap_snapshots, V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL,
1551 "enable raw heap snapshots contain garbage collection internals")
1552
1553DEFINE_BOOL(lite_mode, V8_LITE_BOOL,
1554 "enables trade-off of performance for memory savings "
1555 "(Lite mode only)")
1556DEFINE_IMPLICATION(lite_mode, lazy_feedback_allocation)
1557
1558// Cleanup...
1559#undef FLAG_FULL
1560#undef FLAG_READONLY
1561#undef FLAG
1562#undef FLAG_ALIAS
1563
1564#undef DEFINE_BOOL
1565#undef DEFINE_MAYBE_BOOL
1566#undef DEFINE_DEBUG_BOOL
1567#undef DEFINE_INT
1568#undef DEFINE_STRING
1569#undef DEFINE_FLOAT
1570#undef DEFINE_IMPLICATION
1571#undef DEFINE_NEG_IMPLICATION
1572#undef DEFINE_NEG_VALUE_IMPLICATION
1573#undef DEFINE_VALUE_IMPLICATION
1574#undef DEFINE_GENERIC_IMPLICATION
1575#undef DEFINE_ALIAS_BOOL
1576#undef DEFINE_ALIAS_INT
1577#undef DEFINE_ALIAS_STRING
1578#undef DEFINE_ALIAS_FLOAT
1579
1580#undef FLAG_MODE_DECLARE
1581#undef FLAG_MODE_DEFINE
1582#undef FLAG_MODE_DEFINE_DEFAULTS
1583#undef FLAG_MODE_META
1584#undef FLAG_MODE_DEFINE_IMPLICATIONS
1585#undef FLAG_MODE_APPLY
1586
1587#undef COMMA
1588