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