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.
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 ';'.
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:
13 // We want to declare the names of the variables for the header file. Normally
14 // this will just be an extern declaration, but for a readonly flag we let the
15 // compiler make better optimizations by giving it the value.
16 #if defined(FLAG_MODE_DECLARE)
17 #define FLAG_FULL(ftype, ctype, nam, def, cmt) extern ctype FLAG_##nam;
18 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \
19 static ctype const FLAG_##nam = def;
21 // We want to supply the actual storage and value for the flag variable in the
22 // .cc file. We only do this for writable flags.
23 #elif defined(FLAG_MODE_DEFINE)
24 #define FLAG_FULL(ftype, ctype, nam, def, cmt) ctype FLAG_##nam = def;
26 // We need to define all of our default values so that the Flag structure can
27 // access them by pointer. These are just used internally inside of one .cc,
28 // for MODE_META, so there is no impact on the flags interface.
29 #elif defined(FLAG_MODE_DEFINE_DEFAULTS)
30 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \
31 static ctype const FLAGDEFAULT_##nam = def;
33 // We want to write entries into our meta data table, for internal parsing and
34 // printing / etc in the flag parser code. We only do this for writable flags.
35 #elif defined(FLAG_MODE_META)
36 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \
37 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false } \
39 #define FLAG_ALIAS(ftype, ctype, alias, nam) \
41 Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \
42 "alias for --" #nam, false \
46 // We produce the code to set flags when it is implied by another flag.
47 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS)
48 #define DEFINE_IMPLICATION(whenflag, thenflag) \
49 if (FLAG_##whenflag) FLAG_##thenflag = true;
51 #define DEFINE_NEG_IMPLICATION(whenflag, thenflag) \
52 if (FLAG_##whenflag) FLAG_##thenflag = false;
55 #error No mode supplied when including flags.defs
58 // Dummy defines for modes where it is not relevant.
60 #define FLAG_FULL(ftype, ctype, nam, def, cmt)
64 #define FLAG_READONLY(ftype, ctype, nam, def, cmt)
68 #define FLAG_ALIAS(ftype, ctype, alias, nam)
71 #ifndef DEFINE_IMPLICATION
72 #define DEFINE_IMPLICATION(whenflag, thenflag)
75 #ifndef DEFINE_NEG_IMPLICATION
76 #define DEFINE_NEG_IMPLICATION(whenflag, thenflag)
81 #ifdef FLAG_MODE_DECLARE
82 // Structure used to hold a collection of arguments to the JavaScript code.
85 inline const char*& operator[](int idx) const { return argv[idx]; }
86 static JSArguments Create(int argc, const char** argv) {
96 struct MaybeBoolFlag {
97 static MaybeBoolFlag Create(bool has_value, bool value) {
99 flag.has_value = has_value;
108 #if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
109 #define ENABLE_VFP3_DEFAULT true
111 #define ENABLE_VFP3_DEFAULT false
113 #if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
114 #define ENABLE_ARMV7_DEFAULT true
116 #define ENABLE_ARMV7_DEFAULT false
118 #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
119 #define ENABLE_32DREGS_DEFAULT true
121 #define ENABLE_32DREGS_DEFAULT false
123 #if (defined CAN_USE_NEON) || !(defined ARM_TEST_NO_FEATURE_PROBE)
124 # define ENABLE_NEON_DEFAULT true
126 # define ENABLE_NEON_DEFAULT false
129 #define DEFINE_BOOL(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
130 #define DEFINE_MAYBE_BOOL(nam, cmt) \
131 FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, {false COMMA false}, cmt)
132 #define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
133 #define DEFINE_FLOAT(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
134 #define DEFINE_STRING(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
135 #define DEFINE_ARGS(nam, cmt) FLAG(ARGS, JSArguments, nam, {0 COMMA NULL}, cmt)
137 #define DEFINE_ALIAS_BOOL(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam)
138 #define DEFINE_ALIAS_INT(alias, nam) FLAG_ALIAS(INT, int, alias, nam)
139 #define DEFINE_ALIAS_FLOAT(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam)
140 #define DEFINE_ALIAS_STRING(alias, nam) \
141 FLAG_ALIAS(STRING, const char*, alias, nam)
142 #define DEFINE_ALIAS_ARGS(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam)
145 // Flags in all modes.
147 #define FLAG FLAG_FULL
149 // Flags for language modes and experimental language features.
150 DEFINE_BOOL(use_strict, false, "enforce strict mode")
151 DEFINE_BOOL(es_staging, false, "enable upcoming ES6+ features")
153 DEFINE_BOOL(harmony_scoping, false, "enable harmony block scoping")
154 DEFINE_BOOL(harmony_modules, false,
155 "enable harmony modules (implies block scoping)")
156 DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies")
157 DEFINE_BOOL(harmony_generators, false, "enable harmony generators")
158 DEFINE_BOOL(harmony_numeric_literals, false,
159 "enable harmony numeric literals (0o77, 0b11)")
160 DEFINE_BOOL(harmony_strings, false, "enable harmony string")
161 DEFINE_BOOL(harmony_arrays, false, "enable harmony arrays")
162 DEFINE_BOOL(harmony_arrow_functions, false, "enable harmony arrow functions")
163 DEFINE_BOOL(harmony, false, "enable all harmony features (except proxies)")
165 DEFINE_IMPLICATION(harmony, harmony_scoping)
166 DEFINE_IMPLICATION(harmony, harmony_modules)
167 // TODO(rossberg): Reenable when problems are sorted out.
168 // DEFINE_IMPLICATION(harmony, harmony_proxies)
169 DEFINE_IMPLICATION(harmony, harmony_generators)
170 DEFINE_IMPLICATION(harmony, harmony_numeric_literals)
171 DEFINE_IMPLICATION(harmony, harmony_strings)
172 DEFINE_IMPLICATION(harmony, harmony_arrays)
173 DEFINE_IMPLICATION(harmony, harmony_arrow_functions)
174 DEFINE_IMPLICATION(harmony_modules, harmony_scoping)
176 DEFINE_IMPLICATION(harmony, es_staging)
178 // Flags for experimental implementation features.
179 DEFINE_BOOL(compiled_keyed_dictionary_loads, true,
180 "use optimizing compiler to generate keyed dictionary load stubs")
181 DEFINE_BOOL(compiled_keyed_generic_loads, false,
182 "use optimizing compiler to generate keyed generic load stubs")
183 DEFINE_BOOL(clever_optimizations, true,
184 "Optimize object size, Array shift, DOM strings and string +")
185 // TODO(hpayer): We will remove this flag as soon as we have pretenuring
186 // support for specific allocation sites.
187 DEFINE_BOOL(pretenuring_call_new, false, "pretenure call new")
188 DEFINE_BOOL(allocation_site_pretenuring, true,
189 "pretenure with allocation sites")
190 DEFINE_BOOL(trace_pretenuring, false,
191 "trace pretenuring decisions of HAllocate instructions")
192 DEFINE_BOOL(trace_pretenuring_statistics, false,
193 "trace allocation site pretenuring statistics")
194 DEFINE_BOOL(track_fields, true, "track fields with only smi values")
195 DEFINE_BOOL(track_double_fields, true, "track fields with double values")
196 DEFINE_BOOL(track_heap_object_fields, true, "track fields with heap values")
197 DEFINE_BOOL(track_computed_fields, true, "track computed boilerplate fields")
198 DEFINE_IMPLICATION(track_double_fields, track_fields)
199 DEFINE_IMPLICATION(track_heap_object_fields, track_fields)
200 DEFINE_IMPLICATION(track_computed_fields, track_fields)
201 DEFINE_BOOL(track_field_types, true, "track field types")
202 DEFINE_IMPLICATION(track_field_types, track_fields)
203 DEFINE_IMPLICATION(track_field_types, track_heap_object_fields)
204 DEFINE_BOOL(smi_binop, true, "support smi representation in binary operations")
205 DEFINE_BOOL(vector_ics, false, "support vector-based ics")
207 // Flags for optimization types.
208 DEFINE_BOOL(optimize_for_size, false,
209 "Enables optimizations which favor memory size over execution "
212 // Flags for data representation optimizations
213 DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles")
214 DEFINE_BOOL(string_slices, true, "use string slices")
216 // Flags for Crankshaft.
217 DEFINE_BOOL(crankshaft, true, "use crankshaft")
218 DEFINE_STRING(hydrogen_filter, "*", "optimization filter")
219 DEFINE_BOOL(use_gvn, true, "use hydrogen global value numbering")
220 DEFINE_INT(gvn_iterations, 3, "maximum number of GVN fix-point iterations")
221 DEFINE_BOOL(use_canonicalizing, true, "use hydrogen instruction canonicalizing")
222 DEFINE_BOOL(use_inlining, true, "use function inlining")
223 DEFINE_BOOL(use_escape_analysis, true, "use hydrogen escape analysis")
224 DEFINE_BOOL(use_allocation_folding, true, "use allocation folding")
225 DEFINE_BOOL(use_local_allocation_folding, false, "only fold in basic blocks")
226 DEFINE_BOOL(use_write_barrier_elimination, true,
227 "eliminate write barriers targeting allocations in optimized code")
228 DEFINE_INT(max_inlining_levels, 5, "maximum number of inlining levels")
229 DEFINE_INT(max_inlined_source_size, 600,
230 "maximum source size in bytes considered for a single inlining")
231 DEFINE_INT(max_inlined_nodes, 196,
232 "maximum number of AST nodes considered for a single inlining")
233 DEFINE_INT(max_inlined_nodes_cumulative, 400,
234 "maximum cumulative number of AST nodes considered for inlining")
235 DEFINE_BOOL(loop_invariant_code_motion, true, "loop invariant code motion")
236 DEFINE_BOOL(fast_math, true, "faster (but maybe less accurate) math functions")
237 DEFINE_BOOL(collect_megamorphic_maps_from_stub_cache, true,
238 "crankshaft harvests type feedback from stub cache")
239 DEFINE_BOOL(hydrogen_stats, false, "print statistics for hydrogen")
240 DEFINE_BOOL(trace_check_elimination, false, "trace check elimination phase")
241 DEFINE_BOOL(trace_hydrogen, false, "trace generated hydrogen to file")
242 DEFINE_STRING(trace_hydrogen_filter, "*", "hydrogen tracing filter")
243 DEFINE_BOOL(trace_hydrogen_stubs, false, "trace generated hydrogen for stubs")
244 DEFINE_STRING(trace_hydrogen_file, NULL, "trace hydrogen to given file name")
245 DEFINE_STRING(trace_phase, "HLZ", "trace generated IR for specified phases")
246 DEFINE_BOOL(trace_inlining, false, "trace inlining decisions")
247 DEFINE_BOOL(trace_load_elimination, false, "trace load elimination")
248 DEFINE_BOOL(trace_store_elimination, false, "trace store elimination")
249 DEFINE_BOOL(trace_alloc, false, "trace register allocator")
250 DEFINE_BOOL(trace_all_uses, false, "trace all use positions")
251 DEFINE_BOOL(trace_range, false, "trace range analysis")
252 DEFINE_BOOL(trace_gvn, false, "trace global value numbering")
253 DEFINE_BOOL(trace_representation, false, "trace representation types")
254 DEFINE_BOOL(trace_removable_simulates, false, "trace removable simulates")
255 DEFINE_BOOL(trace_escape_analysis, false, "trace hydrogen escape analysis")
256 DEFINE_BOOL(trace_allocation_folding, false, "trace allocation folding")
257 DEFINE_BOOL(trace_track_allocation_sites, false,
258 "trace the tracking of allocation sites")
259 DEFINE_BOOL(trace_migration, false, "trace object migration")
260 DEFINE_BOOL(trace_generalization, false, "trace map generalization")
261 DEFINE_BOOL(stress_pointer_maps, false, "pointer map for every instruction")
262 DEFINE_BOOL(stress_environments, false, "environment for every instruction")
263 DEFINE_INT(deopt_every_n_times, 0,
264 "deoptimize every n times a deopt point is passed")
265 DEFINE_INT(deopt_every_n_garbage_collections, 0,
266 "deoptimize every n garbage collections")
267 DEFINE_BOOL(print_deopt_stress, false, "print number of possible deopt points")
268 DEFINE_BOOL(trap_on_deopt, false, "put a break point before deoptimizing")
269 DEFINE_BOOL(trap_on_stub_deopt, false,
270 "put a break point before deoptimizing a stub")
271 DEFINE_BOOL(deoptimize_uncommon_cases, true, "deoptimize uncommon cases")
272 DEFINE_BOOL(polymorphic_inlining, true, "polymorphic inlining")
273 DEFINE_BOOL(use_osr, true, "use on-stack replacement")
274 DEFINE_BOOL(array_bounds_checks_elimination, true,
275 "perform array bounds checks elimination")
276 DEFINE_BOOL(trace_bce, false, "trace array bounds check elimination")
277 DEFINE_BOOL(array_bounds_checks_hoisting, false,
278 "perform array bounds checks hoisting")
279 DEFINE_BOOL(array_index_dehoisting, true, "perform array index dehoisting")
280 DEFINE_BOOL(analyze_environment_liveness, true,
281 "analyze liveness of environment slots and zap dead values")
282 DEFINE_BOOL(load_elimination, true, "use load elimination")
283 DEFINE_BOOL(check_elimination, true, "use check elimination")
284 DEFINE_BOOL(store_elimination, false, "use store elimination")
285 DEFINE_BOOL(dead_code_elimination, true, "use dead code elimination")
286 DEFINE_BOOL(fold_constants, true, "use constant folding")
287 DEFINE_BOOL(trace_dead_code_elimination, false, "trace dead code elimination")
288 DEFINE_BOOL(unreachable_code_elimination, true, "eliminate unreachable code")
289 DEFINE_BOOL(trace_osr, false, "trace on-stack replacement")
290 DEFINE_INT(stress_runs, 0, "number of stress runs")
291 DEFINE_BOOL(optimize_closures, true, "optimize closures")
292 DEFINE_BOOL(lookup_sample_by_shared, true,
293 "when picking a function to optimize, watch for shared function "
294 "info, not JSFunction itself")
295 DEFINE_BOOL(cache_optimized_code, true, "cache optimized code for closures")
296 DEFINE_BOOL(flush_optimized_code_cache, true,
297 "flushes the cache of optimized code for closures on every GC")
298 DEFINE_BOOL(inline_construct, true, "inline constructor calls")
299 DEFINE_BOOL(inline_arguments, true, "inline functions with arguments object")
300 DEFINE_BOOL(inline_accessors, true, "inline JavaScript accessors")
301 DEFINE_INT(escape_analysis_iterations, 2,
302 "maximum number of escape analysis fix-point iterations")
304 DEFINE_BOOL(optimize_for_in, true, "optimize functions containing for-in loops")
305 DEFINE_BOOL(opt_safe_uint32_operations, true,
306 "allow uint32 values on optimize frames if they are used only in "
309 DEFINE_BOOL(concurrent_recompilation, true,
310 "optimizing hot functions asynchronously on a separate thread")
311 DEFINE_BOOL(trace_concurrent_recompilation, false,
312 "track concurrent recompilation")
313 DEFINE_INT(concurrent_recompilation_queue_length, 8,
314 "the length of the concurrent compilation queue")
315 DEFINE_INT(concurrent_recompilation_delay, 0,
316 "artificial compilation delay in ms")
317 DEFINE_BOOL(block_concurrent_recompilation, false,
318 "block queued jobs until released")
319 DEFINE_BOOL(concurrent_osr, true, "concurrent on-stack replacement")
320 DEFINE_IMPLICATION(concurrent_osr, concurrent_recompilation)
322 DEFINE_BOOL(omit_map_checks_for_leaf_maps, true,
323 "do not emit check maps for constant values that have a leaf map, "
324 "deoptimize the optimized code if the layout of the maps changes.")
326 // Flags for TurboFan.
327 DEFINE_STRING(turbo_filter, "~", "optimization filter for TurboFan compiler")
328 DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
329 DEFINE_BOOL(trace_turbo_types, true, "trace generated TurboFan types")
330 DEFINE_BOOL(trace_turbo_scheduler, false, "trace generated TurboFan scheduler")
331 DEFINE_BOOL(turbo_verify, false, "verify TurboFan graphs at each phase")
332 DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics")
333 DEFINE_BOOL(turbo_types, false, "use typed lowering in TurboFan")
334 DEFINE_BOOL(turbo_source_positions, false,
335 "track source code positions when building TurboFan IR")
336 DEFINE_BOOL(context_specialization, true,
337 "enable context specialization in TurboFan")
338 DEFINE_BOOL(turbo_deoptimization, false, "enable deoptimization in TurboFan")
340 DEFINE_INT(typed_array_max_size_in_heap, 64,
341 "threshold for in-heap typed array")
344 DEFINE_INT(frame_count, 1, "number of stack frames inspected by the profiler")
345 // 0x1800 fits in the immediate field of an ARM instruction.
346 DEFINE_INT(interrupt_budget, 0x1800,
347 "execution budget before interrupt is triggered")
348 DEFINE_INT(type_info_threshold, 25,
349 "percentage of ICs that must have type info to allow optimization")
350 DEFINE_INT(generic_ic_threshold, 30,
351 "max percentage of megamorphic/generic ICs to allow optimization")
352 DEFINE_INT(self_opt_count, 130, "call count before self-optimization")
354 DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
355 DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
357 // assembler-ia32.cc / assembler-arm.cc / assembler-x64.cc
358 DEFINE_BOOL(debug_code, false, "generate extra code (assertions) for debugging")
359 DEFINE_BOOL(code_comments, false, "emit comments in code disassembly")
360 DEFINE_BOOL(enable_sse3, true, "enable use of SSE3 instructions if available")
361 DEFINE_BOOL(enable_sse4_1, true,
362 "enable use of SSE4.1 instructions if available")
363 DEFINE_BOOL(enable_sahf, true,
364 "enable use of SAHF instruction if available (X64 only)")
365 DEFINE_BOOL(enable_vfp3, ENABLE_VFP3_DEFAULT,
366 "enable use of VFP3 instructions if available")
367 DEFINE_BOOL(enable_armv7, ENABLE_ARMV7_DEFAULT,
368 "enable use of ARMv7 instructions if available (ARM only)")
369 DEFINE_BOOL(enable_neon, ENABLE_NEON_DEFAULT,
370 "enable use of NEON instructions if available (ARM only)")
371 DEFINE_BOOL(enable_sudiv, true,
372 "enable use of SDIV and UDIV instructions if available (ARM only)")
373 DEFINE_BOOL(enable_mls, true,
374 "enable use of MLS instructions if available (ARM only)")
375 DEFINE_BOOL(enable_movw_movt, false,
376 "enable loading 32-bit constant by means of movw/movt "
377 "instruction pairs (ARM only)")
378 DEFINE_BOOL(enable_unaligned_accesses, true,
379 "enable unaligned accesses for ARMv7 (ARM only)")
380 DEFINE_BOOL(enable_32dregs, ENABLE_32DREGS_DEFAULT,
381 "enable use of d16-d31 registers on ARM - this requires VFP3")
382 DEFINE_BOOL(enable_vldr_imm, false,
383 "enable use of constant pools for double immediate (ARM only)")
384 DEFINE_BOOL(force_long_branches, false,
385 "force all emitted branches to be in long mode (MIPS only)")
388 DEFINE_BOOL(enable_always_align_csp, true,
389 "enable alignment of csp to 16 bytes on platforms which prefer "
390 "the register to always be aligned (ARM64 only)")
393 DEFINE_STRING(expose_natives_as, NULL, "expose natives in global object")
394 DEFINE_STRING(expose_debug_as, NULL, "expose debug in global object")
395 DEFINE_BOOL(expose_free_buffer, false, "expose freeBuffer extension")
396 DEFINE_BOOL(expose_gc, false, "expose gc extension")
397 DEFINE_STRING(expose_gc_as, NULL,
398 "expose gc extension under the specified name")
399 DEFINE_IMPLICATION(expose_gc_as, expose_gc)
400 DEFINE_BOOL(expose_externalize_string, false,
401 "expose externalize string extension")
402 DEFINE_BOOL(expose_trigger_failure, false, "expose trigger-failure extension")
403 DEFINE_INT(stack_trace_limit, 10, "number of stack frames to capture")
404 DEFINE_BOOL(builtins_in_stack_traces, false,
405 "show built-in functions in stack traces")
406 DEFINE_BOOL(disable_native_files, false, "disable builtin natives files")
409 DEFINE_BOOL(inline_new, true, "use fast inline allocation")
411 // codegen-ia32.cc / codegen-arm.cc
412 DEFINE_BOOL(trace_codegen, false,
413 "print name of functions for which code is generated")
414 DEFINE_BOOL(trace, false, "trace function calls")
415 DEFINE_BOOL(mask_constants_with_cookie, true,
416 "use random jit cookie to mask large constants")
419 DEFINE_BOOL(lazy, true, "use lazy compilation")
420 DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
421 DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics")
422 DEFINE_BOOL(opt, true, "use adaptive optimizations")
423 DEFINE_BOOL(always_opt, false, "always try to optimize functions")
424 DEFINE_BOOL(always_osr, false, "always try to OSR functions")
425 DEFINE_BOOL(prepare_always_opt, false, "prepare for turning on always opt")
426 DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
427 DEFINE_BOOL(trace_stub_failures, false,
428 "trace deoptimization of generated code stubs")
430 DEFINE_BOOL(serialize_toplevel, false, "enable caching of toplevel scripts")
433 DEFINE_INT(min_preparse_length, 1024,
434 "minimum length for automatic enable preparsing")
435 DEFINE_BOOL(always_full_compiler, false,
436 "try to use the dedicated run-once backend for all code")
437 DEFINE_INT(max_opt_count, 10,
438 "maximum number of optimization attempts before giving up.")
440 // compilation-cache.cc
441 DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
443 DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
446 DEFINE_INT(cpu_profiler_sampling_interval, 1000,
447 "CPU profiler sampling interval in microseconds")
450 DEFINE_BOOL(trace_debug_json, false, "trace debugging JSON request/response")
451 DEFINE_BOOL(trace_js_array_abuse, false,
452 "trace out-of-bounds accesses to JS arrays")
453 DEFINE_BOOL(trace_external_array_abuse, false,
454 "trace out-of-bounds-accesses to external arrays")
455 DEFINE_BOOL(trace_array_abuse, false,
456 "trace out-of-bounds accesses to all arrays")
457 DEFINE_IMPLICATION(trace_array_abuse, trace_js_array_abuse)
458 DEFINE_IMPLICATION(trace_array_abuse, trace_external_array_abuse)
459 DEFINE_BOOL(enable_liveedit, true, "enable liveedit experimental feature")
460 DEFINE_BOOL(hard_abort, true, "abort by crashing")
463 // Slightly less than 1MB, since Windows' default stack size for
464 // the main execution thread is 1MB for both 32 and 64-bit.
465 DEFINE_INT(stack_size, 984,
466 "default size of stack region v8 is allowed to use (in kBytes)")
469 DEFINE_INT(max_stack_trace_source_length, 300,
470 "maximum length of function source code printed in a stack trace.")
473 DEFINE_BOOL(always_inline_smi_code, false,
474 "always inline smi code in non-opt code")
477 DEFINE_INT(min_semi_space_size, 0,
478 "min size of a semi-space (in MBytes), the new space consists of two"
480 DEFINE_INT(max_semi_space_size, 0,
481 "max size of a semi-space (in MBytes), the new space consists of two"
483 DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
484 DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)")
485 DEFINE_BOOL(gc_global, false, "always perform global GCs")
486 DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
487 DEFINE_BOOL(trace_gc, false,
488 "print one trace line following each garbage collection")
489 DEFINE_BOOL(trace_gc_nvp, false,
490 "print one detailed trace line in name=value format "
491 "after each garbage collection")
492 DEFINE_BOOL(trace_gc_ignore_scavenger, false,
493 "do not print trace line after scavenger collection")
494 DEFINE_BOOL(print_cumulative_gc_stat, false,
495 "print cumulative GC statistics in name=value format on exit")
496 DEFINE_BOOL(print_max_heap_committed, false,
497 "print statistics of the maximum memory committed for the heap "
498 "in name=value format on exit")
499 DEFINE_BOOL(trace_gc_verbose, false,
500 "print more details following each garbage collection")
501 DEFINE_BOOL(trace_fragmentation, false,
502 "report fragmentation for old pointer and data pages")
503 DEFINE_BOOL(collect_maps, true,
504 "garbage collect maps from which no objects can be reached")
505 DEFINE_BOOL(weak_embedded_maps_in_ic, true,
506 "make maps embedded in inline cache stubs")
507 DEFINE_BOOL(weak_embedded_maps_in_optimized_code, true,
508 "make maps embedded in optimized code weak")
509 DEFINE_BOOL(weak_embedded_objects_in_optimized_code, true,
510 "make objects embedded in optimized code weak")
511 DEFINE_BOOL(flush_code, true,
512 "flush code that we expect not to use again (during full gc)")
513 DEFINE_BOOL(flush_code_incrementally, true,
514 "flush code that we expect not to use again (incrementally)")
515 DEFINE_BOOL(trace_code_flushing, false, "trace code flushing progress")
516 DEFINE_BOOL(age_code, true,
517 "track un-executed functions to age code and flush only "
518 "old code (required for code flushing)")
519 DEFINE_BOOL(incremental_marking, true, "use incremental marking")
520 DEFINE_BOOL(incremental_marking_steps, true, "do incremental marking steps")
521 DEFINE_BOOL(trace_incremental_marking, false,
522 "trace progress of the incremental marking")
523 DEFINE_BOOL(track_gc_object_stats, false,
524 "track object counts and memory usage")
525 DEFINE_BOOL(always_precise_sweeping, true, "always sweep precisely")
526 DEFINE_BOOL(parallel_sweeping, false, "enable parallel sweeping")
527 DEFINE_BOOL(concurrent_sweeping, true, "enable concurrent sweeping")
528 DEFINE_INT(sweeper_threads, 0,
529 "number of parallel and concurrent sweeping threads")
530 DEFINE_BOOL(job_based_sweeping, false, "enable job based sweeping")
532 DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC")
536 // heap-snapshot-generator.cc
537 DEFINE_BOOL(heap_profiler_trace_objects, false,
538 "Dump heap object allocations/movements/size_updates")
542 DEFINE_BOOL(use_idle_notification, true,
543 "Use idle notification to reduce memory footprint.")
545 DEFINE_BOOL(use_ic, true, "use inline caching")
546 DEFINE_BOOL(trace_ic, false, "trace inline cache state transitions")
548 // macro-assembler-ia32.cc
549 DEFINE_BOOL(native_code_counters, false,
550 "generate extra code for manipulating stats counters")
553 DEFINE_BOOL(always_compact, false, "Perform compaction on every full GC")
554 DEFINE_BOOL(never_compact, false,
555 "Never perform compaction on full GC - testing only")
556 DEFINE_BOOL(compact_code_space, true,
557 "Compact code space on full non-incremental collections")
558 DEFINE_BOOL(incremental_code_compaction, true,
559 "Compact code space on full incremental collections")
560 DEFINE_BOOL(cleanup_code_caches_at_gc, true,
561 "Flush inline caches prior to mark compact collection and "
562 "flush code caches in maps during mark compact cycle.")
563 DEFINE_BOOL(use_marking_progress_bar, true,
564 "Use a progress bar to scan large objects in increments when "
565 "incremental marking is active.")
566 DEFINE_BOOL(zap_code_space, true,
567 "Zap free memory in code space with 0xCC while sweeping.")
568 DEFINE_INT(random_seed, 0,
569 "Default seed for initializing random generator "
570 "(0, the default, means to use system random).")
573 DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
576 DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
577 DEFINE_BOOL(trace_parse, false, "trace parsing and preparsing")
579 // simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
580 DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
581 DEFINE_BOOL(debug_sim, false, "Enable debugging the simulator")
582 DEFINE_BOOL(check_icache, false,
583 "Check icache flushes in ARM and MIPS simulator")
584 DEFINE_INT(stop_sim_at, 0, "Simulator stop after x number of instructions")
585 #if defined(V8_TARGET_ARCH_ARM64) || defined(V8_TARGET_ARCH_MIPS64)
586 DEFINE_INT(sim_stack_alignment, 16,
587 "Stack alignment in bytes in simulator. This must be a power of two "
588 "and it must be at least 16. 16 is default.")
590 DEFINE_INT(sim_stack_alignment, 8,
591 "Stack alingment in bytes in simulator (4 or 8, 8 is default)")
593 DEFINE_INT(sim_stack_size, 2 * MB / KB,
594 "Stack size of the ARM64 and MIPS64 simulator "
595 "in kBytes (default is 2 MB)")
596 DEFINE_BOOL(log_regs_modified, true,
597 "When logging register values, only print modified registers.")
598 DEFINE_BOOL(log_colour, true, "When logging, try to use coloured output.")
599 DEFINE_BOOL(ignore_asm_unimplemented_break, false,
600 "Don't break for ASM_UNIMPLEMENTED_BREAK macros.")
601 DEFINE_BOOL(trace_sim_messages, false,
602 "Trace simulator debug messages. Implied by --trace-sim.")
605 DEFINE_BOOL(stack_trace_on_illegal, false,
606 "print stack trace when an illegal exception is thrown")
607 DEFINE_BOOL(abort_on_uncaught_exception, false,
608 "abort program (dump core) when an uncaught exception is thrown")
609 DEFINE_BOOL(randomize_hashes, true,
610 "randomize hashes to avoid predictable hash collisions "
611 "(with snapshots this option cannot override the baked-in seed)")
612 DEFINE_INT(hash_seed, 0,
613 "Fixed seed to use to hash property keys (0 means random)"
614 "(with snapshots this option cannot override the baked-in seed)")
616 // snapshot-common.cc
617 DEFINE_BOOL(profile_deserialization, false,
618 "Print the time it takes to deserialize the snapshot.")
621 DEFINE_BOOL(regexp_optimization, true, "generate optimized regexp code")
623 // Testing flags test/cctest/test-{flags,api,serialization}.cc
624 DEFINE_BOOL(testing_bool_flag, true, "testing_bool_flag")
625 DEFINE_MAYBE_BOOL(testing_maybe_bool_flag, "testing_maybe_bool_flag")
626 DEFINE_INT(testing_int_flag, 13, "testing_int_flag")
627 DEFINE_FLOAT(testing_float_flag, 2.5, "float-flag")
628 DEFINE_STRING(testing_string_flag, "Hello, world!", "string-flag")
629 DEFINE_INT(testing_prng_seed, 42, "Seed used for threading test randomness")
631 DEFINE_STRING(testing_serialization_file, "C:\\Windows\\Temp\\serdes",
632 "file in which to testing_serialize heap")
634 DEFINE_STRING(testing_serialization_file, "/tmp/serdes",
635 "file in which to serialize heap")
639 DEFINE_STRING(extra_code, NULL,
640 "A filename with extra code to be included in"
641 " the snapshot (mksnapshot only)")
642 DEFINE_STRING(raw_file, NULL,
643 "A file to write the raw snapshot bytes to. "
645 DEFINE_STRING(raw_context_file, NULL,
646 "A file to write the raw context "
647 "snapshot bytes to. (mksnapshot only)")
648 DEFINE_STRING(startup_blob, NULL,
649 "Write V8 startup blob file. "
652 // code-stubs-hydrogen.cc
653 DEFINE_BOOL(profile_hydrogen_code_stub_compilation, false,
654 "Print the time it takes to lazily compile hydrogen code stubs.")
656 DEFINE_BOOL(predictable, false, "enable predictable mode")
657 DEFINE_NEG_IMPLICATION(predictable, concurrent_recompilation)
658 DEFINE_NEG_IMPLICATION(predictable, concurrent_osr)
659 DEFINE_NEG_IMPLICATION(predictable, concurrent_sweeping)
660 DEFINE_NEG_IMPLICATION(predictable, parallel_sweeping)
667 DEFINE_BOOL(help, false, "Print usage message, including flags, on console")
668 DEFINE_BOOL(dump_counters, false, "Dump counters on exit")
670 DEFINE_BOOL(debugger, false, "Enable JavaScript debugger")
672 DEFINE_STRING(map_counters, "", "Map counters to a file")
673 DEFINE_ARGS(js_arguments,
674 "Pass all remaining arguments to the script. Alias for \"--\".")
677 // GDB JIT integration flags.
680 DEFINE_BOOL(gdbjit, false, "enable GDBJIT interface (disables compacting GC)")
681 DEFINE_BOOL(gdbjit_full, false, "enable GDBJIT interface for all code objects")
682 DEFINE_BOOL(gdbjit_dump, false, "dump elf objects with debug info to disk")
683 DEFINE_STRING(gdbjit_dump_filter, "",
684 "dump only objects containing this substring")
687 DEFINE_BOOL(force_marking_deque_overflows, false,
688 "force overflows of marking deque by reducing it's size "
691 DEFINE_BOOL(stress_compaction, false,
692 "stress the GC compactor to flush out bugs (implies "
693 "--force_marking_deque_overflows)")
700 #define FLAG FLAG_FULL
702 #define FLAG FLAG_READONLY
706 #ifdef ENABLE_SLOW_DCHECKS
707 DEFINE_BOOL(enable_slow_asserts, false,
708 "enable asserts that are slow to execute")
711 // codegen-ia32.cc / codegen-arm.cc / macro-assembler-*.cc
712 DEFINE_BOOL(print_source, false, "pretty print source code")
713 DEFINE_BOOL(print_builtin_source, false,
714 "pretty print source code for builtins")
715 DEFINE_BOOL(print_ast, false, "print source AST")
716 DEFINE_BOOL(print_builtin_ast, false, "print source AST for builtins")
717 DEFINE_STRING(stop_at, "", "function name where to insert a breakpoint")
718 DEFINE_BOOL(trap_on_abort, false, "replace aborts by breakpoints")
721 DEFINE_BOOL(print_builtin_scopes, false, "print scopes for builtins")
722 DEFINE_BOOL(print_scopes, false, "print scopes")
725 DEFINE_BOOL(trace_contexts, false, "trace contexts operations")
728 DEFINE_BOOL(gc_verbose, false, "print stuff during garbage collection")
729 DEFINE_BOOL(heap_stats, false, "report heap statistics before and after GC")
730 DEFINE_BOOL(code_stats, false, "report code statistics after GC")
731 DEFINE_BOOL(verify_native_context_separation, false,
732 "verify that code holds on to at most one native context after GC")
733 DEFINE_BOOL(print_handles, false, "report handles after GC")
734 DEFINE_BOOL(print_global_handles, false, "report global handles after GC")
736 // TurboFan debug-only flags.
737 DEFINE_BOOL(print_turbo_replay, false,
738 "print C++ code to recreate TurboFan graphs")
741 DEFINE_BOOL(print_interfaces, false, "print interfaces")
742 DEFINE_BOOL(print_interface_details, false, "print interface inference details")
743 DEFINE_INT(print_interface_depth, 5, "depth for printing interfaces")
746 DEFINE_BOOL(trace_normalization, false,
747 "prints when objects are turned into dictionaries.")
750 DEFINE_BOOL(trace_lazy, false, "trace lazy compilation")
753 DEFINE_BOOL(collect_heap_spill_statistics, false,
754 "report heap spill statistics along with heap_stats "
755 "(requires heap_stats)")
757 DEFINE_BOOL(trace_isolates, false, "trace isolate state changes")
760 DEFINE_BOOL(regexp_possessive_quantifier, false,
761 "enable possessive quantifier syntax for testing")
762 DEFINE_BOOL(trace_regexp_bytecodes, false, "trace regexp bytecode execution")
763 DEFINE_BOOL(trace_regexp_assembler, false,
764 "trace regexp macro assembler calls.")
767 // Logging and profiling flags
770 #define FLAG FLAG_FULL
773 DEFINE_BOOL(log, false,
774 "Minimal logging (no API, code, GC, suspect, or handles samples).")
775 DEFINE_BOOL(log_all, false, "Log all events to the log file.")
776 DEFINE_BOOL(log_api, false, "Log API events to the log file.")
777 DEFINE_BOOL(log_code, false,
778 "Log code events to the log file without profiling.")
779 DEFINE_BOOL(log_gc, false,
780 "Log heap samples on garbage collection for the hp2ps tool.")
781 DEFINE_BOOL(log_handles, false, "Log global handle events.")
782 DEFINE_BOOL(log_snapshot_positions, false,
783 "log positions of (de)serialized objects in the snapshot.")
784 DEFINE_BOOL(log_suspect, false, "Log suspect operations.")
785 DEFINE_BOOL(prof, false,
786 "Log statistical profiling information (implies --log-code).")
787 DEFINE_BOOL(prof_browser_mode, true,
788 "Used with --prof, turns on browser-compatible mode for profiling.")
789 DEFINE_BOOL(log_regexp, false, "Log regular expression execution.")
790 DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
791 DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
792 DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
793 DEFINE_BOOL(perf_basic_prof, false,
794 "Enable perf linux profiler (basic support).")
795 DEFINE_NEG_IMPLICATION(perf_basic_prof, compact_code_space)
796 DEFINE_BOOL(perf_jit_prof, false,
797 "Enable perf linux profiler (experimental annotate support).")
798 DEFINE_NEG_IMPLICATION(perf_jit_prof, compact_code_space)
799 DEFINE_STRING(gc_fake_mmap, "/tmp/__v8_gc__",
800 "Specify the name of the file for fake gc mmap used in ll_prof")
801 DEFINE_BOOL(log_internal_timer_events, false, "Time internal events.")
802 DEFINE_BOOL(log_timer_events, false,
803 "Time events including external callbacks.")
804 DEFINE_IMPLICATION(log_timer_events, log_internal_timer_events)
805 DEFINE_IMPLICATION(log_internal_timer_events, prof)
806 DEFINE_BOOL(log_instruction_stats, false, "Log AArch64 instruction statistics.")
807 DEFINE_STRING(log_instruction_file, "arm64_inst.csv",
808 "AArch64 instruction statistics log file.")
809 DEFINE_INT(log_instruction_period, 1 << 22,
810 "AArch64 instruction statistics logging period.")
812 DEFINE_BOOL(redirect_code_traces, false,
813 "output deopt information and disassembly into file "
814 "code-<pid>-<isolate id>.asm")
815 DEFINE_STRING(redirect_code_traces_to, NULL,
816 "output deopt information and disassembly into the given file")
818 DEFINE_BOOL(hydrogen_track_positions, false,
819 "track source code positions when building IR")
822 // Disassembler only flags
825 #ifdef ENABLE_DISASSEMBLER
826 #define FLAG FLAG_FULL
828 #define FLAG FLAG_READONLY
832 DEFINE_BOOL(trace_elements_transitions, false, "trace elements transitions")
834 DEFINE_BOOL(trace_creation_allocation_sites, false,
835 "trace the creation of allocation sites")
838 DEFINE_BOOL(print_code_stubs, false, "print code stubs")
839 DEFINE_BOOL(test_secondary_stub_cache, false,
840 "test secondary stub cache by disabling the primary one")
842 DEFINE_BOOL(test_primary_stub_cache, false,
843 "test primary stub cache by disabling the secondary one")
846 // codegen-ia32.cc / codegen-arm.cc
847 DEFINE_BOOL(print_code, false, "print generated code")
848 DEFINE_BOOL(print_opt_code, false, "print optimized code")
849 DEFINE_BOOL(print_unopt_code, false,
850 "print unoptimized code before "
851 "printing optimized code based on it")
852 DEFINE_BOOL(print_code_verbose, false, "print more information for code")
853 DEFINE_BOOL(print_builtin_code, false, "print generated code for builtins")
855 #ifdef ENABLE_DISASSEMBLER
856 DEFINE_BOOL(sodium, false,
857 "print generated code output suitable for use with "
858 "the Sodium code viewer")
860 DEFINE_IMPLICATION(sodium, print_code_stubs)
861 DEFINE_IMPLICATION(sodium, print_code)
862 DEFINE_IMPLICATION(sodium, print_opt_code)
863 DEFINE_IMPLICATION(sodium, hydrogen_track_positions)
864 DEFINE_IMPLICATION(sodium, code_comments)
866 DEFINE_BOOL(print_all_code, false, "enable all flags related to printing code")
867 DEFINE_IMPLICATION(print_all_code, print_code)
868 DEFINE_IMPLICATION(print_all_code, print_opt_code)
869 DEFINE_IMPLICATION(print_all_code, print_unopt_code)
870 DEFINE_IMPLICATION(print_all_code, print_code_verbose)
871 DEFINE_IMPLICATION(print_all_code, print_builtin_code)
872 DEFINE_IMPLICATION(print_all_code, print_code_stubs)
873 DEFINE_IMPLICATION(print_all_code, code_comments)
875 DEFINE_IMPLICATION(print_all_code, trace_codegen)
881 // VERIFY_PREDICTABLE related flags
885 #ifdef VERIFY_PREDICTABLE
886 #define FLAG FLAG_FULL
888 #define FLAG FLAG_READONLY
891 DEFINE_BOOL(verify_predictable, false,
892 "this mode is used for checking that V8 behaves predictably")
893 DEFINE_INT(dump_allocations_digest_at_alloc, 0,
894 "dump allocations digest each n-th allocation")
901 #define FLAG FLAG_READONLY
904 DEFINE_BOOL(enable_ool_constant_pool, V8_OOL_CONSTANT_POOL,
905 "enable use of out-of-line constant pools (ARM only)")
914 #undef DEFINE_MAYBE_BOOL
919 #undef DEFINE_IMPLICATION
920 #undef DEFINE_NEG_IMPLICATION
921 #undef DEFINE_ALIAS_BOOL
922 #undef DEFINE_ALIAS_INT
923 #undef DEFINE_ALIAS_STRING
924 #undef DEFINE_ALIAS_FLOAT
925 #undef DEFINE_ALIAS_ARGS
927 #undef FLAG_MODE_DECLARE
928 #undef FLAG_MODE_DEFINE
929 #undef FLAG_MODE_DEFINE_DEFAULTS
930 #undef FLAG_MODE_META
931 #undef FLAG_MODE_DEFINE_IMPLICATIONS