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