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