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