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