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