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