flag-definitions.h revision 342c50ce1624b485728b9a4fc41d8bbf37eb46cf
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#define DEFINE_IMPLICATION(whenflag, thenflag)              \
14  DEFINE_VALUE_IMPLICATION(whenflag, thenflag, true)
15
16#define DEFINE_NEG_IMPLICATION(whenflag, thenflag)          \
17  DEFINE_VALUE_IMPLICATION(whenflag, thenflag, false)
18
19#define DEFINE_NEG_NEG_IMPLICATION(whenflag, thenflag) \
20  DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, false)
21
22// We want to declare the names of the variables for the header file.  Normally
23// this will just be an extern declaration, but for a readonly flag we let the
24// compiler make better optimizations by giving it the value.
25#if defined(FLAG_MODE_DECLARE)
26#define FLAG_FULL(ftype, ctype, nam, def, cmt) extern ctype FLAG_##nam;
27#define FLAG_READONLY(ftype, ctype, nam, def, cmt) \
28  static ctype const FLAG_##nam = def;
29
30// We want to supply the actual storage and value for the flag variable in the
31// .cc file.  We only do this for writable flags.
32#elif defined(FLAG_MODE_DEFINE)
33#define FLAG_FULL(ftype, ctype, nam, def, cmt) ctype FLAG_##nam = def;
34
35// We need to define all of our default values so that the Flag structure can
36// access them by pointer.  These are just used internally inside of one .cc,
37// for MODE_META, so there is no impact on the flags interface.
38#elif defined(FLAG_MODE_DEFINE_DEFAULTS)
39#define FLAG_FULL(ftype, ctype, nam, def, cmt) \
40  static ctype const FLAGDEFAULT_##nam = def;
41
42// We want to write entries into our meta data table, for internal parsing and
43// printing / etc in the flag parser code.  We only do this for writable flags.
44#elif defined(FLAG_MODE_META)
45#define FLAG_FULL(ftype, ctype, nam, def, cmt)                              \
46  { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false } \
47  ,
48#define FLAG_ALIAS(ftype, ctype, alias, nam)                     \
49  {                                                              \
50    Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \
51        "alias for --" #nam, false                               \
52  }                                                              \
53  ,
54
55// We produce the code to set flags when it is implied by another flag.
56#elif defined(FLAG_MODE_DEFINE_IMPLICATIONS)
57#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) \
58  if (FLAG_##whenflag) FLAG_##thenflag = value;
59
60#define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value) \
61  if (!FLAG_##whenflag) FLAG_##thenflag = value;
62
63#else
64#error No mode supplied when including flags.defs
65#endif
66
67// Dummy defines for modes where it is not relevant.
68#ifndef FLAG_FULL
69#define FLAG_FULL(ftype, ctype, nam, def, cmt)
70#endif
71
72#ifndef FLAG_READONLY
73#define FLAG_READONLY(ftype, ctype, nam, def, cmt)
74#endif
75
76#ifndef FLAG_ALIAS
77#define FLAG_ALIAS(ftype, ctype, alias, nam)
78#endif
79
80#ifndef DEFINE_VALUE_IMPLICATION
81#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value)
82#endif
83
84#ifndef DEFINE_NEG_VALUE_IMPLICATION
85#define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value)
86#endif
87
88#define COMMA ,
89
90#ifdef FLAG_MODE_DECLARE
91// Structure used to hold a collection of arguments to the JavaScript code.
92struct JSArguments {
93 public:
94  inline const char*& operator[](int idx) const { return argv[idx]; }
95  static JSArguments Create(int argc, const char** argv) {
96    JSArguments args;
97    args.argc = argc;
98    args.argv = argv;
99    return args;
100  }
101  int argc;
102  const char** argv;
103};
104
105struct MaybeBoolFlag {
106  static MaybeBoolFlag Create(bool has_value, bool value) {
107    MaybeBoolFlag flag;
108    flag.has_value = has_value;
109    flag.value = value;
110    return flag;
111  }
112  bool has_value;
113  bool value;
114};
115#endif
116
117#ifdef DEBUG
118#define DEBUG_BOOL true
119#else
120#define DEBUG_BOOL false
121#endif
122#if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
123#define ENABLE_VFP3_DEFAULT true
124#else
125#define ENABLE_VFP3_DEFAULT false
126#endif
127#if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
128#define ENABLE_ARMV7_DEFAULT true
129#else
130#define ENABLE_ARMV7_DEFAULT false
131#endif
132#if (defined CAN_USE_ARMV8_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
133#define ENABLE_ARMV8_DEFAULT true
134#else
135#define ENABLE_ARMV8_DEFAULT false
136#endif
137#if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
138#define ENABLE_32DREGS_DEFAULT true
139#else
140#define ENABLE_32DREGS_DEFAULT false
141#endif
142#if (defined CAN_USE_NEON) || !(defined ARM_TEST_NO_FEATURE_PROBE)
143# define ENABLE_NEON_DEFAULT true
144#else
145# define ENABLE_NEON_DEFAULT false
146#endif
147#ifdef V8_OS_WIN
148# define ENABLE_LOG_COLOUR false
149#else
150# define ENABLE_LOG_COLOUR true
151#endif
152
153#define DEFINE_BOOL(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
154#define DEFINE_BOOL_READONLY(nam, def, cmt) \
155  FLAG_READONLY(BOOL, bool, nam, def, cmt)
156#define DEFINE_MAYBE_BOOL(nam, cmt) \
157  FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, {false COMMA false}, cmt)
158#define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
159#define DEFINE_FLOAT(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
160#define DEFINE_STRING(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
161#define DEFINE_ARGS(nam, cmt) FLAG(ARGS, JSArguments, nam, {0 COMMA NULL}, cmt)
162
163#define DEFINE_ALIAS_BOOL(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam)
164#define DEFINE_ALIAS_INT(alias, nam) FLAG_ALIAS(INT, int, alias, nam)
165#define DEFINE_ALIAS_FLOAT(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam)
166#define DEFINE_ALIAS_STRING(alias, nam) \
167  FLAG_ALIAS(STRING, const char*, alias, nam)
168#define DEFINE_ALIAS_ARGS(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam)
169
170//
171// Flags in all modes.
172//
173#define FLAG FLAG_FULL
174
175DEFINE_BOOL(experimental_extras, false,
176            "enable code compiled in via v8_experimental_extra_library_files")
177
178// Flags for language modes and experimental language features.
179DEFINE_BOOL(use_strict, false, "enforce strict mode")
180DEFINE_BOOL(use_strong, false, "enforce strong mode")
181DEFINE_IMPLICATION(use_strong, use_strict)
182
183DEFINE_BOOL(strong_mode, false, "experimental strong language mode")
184DEFINE_IMPLICATION(use_strong, strong_mode)
185DEFINE_BOOL(strong_this, true, "don't allow 'this' to escape from constructors")
186
187DEFINE_BOOL(es_staging, false,
188            "enable test-worthy harmony features (for internal use only)")
189DEFINE_BOOL(harmony, false, "enable all completed harmony features")
190DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
191DEFINE_IMPLICATION(es_staging, harmony)
192
193DEFINE_BOOL(legacy_const, false, "legacy semantics for const in sloppy mode")
194// ES2015 const semantics are shipped
195DEFINE_NEG_VALUE_IMPLICATION(harmony_shipping, legacy_const, true)
196
197DEFINE_BOOL(promise_extra, true, "additional V8 Promise functions")
198// Removing extra Promise functions is staged
199DEFINE_NEG_IMPLICATION(harmony, promise_extra)
200
201// Activate on ClusterFuzz.
202DEFINE_IMPLICATION(es_staging, harmony_regexp_lookbehind)
203DEFINE_IMPLICATION(es_staging, move_object_start)
204DEFINE_IMPLICATION(es_staging, harmony_tailcalls)
205
206// Features that are still work in progress (behind individual flags).
207#define HARMONY_INPROGRESS(V)                                                \
208  V(harmony_object_observe, "harmony Object.observe")                        \
209  V(harmony_modules, "harmony modules")                                      \
210  V(harmony_function_sent, "harmony function.sent")                          \
211  V(harmony_sharedarraybuffer, "harmony sharedarraybuffer")                  \
212  V(harmony_simd, "harmony simd")                                            \
213  V(harmony_do_expressions, "harmony do-expressions")                        \
214  V(harmony_iterator_close, "harmony iterator finalization")                 \
215  V(harmony_tailcalls, "harmony tail calls")                                 \
216  V(harmony_object_values_entries, "harmony Object.values / Object.entries") \
217  V(harmony_object_own_property_descriptors,                                 \
218    "harmony Object.getOwnPropertyDescriptors()")                            \
219  V(harmony_regexp_property, "harmony unicode regexp property classes")
220
221// Features that are complete (but still behind --harmony/es-staging flag).
222#define HARMONY_STAGED(V)                                     \
223  V(harmony_function_name, "harmony Function name inference") \
224  V(harmony_regexp_lookbehind, "harmony regexp lookbehind")   \
225  V(harmony_species, "harmony Symbol.species")                \
226  V(harmony_instanceof, "harmony instanceof support")
227
228// Features that are shipping (turned on by default, but internal flag remains).
229#define HARMONY_SHIPPING(V)                                               \
230  V(harmony_default_parameters, "harmony default parameters")             \
231  V(harmony_destructuring_assignment, "harmony destructuring assignment") \
232  V(harmony_destructuring_bind, "harmony destructuring bind")             \
233  V(harmony_tostring, "harmony toString")                                 \
234  V(harmony_regexps, "harmony regular expression extensions")             \
235  V(harmony_unicode_regexps, "harmony unicode regexps")                   \
236  V(harmony_sloppy, "harmony features in sloppy mode")                    \
237  V(harmony_sloppy_let, "harmony let in sloppy mode")                     \
238  V(harmony_sloppy_function, "harmony sloppy function block scoping")     \
239  V(harmony_proxies, "harmony proxies")                                   \
240  V(harmony_reflect, "harmony Reflect API")                               \
241  V(harmony_regexp_subclass, "harmony regexp subclassing")
242
243// Once a shipping feature has proved stable in the wild, it will be dropped
244// from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed,
245// and associated tests are moved from the harmony directory to the appropriate
246// esN directory.
247
248
249#define FLAG_INPROGRESS_FEATURES(id, description) \
250  DEFINE_BOOL(id, false, "enable " #description " (in progress)")
251HARMONY_INPROGRESS(FLAG_INPROGRESS_FEATURES)
252#undef FLAG_INPROGRESS_FEATURES
253
254#define FLAG_STAGED_FEATURES(id, description) \
255  DEFINE_BOOL(id, false, "enable " #description) \
256  DEFINE_IMPLICATION(harmony, id)
257HARMONY_STAGED(FLAG_STAGED_FEATURES)
258#undef FLAG_STAGED_FEATURES
259
260#define FLAG_SHIPPING_FEATURES(id, description) \
261  DEFINE_BOOL(id, true, "enable " #description) \
262  DEFINE_NEG_NEG_IMPLICATION(harmony_shipping, id)
263HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
264#undef FLAG_SHIPPING_FEATURES
265
266
267// Feature dependencies.
268DEFINE_IMPLICATION(harmony_sloppy_let, harmony_sloppy)
269DEFINE_IMPLICATION(harmony_sloppy_function, harmony_sloppy)
270
271// Destructuring shares too much parsing architecture with default parameters
272// to be enabled on its own.
273DEFINE_IMPLICATION(harmony_destructuring_bind, harmony_default_parameters)
274
275// Flags for experimental implementation features.
276DEFINE_BOOL(compiled_keyed_generic_loads, false,
277            "use optimizing compiler to generate keyed generic load stubs")
278DEFINE_BOOL(allocation_site_pretenuring, true,
279            "pretenure with allocation sites")
280DEFINE_BOOL(trace_pretenuring, false,
281            "trace pretenuring decisions of HAllocate instructions")
282DEFINE_BOOL(trace_pretenuring_statistics, false,
283            "trace allocation site pretenuring statistics")
284DEFINE_BOOL(track_fields, true, "track fields with only smi values")
285DEFINE_BOOL(track_double_fields, true, "track fields with double values")
286DEFINE_BOOL(track_heap_object_fields, true, "track fields with heap values")
287DEFINE_BOOL(track_computed_fields, true, "track computed boilerplate fields")
288DEFINE_IMPLICATION(track_double_fields, track_fields)
289DEFINE_IMPLICATION(track_heap_object_fields, track_fields)
290DEFINE_IMPLICATION(track_computed_fields, track_fields)
291DEFINE_BOOL(track_field_types, true, "track field types")
292DEFINE_IMPLICATION(track_field_types, track_fields)
293DEFINE_IMPLICATION(track_field_types, track_heap_object_fields)
294DEFINE_BOOL(smi_binop, true, "support smi representation in binary operations")
295
296// Flags for optimization types.
297DEFINE_BOOL(optimize_for_size, false,
298            "Enables optimizations which favor memory size over execution "
299            "speed")
300
301DEFINE_VALUE_IMPLICATION(optimize_for_size, max_semi_space_size, 1)
302
303// Flags for data representation optimizations
304DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles")
305DEFINE_BOOL(string_slices, true, "use string slices")
306
307// Flags for Ignition.
308DEFINE_BOOL(ignition, false, "use ignition interpreter")
309DEFINE_STRING(ignition_filter, "*", "filter for ignition interpreter")
310DEFINE_BOOL(print_bytecode, false,
311            "print bytecode generated by ignition interpreter")
312DEFINE_BOOL(trace_ignition, false,
313            "trace the bytecodes executed by the ignition interpreter")
314DEFINE_BOOL(trace_ignition_codegen, false,
315            "trace the codegen of ignition interpreter bytecode handlers")
316
317// Flags for Crankshaft.
318DEFINE_BOOL(crankshaft, true, "use crankshaft")
319DEFINE_STRING(hydrogen_filter, "*", "optimization filter")
320DEFINE_BOOL(use_gvn, true, "use hydrogen global value numbering")
321DEFINE_INT(gvn_iterations, 3, "maximum number of GVN fix-point iterations")
322DEFINE_BOOL(use_canonicalizing, true, "use hydrogen instruction canonicalizing")
323DEFINE_BOOL(use_inlining, true, "use function inlining")
324DEFINE_BOOL(use_escape_analysis, true, "use hydrogen escape analysis")
325DEFINE_BOOL(use_allocation_folding, true, "use allocation folding")
326DEFINE_BOOL(use_local_allocation_folding, false, "only fold in basic blocks")
327DEFINE_BOOL(use_write_barrier_elimination, true,
328            "eliminate write barriers targeting allocations in optimized code")
329DEFINE_INT(max_inlining_levels, 5, "maximum number of inlining levels")
330DEFINE_INT(max_inlined_source_size, 600,
331           "maximum source size in bytes considered for a single inlining")
332DEFINE_INT(max_inlined_nodes, 196,
333           "maximum number of AST nodes considered for a single inlining")
334DEFINE_INT(max_inlined_nodes_cumulative, 400,
335           "maximum cumulative number of AST nodes considered for inlining")
336DEFINE_BOOL(loop_invariant_code_motion, true, "loop invariant code motion")
337DEFINE_BOOL(fast_math, true, "faster (but maybe less accurate) math functions")
338DEFINE_BOOL(collect_megamorphic_maps_from_stub_cache, false,
339            "crankshaft harvests type feedback from stub cache")
340DEFINE_BOOL(hydrogen_stats, false, "print statistics for hydrogen")
341DEFINE_BOOL(trace_check_elimination, false, "trace check elimination phase")
342DEFINE_BOOL(trace_environment_liveness, false,
343            "trace liveness of local variable slots")
344DEFINE_BOOL(trace_hydrogen, false, "trace generated hydrogen to file")
345DEFINE_STRING(trace_hydrogen_filter, "*", "hydrogen tracing filter")
346DEFINE_BOOL(trace_hydrogen_stubs, false, "trace generated hydrogen for stubs")
347DEFINE_STRING(trace_hydrogen_file, NULL, "trace hydrogen to given file name")
348DEFINE_STRING(trace_phase, "HLZ", "trace generated IR for specified phases")
349DEFINE_BOOL(trace_inlining, false, "trace inlining decisions")
350DEFINE_BOOL(trace_load_elimination, false, "trace load elimination")
351DEFINE_BOOL(trace_store_elimination, false, "trace store elimination")
352DEFINE_BOOL(trace_alloc, false, "trace register allocator")
353DEFINE_BOOL(trace_all_uses, false, "trace all use positions")
354DEFINE_BOOL(trace_range, false, "trace range analysis")
355DEFINE_BOOL(trace_gvn, false, "trace global value numbering")
356DEFINE_BOOL(trace_representation, false, "trace representation types")
357DEFINE_BOOL(trace_removable_simulates, false, "trace removable simulates")
358DEFINE_BOOL(trace_escape_analysis, false, "trace hydrogen escape analysis")
359DEFINE_BOOL(trace_allocation_folding, false, "trace allocation folding")
360DEFINE_BOOL(trace_track_allocation_sites, false,
361            "trace the tracking of allocation sites")
362DEFINE_BOOL(trace_migration, false, "trace object migration")
363DEFINE_BOOL(trace_generalization, false, "trace map generalization")
364DEFINE_BOOL(stress_pointer_maps, false, "pointer map for every instruction")
365DEFINE_BOOL(stress_environments, false, "environment for every instruction")
366DEFINE_INT(deopt_every_n_times, 0,
367           "deoptimize every n times a deopt point is passed")
368DEFINE_INT(deopt_every_n_garbage_collections, 0,
369           "deoptimize every n garbage collections")
370DEFINE_BOOL(print_deopt_stress, false, "print number of possible deopt points")
371DEFINE_BOOL(trap_on_deopt, false, "put a break point before deoptimizing")
372DEFINE_BOOL(trap_on_stub_deopt, false,
373            "put a break point before deoptimizing a stub")
374DEFINE_BOOL(deoptimize_uncommon_cases, true, "deoptimize uncommon cases")
375DEFINE_BOOL(polymorphic_inlining, true, "polymorphic inlining")
376DEFINE_BOOL(use_osr, true, "use on-stack replacement")
377DEFINE_BOOL(array_bounds_checks_elimination, true,
378            "perform array bounds checks elimination")
379DEFINE_BOOL(trace_bce, false, "trace array bounds check elimination")
380DEFINE_BOOL(array_bounds_checks_hoisting, false,
381            "perform array bounds checks hoisting")
382DEFINE_BOOL(array_index_dehoisting, true, "perform array index dehoisting")
383DEFINE_BOOL(analyze_environment_liveness, true,
384            "analyze liveness of environment slots and zap dead values")
385DEFINE_BOOL(load_elimination, true, "use load elimination")
386DEFINE_BOOL(check_elimination, true, "use check elimination")
387DEFINE_BOOL(store_elimination, false, "use store elimination")
388DEFINE_BOOL(dead_code_elimination, true, "use dead code elimination")
389DEFINE_BOOL(fold_constants, true, "use constant folding")
390DEFINE_BOOL(trace_dead_code_elimination, false, "trace dead code elimination")
391DEFINE_BOOL(unreachable_code_elimination, true, "eliminate unreachable code")
392DEFINE_BOOL(trace_osr, false, "trace on-stack replacement")
393DEFINE_INT(stress_runs, 0, "number of stress runs")
394DEFINE_BOOL(lookup_sample_by_shared, true,
395            "when picking a function to optimize, watch for shared function "
396            "info, not JSFunction itself")
397DEFINE_BOOL(flush_optimized_code_cache, false,
398            "flushes the cache of optimized code for closures on every GC")
399DEFINE_BOOL(inline_construct, true, "inline constructor calls")
400DEFINE_BOOL(inline_arguments, true, "inline functions with arguments object")
401DEFINE_BOOL(inline_accessors, true, "inline JavaScript accessors")
402DEFINE_INT(escape_analysis_iterations, 2,
403           "maximum number of escape analysis fix-point iterations")
404
405DEFINE_BOOL(concurrent_recompilation, true,
406            "optimizing hot functions asynchronously on a separate thread")
407DEFINE_BOOL(trace_concurrent_recompilation, false,
408            "track concurrent recompilation")
409DEFINE_INT(concurrent_recompilation_queue_length, 8,
410           "the length of the concurrent compilation queue")
411DEFINE_INT(concurrent_recompilation_delay, 0,
412           "artificial compilation delay in ms")
413DEFINE_BOOL(block_concurrent_recompilation, false,
414            "block queued jobs until released")
415DEFINE_BOOL(concurrent_osr, false, "concurrent on-stack replacement")
416DEFINE_IMPLICATION(concurrent_osr, concurrent_recompilation)
417
418DEFINE_BOOL(omit_map_checks_for_leaf_maps, true,
419            "do not emit check maps for constant values that have a leaf map, "
420            "deoptimize the optimized code if the layout of the maps changes.")
421
422// Flags for TurboFan.
423DEFINE_BOOL(turbo, false, "enable TurboFan compiler")
424DEFINE_IMPLICATION(turbo, turbo_asm_deoptimization)
425DEFINE_BOOL(turbo_shipping, true, "enable TurboFan compiler on subset")
426DEFINE_BOOL(turbo_greedy_regalloc, false, "use the greedy register allocator")
427DEFINE_BOOL(turbo_sp_frame_access, false,
428            "use stack pointer-relative access to frame wherever possible")
429DEFINE_BOOL(turbo_preprocess_ranges, true,
430            "run pre-register allocation heuristics")
431DEFINE_BOOL(turbo_loop_stackcheck, true, "enable stack checks in loops")
432DEFINE_STRING(turbo_filter, "~~", "optimization filter for TurboFan compiler")
433DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
434DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs")
435DEFINE_IMPLICATION(trace_turbo_graph, trace_turbo)
436DEFINE_STRING(trace_turbo_cfg_file, NULL,
437              "trace turbo cfg graph (for C1 visualizer) to a given file name")
438DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types")
439DEFINE_BOOL(trace_turbo_scheduler, false, "trace TurboFan's scheduler")
440DEFINE_BOOL(trace_turbo_reduction, false, "trace TurboFan's various reducers")
441DEFINE_BOOL(trace_turbo_jt, false, "trace TurboFan's jump threading")
442DEFINE_BOOL(trace_turbo_ceq, false, "trace TurboFan's control equivalence")
443DEFINE_BOOL(turbo_asm, true, "enable TurboFan for asm.js code")
444DEFINE_BOOL(turbo_asm_deoptimization, false,
445            "enable deoptimization in TurboFan for asm.js code")
446DEFINE_BOOL(turbo_verify, DEBUG_BOOL, "verify TurboFan graphs at each phase")
447DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics")
448DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan")
449DEFINE_BOOL(turbo_types, true, "use typed lowering in TurboFan")
450DEFINE_BOOL(turbo_source_positions, false,
451            "track source code positions when building TurboFan IR")
452DEFINE_IMPLICATION(trace_turbo, turbo_source_positions)
453DEFINE_BOOL(function_context_specialization, false,
454            "enable function context specialization in TurboFan")
455DEFINE_BOOL(native_context_specialization, true,
456            "enable native context specialization in TurboFan")
457DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan")
458DEFINE_BOOL(trace_turbo_inlining, false, "trace TurboFan inlining")
459DEFINE_BOOL(loop_assignment_analysis, true, "perform loop assignment analysis")
460DEFINE_BOOL(turbo_profiling, false, "enable profiling in TurboFan")
461DEFINE_BOOL(turbo_verify_allocation, DEBUG_BOOL,
462            "verify register allocation in TurboFan")
463DEFINE_BOOL(turbo_move_optimization, true, "optimize gap moves in TurboFan")
464DEFINE_BOOL(turbo_jt, true, "enable jump threading in TurboFan")
465DEFINE_BOOL(turbo_osr, true, "enable OSR in TurboFan")
466DEFINE_BOOL(turbo_stress_loop_peeling, false,
467            "stress loop peeling optimization")
468DEFINE_BOOL(turbo_cf_optimization, true, "optimize control flow in TurboFan")
469DEFINE_BOOL(turbo_frame_elision, true, "elide frames in TurboFan")
470DEFINE_BOOL(turbo_cache_shared_code, true, "cache context-independent code")
471DEFINE_BOOL(turbo_preserve_shared_code, false, "keep context-independent code")
472DEFINE_BOOL(turbo_escape, false, "enable escape analysis")
473DEFINE_BOOL(turbo_instruction_scheduling, false,
474            "enable instruction scheduling in TurboFan")
475DEFINE_BOOL(turbo_stress_instruction_scheduling, false,
476            "randomly schedule instructions to stress dependency tracking")
477
478// Flags for native WebAssembly.
479DEFINE_BOOL(expose_wasm, false, "expose WASM interface to JavaScript")
480DEFINE_BOOL(trace_wasm_decoder, false, "trace decoding of wasm code")
481DEFINE_BOOL(trace_wasm_decode_time, false, "trace decoding time of wasm code")
482DEFINE_BOOL(trace_wasm_compiler, false, "trace compiling of wasm code")
483DEFINE_BOOL(trace_wasm_ast, false, "dump AST after WASM decode")
484DEFINE_BOOL(wasm_break_on_decoder_error, false,
485            "debug break when wasm decoder encounters an error")
486
487DEFINE_BOOL(enable_simd_asmjs, false, "enable SIMD.js in asm.js stdlib")
488
489DEFINE_BOOL(dump_asmjs_wasm, false, "dump Asm.js to WASM module bytes")
490DEFINE_STRING(asmjs_wasm_dumpfile, "asmjs.wasm",
491              "file to dump asm wasm conversion result to")
492
493DEFINE_INT(typed_array_max_size_in_heap, 64,
494           "threshold for in-heap typed array")
495
496// Profiler flags.
497DEFINE_INT(frame_count, 1, "number of stack frames inspected by the profiler")
498// 0x1800 fits in the immediate field of an ARM instruction.
499DEFINE_INT(interrupt_budget, 0x1800,
500           "execution budget before interrupt is triggered")
501DEFINE_INT(type_info_threshold, 25,
502           "percentage of ICs that must have type info to allow optimization")
503DEFINE_INT(generic_ic_threshold, 30,
504           "max percentage of megamorphic/generic ICs to allow optimization")
505DEFINE_INT(self_opt_count, 130, "call count before self-optimization")
506
507DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
508DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
509
510// assembler-ia32.cc / assembler-arm.cc / assembler-x64.cc
511DEFINE_BOOL(debug_code, false, "generate extra code (assertions) for debugging")
512DEFINE_BOOL(code_comments, false, "emit comments in code disassembly")
513DEFINE_BOOL(enable_sse3, true, "enable use of SSE3 instructions if available")
514DEFINE_BOOL(enable_sse4_1, true,
515            "enable use of SSE4.1 instructions if available")
516DEFINE_BOOL(enable_sahf, true,
517            "enable use of SAHF instruction if available (X64 only)")
518DEFINE_BOOL(enable_avx, true, "enable use of AVX instructions if available")
519DEFINE_BOOL(enable_fma3, true, "enable use of FMA3 instructions if available")
520DEFINE_BOOL(enable_bmi1, true, "enable use of BMI1 instructions if available")
521DEFINE_BOOL(enable_bmi2, true, "enable use of BMI2 instructions if available")
522DEFINE_BOOL(enable_lzcnt, true, "enable use of LZCNT instruction if available")
523DEFINE_BOOL(enable_popcnt, true,
524            "enable use of POPCNT instruction if available")
525DEFINE_BOOL(enable_vfp3, ENABLE_VFP3_DEFAULT,
526            "enable use of VFP3 instructions if available")
527DEFINE_BOOL(enable_armv7, ENABLE_ARMV7_DEFAULT,
528            "enable use of ARMv7 instructions if available (ARM only)")
529DEFINE_BOOL(enable_armv8, ENABLE_ARMV8_DEFAULT,
530            "enable use of ARMv8 instructions if available (ARM 32-bit only)")
531DEFINE_BOOL(enable_neon, ENABLE_NEON_DEFAULT,
532            "enable use of NEON instructions if available (ARM only)")
533DEFINE_BOOL(enable_sudiv, true,
534            "enable use of SDIV and UDIV instructions if available (ARM only)")
535DEFINE_BOOL(enable_mls, true,
536            "enable use of MLS instructions if available (ARM only)")
537DEFINE_BOOL(enable_movw_movt, false,
538            "enable loading 32-bit constant by means of movw/movt "
539            "instruction pairs (ARM only)")
540DEFINE_BOOL(enable_unaligned_accesses, true,
541            "enable unaligned accesses for ARMv7 (ARM only)")
542DEFINE_BOOL(enable_32dregs, ENABLE_32DREGS_DEFAULT,
543            "enable use of d16-d31 registers on ARM - this requires VFP3")
544DEFINE_BOOL(enable_vldr_imm, false,
545            "enable use of constant pools for double immediate (ARM only)")
546DEFINE_BOOL(force_long_branches, false,
547            "force all emitted branches to be in long mode (MIPS/PPC only)")
548DEFINE_STRING(mcpu, "auto", "enable optimization for specific cpu")
549
550DEFINE_IMPLICATION(enable_armv8, enable_vfp3)
551DEFINE_IMPLICATION(enable_armv8, enable_neon)
552DEFINE_IMPLICATION(enable_armv8, enable_32dregs)
553DEFINE_IMPLICATION(enable_armv8, enable_sudiv)
554DEFINE_IMPLICATION(enable_armv8, enable_mls)
555
556// bootstrapper.cc
557DEFINE_STRING(expose_natives_as, NULL, "expose natives in global object")
558DEFINE_STRING(expose_debug_as, NULL, "expose debug in global object")
559DEFINE_BOOL(expose_free_buffer, false, "expose freeBuffer extension")
560DEFINE_BOOL(expose_gc, false, "expose gc extension")
561DEFINE_STRING(expose_gc_as, NULL,
562              "expose gc extension under the specified name")
563DEFINE_IMPLICATION(expose_gc_as, expose_gc)
564DEFINE_BOOL(expose_externalize_string, false,
565            "expose externalize string extension")
566DEFINE_BOOL(expose_trigger_failure, false, "expose trigger-failure extension")
567DEFINE_INT(stack_trace_limit, 10, "number of stack frames to capture")
568DEFINE_BOOL(builtins_in_stack_traces, false,
569            "show built-in functions in stack traces")
570DEFINE_BOOL(disable_native_files, false, "disable builtin natives files")
571
572// builtins-ia32.cc
573DEFINE_BOOL(inline_new, true, "use fast inline allocation")
574
575// codegen-ia32.cc / codegen-arm.cc
576DEFINE_BOOL(trace_codegen, false,
577            "print name of functions for which code is generated")
578DEFINE_BOOL(trace, false, "trace function calls")
579DEFINE_BOOL(mask_constants_with_cookie, true,
580            "use random jit cookie to mask large constants")
581
582// codegen.cc
583DEFINE_BOOL(lazy, true, "use lazy compilation")
584DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
585DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics")
586DEFINE_BOOL(opt, true, "use adaptive optimizations")
587DEFINE_BOOL(always_opt, false, "always try to optimize functions")
588DEFINE_BOOL(always_osr, false, "always try to OSR functions")
589DEFINE_BOOL(prepare_always_opt, false, "prepare for turning on always opt")
590DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
591DEFINE_BOOL(trace_stub_failures, false,
592            "trace deoptimization of generated code stubs")
593
594DEFINE_BOOL(serialize_toplevel, true, "enable caching of toplevel scripts")
595DEFINE_BOOL(trace_serializer, false, "print code serializer trace")
596
597// compiler.cc
598DEFINE_INT(min_preparse_length, 1024,
599           "minimum length for automatic enable preparsing")
600DEFINE_INT(max_opt_count, 10,
601           "maximum number of optimization attempts before giving up.")
602
603// compilation-cache.cc
604DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
605
606DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
607
608// cpu-profiler.cc
609DEFINE_INT(cpu_profiler_sampling_interval, 1000,
610           "CPU profiler sampling interval in microseconds")
611
612// Array abuse tracing
613DEFINE_BOOL(trace_js_array_abuse, false,
614            "trace out-of-bounds accesses to JS arrays")
615DEFINE_BOOL(trace_external_array_abuse, false,
616            "trace out-of-bounds-accesses to external arrays")
617DEFINE_BOOL(trace_array_abuse, false,
618            "trace out-of-bounds accesses to all arrays")
619DEFINE_IMPLICATION(trace_array_abuse, trace_js_array_abuse)
620DEFINE_IMPLICATION(trace_array_abuse, trace_external_array_abuse)
621
622// debugger
623DEFINE_BOOL(debug_eval_readonly_locals, true,
624            "do not update locals after debug-evaluate")
625DEFINE_BOOL(trace_debug_json, false, "trace debugging JSON request/response")
626DEFINE_BOOL(enable_liveedit, true, "enable liveedit experimental feature")
627DEFINE_BOOL(hard_abort, true, "abort by crashing")
628
629// execution.cc
630DEFINE_INT(stack_size, V8_DEFAULT_STACK_SIZE_KB,
631           "default size of stack region v8 is allowed to use (in kBytes)")
632
633// frames.cc
634DEFINE_INT(max_stack_trace_source_length, 300,
635           "maximum length of function source code printed in a stack trace.")
636
637// full-codegen.cc
638DEFINE_BOOL(always_inline_smi_code, false,
639            "always inline smi code in non-opt code")
640DEFINE_BOOL(verify_operand_stack_depth, false,
641            "emit debug code that verifies the static tracking of the operand "
642            "stack depth")
643
644// heap.cc
645DEFINE_INT(min_semi_space_size, 0,
646           "min size of a semi-space (in MBytes), the new space consists of two"
647           "semi-spaces")
648DEFINE_INT(max_semi_space_size, 0,
649           "max size of a semi-space (in MBytes), the new space consists of two"
650           "semi-spaces")
651DEFINE_INT(semi_space_growth_factor, 2, "factor by which to grow the new space")
652DEFINE_BOOL(experimental_new_space_growth_heuristic, false,
653            "Grow the new space based on the percentage of survivors instead "
654            "of their absolute value.")
655DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
656DEFINE_INT(initial_old_space_size, 0, "initial old space size (in Mbytes)")
657DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)")
658DEFINE_BOOL(gc_global, false, "always perform global GCs")
659DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
660DEFINE_INT(retain_maps_for_n_gc, 2,
661           "keeps maps alive for <n> old space garbage collections")
662DEFINE_BOOL(trace_gc, false,
663            "print one trace line following each garbage collection")
664DEFINE_BOOL(trace_gc_nvp, false,
665            "print one detailed trace line in name=value format "
666            "after each garbage collection")
667DEFINE_BOOL(trace_gc_ignore_scavenger, false,
668            "do not print trace line after scavenger collection")
669DEFINE_BOOL(trace_idle_notification, false,
670            "print one trace line following each idle notification")
671DEFINE_BOOL(trace_idle_notification_verbose, false,
672            "prints the heap state used by the idle notification")
673DEFINE_BOOL(print_cumulative_gc_stat, false,
674            "print cumulative GC statistics in name=value format on exit")
675DEFINE_BOOL(print_max_heap_committed, false,
676            "print statistics of the maximum memory committed for the heap "
677            "in name=value format on exit")
678DEFINE_BOOL(trace_gc_verbose, false,
679            "print more details following each garbage collection")
680DEFINE_INT(trace_allocation_stack_interval, -1,
681           "print stack trace after <n> free-list allocations")
682DEFINE_BOOL(trace_fragmentation, false, "report fragmentation for old space")
683DEFINE_BOOL(trace_fragmentation_verbose, false,
684            "report fragmentation for old space (detailed)")
685DEFINE_BOOL(trace_mutator_utilization, false,
686            "print mutator utilization, allocation speed, gc speed")
687DEFINE_BOOL(weak_embedded_maps_in_optimized_code, true,
688            "make maps embedded in optimized code weak")
689DEFINE_BOOL(weak_embedded_objects_in_optimized_code, true,
690            "make objects embedded in optimized code weak")
691DEFINE_BOOL(flush_code, true, "flush code that we expect not to use again")
692DEFINE_BOOL(trace_code_flushing, false, "trace code flushing progress")
693DEFINE_BOOL(age_code, true,
694            "track un-executed functions to age code and flush only "
695            "old code (required for code flushing)")
696DEFINE_BOOL(incremental_marking, true, "use incremental marking")
697DEFINE_INT(min_progress_during_incremental_marking_finalization, 32,
698           "keep finalizing incremental marking as long as we discover at "
699           "least this many unmarked objects")
700DEFINE_INT(max_incremental_marking_finalization_rounds, 3,
701           "at most try this many times to finalize incremental marking")
702DEFINE_BOOL(concurrent_sweeping, true, "use concurrent sweeping")
703DEFINE_BOOL(parallel_compaction, true, "use parallel compaction")
704DEFINE_BOOL(trace_incremental_marking, false,
705            "trace progress of the incremental marking")
706DEFINE_BOOL(track_gc_object_stats, false,
707            "track object counts and memory usage")
708DEFINE_BOOL(trace_gc_object_stats, false,
709            "trace object counts and memory usage")
710DEFINE_IMPLICATION(trace_gc_object_stats, track_gc_object_stats)
711DEFINE_BOOL(track_detached_contexts, true,
712            "track native contexts that are expected to be garbage collected")
713DEFINE_BOOL(trace_detached_contexts, false,
714            "trace native contexts that are expected to be garbage collected")
715DEFINE_IMPLICATION(trace_detached_contexts, track_detached_contexts)
716#ifdef VERIFY_HEAP
717DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC")
718#endif
719DEFINE_BOOL(move_object_start, true, "enable moving of object starts")
720DEFINE_BOOL(memory_reducer, true, "use memory reducer")
721DEFINE_BOOL(scavenge_reclaim_unmodified_objects, false,
722            "remove unmodified and unreferenced objects")
723DEFINE_INT(heap_growing_percent, 0,
724           "specifies heap growing factor as (1 + heap_growing_percent/100)")
725
726// counters.cc
727DEFINE_INT(histogram_interval, 600000,
728           "time interval in ms for aggregating memory histograms")
729
730
731// heap-snapshot-generator.cc
732DEFINE_BOOL(heap_profiler_trace_objects, false,
733            "Dump heap object allocations/movements/size_updates")
734
735
736// sampling-heap-profiler.cc
737DEFINE_BOOL(sampling_heap_profiler_suppress_randomness, false,
738            "Use constant sample intervals to eliminate test flakiness")
739
740
741// v8.cc
742DEFINE_BOOL(use_idle_notification, true,
743            "Use idle notification to reduce memory footprint.")
744// ic.cc
745DEFINE_BOOL(use_ic, true, "use inline caching")
746DEFINE_BOOL(trace_ic, false, "trace inline cache state transitions")
747
748// macro-assembler-ia32.cc
749DEFINE_BOOL(native_code_counters, false,
750            "generate extra code for manipulating stats counters")
751
752// mark-compact.cc
753DEFINE_BOOL(always_compact, false, "Perform compaction on every full GC")
754DEFINE_BOOL(never_compact, false,
755            "Never perform compaction on full GC - testing only")
756DEFINE_BOOL(compact_code_space, true, "Compact code space on full collections")
757DEFINE_BOOL(cleanup_code_caches_at_gc, true,
758            "Flush inline caches prior to mark compact collection and "
759            "flush code caches in maps during mark compact cycle.")
760DEFINE_BOOL(use_marking_progress_bar, true,
761            "Use a progress bar to scan large objects in increments when "
762            "incremental marking is active.")
763DEFINE_BOOL(zap_code_space, DEBUG_BOOL,
764            "Zap free memory in code space with 0xCC while sweeping.")
765DEFINE_INT(random_seed, 0,
766           "Default seed for initializing random generator "
767           "(0, the default, means to use system random).")
768
769// objects.cc
770DEFINE_BOOL(trace_weak_arrays, false, "Trace WeakFixedArray usage")
771DEFINE_BOOL(track_prototype_users, false,
772            "Keep track of which maps refer to a given prototype object")
773DEFINE_BOOL(trace_prototype_users, false,
774            "Trace updates to prototype user tracking")
775DEFINE_BOOL(eliminate_prototype_chain_checks, true,
776            "Collapse prototype chain checks into single-cell checks")
777DEFINE_IMPLICATION(eliminate_prototype_chain_checks, track_prototype_users)
778DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
779#if TRACE_MAPS
780DEFINE_BOOL(trace_maps, false, "trace map creation")
781#endif
782
783// parser.cc
784DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
785DEFINE_BOOL(trace_parse, false, "trace parsing and preparsing")
786
787// simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
788DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
789DEFINE_BOOL(debug_sim, false, "Enable debugging the simulator")
790DEFINE_BOOL(check_icache, false,
791            "Check icache flushes in ARM and MIPS simulator")
792DEFINE_INT(stop_sim_at, 0, "Simulator stop after x number of instructions")
793#if defined(V8_TARGET_ARCH_ARM64) || defined(V8_TARGET_ARCH_MIPS64) || \
794    defined(V8_TARGET_ARCH_PPC64)
795DEFINE_INT(sim_stack_alignment, 16,
796           "Stack alignment in bytes in simulator. This must be a power of two "
797           "and it must be at least 16. 16 is default.")
798#else
799DEFINE_INT(sim_stack_alignment, 8,
800           "Stack alingment in bytes in simulator (4 or 8, 8 is default)")
801#endif
802DEFINE_INT(sim_stack_size, 2 * MB / KB,
803           "Stack size of the ARM64, MIPS64 and PPC64 simulator "
804           "in kBytes (default is 2 MB)")
805DEFINE_BOOL(log_regs_modified, true,
806            "When logging register values, only print modified registers.")
807DEFINE_BOOL(log_colour, ENABLE_LOG_COLOUR,
808            "When logging, try to use coloured output.")
809DEFINE_BOOL(ignore_asm_unimplemented_break, false,
810            "Don't break for ASM_UNIMPLEMENTED_BREAK macros.")
811DEFINE_BOOL(trace_sim_messages, false,
812            "Trace simulator debug messages. Implied by --trace-sim.")
813
814// isolate.cc
815DEFINE_BOOL(stack_trace_on_illegal, false,
816            "print stack trace when an illegal exception is thrown")
817DEFINE_BOOL(abort_on_uncaught_exception, false,
818            "abort program (dump core) when an uncaught exception is thrown")
819DEFINE_BOOL(randomize_hashes, true,
820            "randomize hashes to avoid predictable hash collisions "
821            "(with snapshots this option cannot override the baked-in seed)")
822DEFINE_INT(hash_seed, 0,
823           "Fixed seed to use to hash property keys (0 means random)"
824           "(with snapshots this option cannot override the baked-in seed)")
825
826// runtime.cc
827DEFINE_BOOL(runtime_call_stats, false, "report runtime call counts and times")
828
829// snapshot-common.cc
830DEFINE_BOOL(profile_deserialization, false,
831            "Print the time it takes to deserialize the snapshot.")
832DEFINE_BOOL(serialization_statistics, false,
833            "Collect statistics on serialized objects.")
834
835// Regexp
836DEFINE_BOOL(regexp_optimization, true, "generate optimized regexp code")
837
838// Testing flags test/cctest/test-{flags,api,serialization}.cc
839DEFINE_BOOL(testing_bool_flag, true, "testing_bool_flag")
840DEFINE_MAYBE_BOOL(testing_maybe_bool_flag, "testing_maybe_bool_flag")
841DEFINE_INT(testing_int_flag, 13, "testing_int_flag")
842DEFINE_FLOAT(testing_float_flag, 2.5, "float-flag")
843DEFINE_STRING(testing_string_flag, "Hello, world!", "string-flag")
844DEFINE_INT(testing_prng_seed, 42, "Seed used for threading test randomness")
845#ifdef _WIN32
846DEFINE_STRING(testing_serialization_file, "C:\\Windows\\Temp\\serdes",
847              "file in which to testing_serialize heap")
848#else
849DEFINE_STRING(testing_serialization_file, "/tmp/serdes",
850              "file in which to serialize heap")
851#endif
852
853// mksnapshot.cc
854DEFINE_STRING(startup_src, NULL,
855              "Write V8 startup as C++ src. (mksnapshot only)")
856DEFINE_STRING(startup_blob, NULL,
857              "Write V8 startup blob file. (mksnapshot only)")
858
859// code-stubs-hydrogen.cc
860DEFINE_BOOL(profile_hydrogen_code_stub_compilation, false,
861            "Print the time it takes to lazily compile hydrogen code stubs.")
862
863DEFINE_BOOL(predictable, false, "enable predictable mode")
864DEFINE_NEG_IMPLICATION(predictable, concurrent_recompilation)
865DEFINE_NEG_IMPLICATION(predictable, concurrent_osr)
866DEFINE_NEG_IMPLICATION(predictable, concurrent_sweeping)
867DEFINE_NEG_IMPLICATION(predictable, parallel_compaction)
868DEFINE_NEG_IMPLICATION(predictable, memory_reducer)
869
870// mark-compact.cc
871DEFINE_BOOL(force_marking_deque_overflows, false,
872            "force overflows of marking deque by reducing it's size "
873            "to 64 words")
874
875DEFINE_BOOL(stress_compaction, false,
876            "stress the GC compactor to flush out bugs (implies "
877            "--force_marking_deque_overflows)")
878
879DEFINE_BOOL(manual_evacuation_candidates_selection, false,
880            "Test mode only flag. It allows an unit test to select evacuation "
881            "candidates pages (requires --stress_compaction).")
882
883// api.cc
884DEFINE_INT(external_allocation_limit_incremental_time, 1,
885           "Time spent in incremental marking steps (in ms) once the external "
886           "allocation limit is reached")
887
888DEFINE_BOOL(disable_old_api_accessors, false,
889            "Disable old-style API accessors whose setters trigger through the "
890            "prototype chain")
891
892//
893// Dev shell flags
894//
895
896DEFINE_BOOL(help, false, "Print usage message, including flags, on console")
897DEFINE_BOOL(dump_counters, false, "Dump counters on exit")
898
899DEFINE_STRING(map_counters, "", "Map counters to a file")
900DEFINE_ARGS(js_arguments,
901            "Pass all remaining arguments to the script. Alias for \"--\".")
902
903//
904// GDB JIT integration flags.
905//
906#undef FLAG
907#ifdef ENABLE_GDB_JIT_INTERFACE
908#define FLAG FLAG_FULL
909#else
910#define FLAG FLAG_READONLY
911#endif
912
913DEFINE_BOOL(gdbjit, false, "enable GDBJIT interface")
914DEFINE_BOOL(gdbjit_full, false, "enable GDBJIT interface for all code objects")
915DEFINE_BOOL(gdbjit_dump, false, "dump elf objects with debug info to disk")
916DEFINE_STRING(gdbjit_dump_filter, "",
917              "dump only objects containing this substring")
918
919#ifdef ENABLE_GDB_JIT_INTERFACE
920DEFINE_IMPLICATION(gdbjit_full, gdbjit)
921DEFINE_IMPLICATION(gdbjit_dump, gdbjit)
922#endif
923DEFINE_NEG_IMPLICATION(gdbjit, compact_code_space)
924
925//
926// Debug only flags
927//
928#undef FLAG
929#ifdef DEBUG
930#define FLAG FLAG_FULL
931#else
932#define FLAG FLAG_READONLY
933#endif
934
935// checks.cc
936#ifdef ENABLE_SLOW_DCHECKS
937DEFINE_BOOL(enable_slow_asserts, false,
938            "enable asserts that are slow to execute")
939#endif
940
941// codegen-ia32.cc / codegen-arm.cc / macro-assembler-*.cc
942DEFINE_BOOL(print_source, false, "pretty print source code")
943DEFINE_BOOL(print_builtin_source, false,
944            "pretty print source code for builtins")
945DEFINE_BOOL(print_ast, false, "print source AST")
946DEFINE_BOOL(print_builtin_ast, false, "print source AST for builtins")
947DEFINE_BOOL(trap_on_abort, false, "replace aborts by breakpoints")
948
949// compiler.cc
950DEFINE_BOOL(print_builtin_scopes, false, "print scopes for builtins")
951DEFINE_BOOL(print_scopes, false, "print scopes")
952
953// contexts.cc
954DEFINE_BOOL(trace_contexts, false, "trace contexts operations")
955
956// heap.cc
957DEFINE_BOOL(gc_verbose, false, "print stuff during garbage collection")
958DEFINE_BOOL(heap_stats, false, "report heap statistics before and after GC")
959DEFINE_BOOL(code_stats, false, "report code statistics after GC")
960DEFINE_BOOL(print_handles, false, "report handles after GC")
961DEFINE_BOOL(check_handle_count, false,
962            "Check that there are not too many handles at GC")
963DEFINE_BOOL(print_global_handles, false, "report global handles after GC")
964
965// TurboFan debug-only flags.
966DEFINE_BOOL(print_turbo_replay, false,
967            "print C++ code to recreate TurboFan graphs")
968DEFINE_BOOL(trace_turbo_escape, false, "enable tracing in escape analysis")
969
970// objects.cc
971DEFINE_BOOL(trace_normalization, false,
972            "prints when objects are turned into dictionaries.")
973
974// runtime.cc
975DEFINE_BOOL(trace_lazy, false, "trace lazy compilation")
976
977// spaces.cc
978DEFINE_BOOL(collect_heap_spill_statistics, false,
979            "report heap spill statistics along with heap_stats "
980            "(requires heap_stats)")
981DEFINE_BOOL(trace_live_bytes, false,
982            "trace incrementing and resetting of live bytes")
983
984DEFINE_BOOL(trace_isolates, false, "trace isolate state changes")
985
986// Regexp
987DEFINE_BOOL(regexp_possessive_quantifier, false,
988            "enable possessive quantifier syntax for testing")
989DEFINE_BOOL(trace_regexp_bytecodes, false, "trace regexp bytecode execution")
990DEFINE_BOOL(trace_regexp_assembler, false,
991            "trace regexp macro assembler calls.")
992DEFINE_BOOL(trace_regexp_parser, false, "trace regexp parsing")
993
994//
995// Logging and profiling flags
996//
997#undef FLAG
998#define FLAG FLAG_FULL
999
1000// log.cc
1001DEFINE_BOOL(log, false,
1002            "Minimal logging (no API, code, GC, suspect, or handles samples).")
1003DEFINE_BOOL(log_all, false, "Log all events to the log file.")
1004DEFINE_BOOL(log_api, false, "Log API events to the log file.")
1005DEFINE_BOOL(log_code, false,
1006            "Log code events to the log file without profiling.")
1007DEFINE_BOOL(log_gc, false,
1008            "Log heap samples on garbage collection for the hp2ps tool.")
1009DEFINE_BOOL(log_handles, false, "Log global handle events.")
1010DEFINE_BOOL(log_snapshot_positions, false,
1011            "log positions of (de)serialized objects in the snapshot.")
1012DEFINE_BOOL(log_suspect, false, "Log suspect operations.")
1013DEFINE_BOOL(prof, false,
1014            "Log statistical profiling information (implies --log-code).")
1015DEFINE_BOOL(prof_cpp, false, "Like --prof, but ignore generated code.")
1016DEFINE_IMPLICATION(prof, prof_cpp)
1017DEFINE_BOOL(prof_browser_mode, true,
1018            "Used with --prof, turns on browser-compatible mode for profiling.")
1019DEFINE_BOOL(log_regexp, false, "Log regular expression execution.")
1020DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
1021DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
1022DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
1023DEFINE_BOOL(perf_basic_prof, false,
1024            "Enable perf linux profiler (basic support).")
1025DEFINE_NEG_IMPLICATION(perf_basic_prof, compact_code_space)
1026DEFINE_BOOL(perf_basic_prof_only_functions, false,
1027            "Only report function code ranges to perf (i.e. no stubs).")
1028DEFINE_IMPLICATION(perf_basic_prof_only_functions, perf_basic_prof)
1029DEFINE_STRING(gc_fake_mmap, "/tmp/__v8_gc__",
1030              "Specify the name of the file for fake gc mmap used in ll_prof")
1031DEFINE_BOOL(log_internal_timer_events, false, "Time internal events.")
1032DEFINE_BOOL(log_timer_events, false,
1033            "Time events including external callbacks.")
1034DEFINE_IMPLICATION(log_timer_events, log_internal_timer_events)
1035DEFINE_IMPLICATION(log_internal_timer_events, prof)
1036DEFINE_BOOL(log_instruction_stats, false, "Log AArch64 instruction statistics.")
1037DEFINE_STRING(log_instruction_file, "arm64_inst.csv",
1038              "AArch64 instruction statistics log file.")
1039DEFINE_INT(log_instruction_period, 1 << 22,
1040           "AArch64 instruction statistics logging period.")
1041
1042DEFINE_BOOL(redirect_code_traces, false,
1043            "output deopt information and disassembly into file "
1044            "code-<pid>-<isolate id>.asm")
1045DEFINE_STRING(redirect_code_traces_to, NULL,
1046              "output deopt information and disassembly into the given file")
1047
1048DEFINE_BOOL(hydrogen_track_positions, false,
1049            "track source code positions when building IR")
1050
1051//
1052// Disassembler only flags
1053//
1054#undef FLAG
1055#ifdef ENABLE_DISASSEMBLER
1056#define FLAG FLAG_FULL
1057#else
1058#define FLAG FLAG_READONLY
1059#endif
1060
1061// elements.cc
1062DEFINE_BOOL(trace_elements_transitions, false, "trace elements transitions")
1063
1064DEFINE_BOOL(trace_creation_allocation_sites, false,
1065            "trace the creation of allocation sites")
1066
1067// code-stubs.cc
1068DEFINE_BOOL(print_code_stubs, false, "print code stubs")
1069DEFINE_BOOL(test_secondary_stub_cache, false,
1070            "test secondary stub cache by disabling the primary one")
1071
1072DEFINE_BOOL(test_primary_stub_cache, false,
1073            "test primary stub cache by disabling the secondary one")
1074
1075
1076// codegen-ia32.cc / codegen-arm.cc
1077DEFINE_BOOL(print_code, false, "print generated code")
1078DEFINE_BOOL(print_opt_code, false, "print optimized code")
1079DEFINE_BOOL(print_unopt_code, false,
1080            "print unoptimized code before "
1081            "printing optimized code based on it")
1082DEFINE_BOOL(print_code_verbose, false, "print more information for code")
1083DEFINE_BOOL(print_builtin_code, false, "print generated code for builtins")
1084
1085#ifdef ENABLE_DISASSEMBLER
1086DEFINE_BOOL(sodium, false,
1087            "print generated code output suitable for use with "
1088            "the Sodium code viewer")
1089
1090DEFINE_IMPLICATION(sodium, print_code_stubs)
1091DEFINE_IMPLICATION(sodium, print_code)
1092DEFINE_IMPLICATION(sodium, print_opt_code)
1093DEFINE_IMPLICATION(sodium, hydrogen_track_positions)
1094DEFINE_IMPLICATION(sodium, code_comments)
1095
1096DEFINE_BOOL(print_all_code, false, "enable all flags related to printing code")
1097DEFINE_IMPLICATION(print_all_code, print_code)
1098DEFINE_IMPLICATION(print_all_code, print_opt_code)
1099DEFINE_IMPLICATION(print_all_code, print_unopt_code)
1100DEFINE_IMPLICATION(print_all_code, print_code_verbose)
1101DEFINE_IMPLICATION(print_all_code, print_builtin_code)
1102DEFINE_IMPLICATION(print_all_code, print_code_stubs)
1103DEFINE_IMPLICATION(print_all_code, code_comments)
1104#ifdef DEBUG
1105DEFINE_IMPLICATION(print_all_code, trace_codegen)
1106#endif
1107#endif
1108
1109
1110//
1111// VERIFY_PREDICTABLE related flags
1112//
1113#undef FLAG
1114
1115#ifdef VERIFY_PREDICTABLE
1116#define FLAG FLAG_FULL
1117#else
1118#define FLAG FLAG_READONLY
1119#endif
1120
1121DEFINE_BOOL(verify_predictable, false,
1122            "this mode is used for checking that V8 behaves predictably")
1123DEFINE_INT(dump_allocations_digest_at_alloc, -1,
1124           "dump allocations digest each n-th allocation")
1125
1126
1127//
1128// Read-only flags
1129//
1130#undef FLAG
1131#define FLAG FLAG_READONLY
1132
1133// assembler.h
1134DEFINE_BOOL(enable_embedded_constant_pool, V8_EMBEDDED_CONSTANT_POOL,
1135            "enable use of embedded constant pools (ARM/PPC only)")
1136
1137DEFINE_BOOL(unbox_double_fields, V8_DOUBLE_FIELDS_UNBOXING,
1138            "enable in-object double fields unboxing (64-bit only)")
1139DEFINE_IMPLICATION(unbox_double_fields, track_double_fields)
1140
1141DEFINE_BOOL(global_var_shortcuts, false, "use ic-less global loads and stores")
1142
1143
1144// Cleanup...
1145#undef FLAG_FULL
1146#undef FLAG_READONLY
1147#undef FLAG
1148#undef FLAG_ALIAS
1149
1150#undef DEFINE_BOOL
1151#undef DEFINE_MAYBE_BOOL
1152#undef DEFINE_INT
1153#undef DEFINE_STRING
1154#undef DEFINE_FLOAT
1155#undef DEFINE_ARGS
1156#undef DEFINE_IMPLICATION
1157#undef DEFINE_NEG_IMPLICATION
1158#undef DEFINE_NEG_VALUE_IMPLICATION
1159#undef DEFINE_VALUE_IMPLICATION
1160#undef DEFINE_ALIAS_BOOL
1161#undef DEFINE_ALIAS_INT
1162#undef DEFINE_ALIAS_STRING
1163#undef DEFINE_ALIAS_FLOAT
1164#undef DEFINE_ALIAS_ARGS
1165
1166#undef FLAG_MODE_DECLARE
1167#undef FLAG_MODE_DEFINE
1168#undef FLAG_MODE_DEFINE_DEFAULTS
1169#undef FLAG_MODE_META
1170#undef FLAG_MODE_DEFINE_IMPLICATIONS
1171
1172#undef COMMA
1173