OLD | NEW |
| (Empty) |
1 // Copyright 2008 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 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
51 | |
52 // We need to define all of our default values so that the Flag structure can | |
53 // access them by pointer. These are just used internally inside of one .cc, | |
54 // for MODE_META, so there is no impact on the flags interface. | |
55 #elif defined(FLAG_MODE_DEFINE_DEFAULTS) | |
56 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | |
57 static ctype const FLAGDEFAULT_##nam = def; | |
58 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
59 | |
60 | |
61 // We want to write entries into our meta data table, for internal parsing and | |
62 // printing / etc in the flag parser code. We only do this for writable flags. | |
63 #elif defined(FLAG_MODE_META) | |
64 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | |
65 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt }, | |
66 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
67 | |
68 #else | |
69 #error No mode supplied when including flags.defs | |
70 #endif | |
71 | |
72 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) | |
73 #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt) | |
74 #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt) | |
75 #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt) | |
76 | |
77 // | |
78 // Flags in all modes. | |
79 // | |
80 #define FLAG FLAG_FULL | |
81 | |
82 // assembler-ia32.cc / assembler-arm.cc | |
83 DEFINE_bool(debug_code, false, | |
84 "generate extra code (comments, assertions) for debugging") | |
85 DEFINE_bool(emit_branch_hints, false, "emit branch hints") | |
86 DEFINE_bool(push_pop_elimination, true, | |
87 "eliminate redundant push/pops in assembly code") | |
88 DEFINE_bool(print_push_pop_elimination, false, | |
89 "print elimination of redundant push/pops in assembly code") | |
90 DEFINE_bool(eliminate_jumps, true, "eliminate jumps to jumps in assembly code") | |
91 DEFINE_bool(print_jump_elimination, false, | |
92 "print elimination of jumps to jumps in assembly code") | |
93 | |
94 // bootstrapper.cc | |
95 DEFINE_string(expose_natives_as, NULL, "expose natives in global object") | |
96 DEFINE_string(expose_debug_as, NULL, "expose debug in global object") | |
97 DEFINE_string(natives_file, NULL, "alternative natives file") | |
98 DEFINE_bool(expose_gc, false, "expose gc extension") | |
99 | |
100 // builtins-ia32.cc | |
101 DEFINE_bool(inline_new, true, "use fast inline allocation") | |
102 | |
103 // checks.cc | |
104 DEFINE_bool(stack_trace_on_abort, true, | |
105 "print a stack trace if an assertion failure occurs") | |
106 | |
107 // codegen-ia32.cc / codegen-arm.cc | |
108 DEFINE_bool(trace, false, "trace function calls") | |
109 DEFINE_bool(defer_negation, true, "defer negation operation") | |
110 DEFINE_bool(check_stack, true, | |
111 "check stack for overflow, interrupt, breakpoint") | |
112 | |
113 // codegen.cc | |
114 DEFINE_bool(lazy, true, "use lazy compilation") | |
115 DEFINE_bool(debug_info, true, "add debug information to compiled functions") | |
116 | |
117 // compiler.cc | |
118 DEFINE_bool(strict, false, "strict error checking") | |
119 DEFINE_int(min_preparse_length, 1024, | |
120 "Minimum length for automatic enable preparsing") | |
121 | |
122 // debug.cc | |
123 DEFINE_bool(remote_debugging, false, "enable remote debugging") | |
124 DEFINE_bool(trace_debug_json, false, "trace debugging JSON request/response") | |
125 | |
126 // execution.cc | |
127 DEFINE_bool(call_regexp, false, "allow calls to RegExp objects") | |
128 | |
129 // frames.cc | |
130 DEFINE_int(max_stack_trace_source_length, 300, | |
131 "maximum length of function source code printed in a stack trace.") | |
132 | |
133 // heap.cc | |
134 DEFINE_int(new_space_size, 0, "size of (each semispace in) the new generation") | |
135 DEFINE_int(old_space_size, 0, "size of the old generation") | |
136 DEFINE_bool(gc_global, false, "always perform global GCs") | |
137 DEFINE_int(gc_interval, -1, "garbage collect after <n> allocations") | |
138 DEFINE_bool(trace_gc, false, | |
139 "print one trace line following each garbage collection") | |
140 | |
141 // ic.cc | |
142 DEFINE_bool(use_ic, true, "use inline caching") | |
143 | |
144 // macro-assembler-ia32.cc | |
145 DEFINE_bool(native_code_counters, false, | |
146 "generate extra code for manipulating stats counters") | |
147 | |
148 // mark-compact.cc | |
149 DEFINE_bool(always_compact, false, "Perform compaction on every full GC") | |
150 DEFINE_bool(never_compact, false, | |
151 "Never perform compaction on full GC - testing only") | |
152 DEFINE_bool(cleanup_ics_at_gc, true, | |
153 "Flush inline caches prior to mark compact collection.") | |
154 DEFINE_bool(cleanup_caches_in_maps_at_gc, true, | |
155 "Flush code caches in maps during mark compact cycle.") | |
156 | |
157 // mksnapshot.cc | |
158 DEFINE_bool(h, false, "print this message") | |
159 | |
160 // parser.cc | |
161 DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") | |
162 | |
163 // simulator-arm.cc | |
164 DEFINE_bool(trace_sim, false, "trace simulator execution") | |
165 DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") | |
166 | |
167 // top.cc | |
168 DEFINE_bool(trace_exception, false, | |
169 "print stack trace when throwing exceptions") | |
170 DEFINE_bool(preallocate_message_memory, false, | |
171 "preallocate some memory to build stack traces.") | |
172 | |
173 // usage-analyzer.cc | |
174 DEFINE_bool(usage_computation, true, "compute variable usage counts") | |
175 | |
176 // v8.cc | |
177 DEFINE_bool(preemption, false, | |
178 "activate a 100ms timer that switches between V8 threads") | |
179 | |
180 // Testing flags test/cctest/test-{flags,api,serialization}.cc | |
181 DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") | |
182 DEFINE_int(testing_int_flag, 13, "testing_int_flag") | |
183 DEFINE_float(testing_float_flag, 2.5, "float-flag") | |
184 DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") | |
185 DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") | |
186 #ifdef WIN32 | |
187 DEFINE_string(testing_serialization_file, "C:\\Windows\\Temp\\serdes", | |
188 "file in which to testing_serialize heap") | |
189 #else | |
190 DEFINE_string(testing_serialization_file, "/tmp/serdes", | |
191 "file in which to serialize heap") | |
192 #endif | |
193 | |
194 | |
195 | |
196 // | |
197 // Debug only flags | |
198 // | |
199 #undef FLAG | |
200 #ifdef DEBUG | |
201 #define FLAG FLAG_FULL | |
202 #else | |
203 #define FLAG FLAG_READONLY | |
204 #endif | |
205 | |
206 // checks.cc | |
207 DEFINE_bool(enable_slow_asserts, false, | |
208 "enable asserts that are slow to execute") | |
209 | |
210 // code-stubs.cc | |
211 DEFINE_bool(print_code_stubs, false, "print code stubs") | |
212 | |
213 // codegen-ia32.cc / codegen-arm.cc | |
214 DEFINE_bool(trace_codegen, false, | |
215 "print name of functions for which code is generated") | |
216 DEFINE_bool(print_builtin_code, false, "print generated code for builtins") | |
217 DEFINE_bool(print_source, false, "pretty print source code") | |
218 DEFINE_bool(print_builtin_source, false, | |
219 "pretty print source code for builtins") | |
220 DEFINE_bool(print_ast, false, "print source AST") | |
221 DEFINE_bool(print_builtin_ast, false, "print source AST for builtins") | |
222 DEFINE_bool(trace_calls, false, "trace calls") | |
223 DEFINE_bool(trace_builtin_calls, false, "trace builtins calls") | |
224 DEFINE_string(stop_at, "", "function name where to insert a breakpoint") | |
225 | |
226 // compiler.cc | |
227 DEFINE_bool(print_builtin_scopes, false, "print scopes for builtins") | |
228 DEFINE_bool(print_scopes, false, "print scopes") | |
229 | |
230 // contexts.cc | |
231 DEFINE_bool(trace_contexts, false, "trace contexts operations") | |
232 | |
233 // heap.cc | |
234 DEFINE_bool(gc_greedy, false, "perform GC prior to some allocations") | |
235 DEFINE_bool(gc_verbose, false, "print stuff during garbage collection") | |
236 DEFINE_bool(heap_stats, false, "report heap statistics before and after GC") | |
237 DEFINE_bool(code_stats, false, "report code statistics after GC") | |
238 DEFINE_bool(verify_heap, false, "verify heap pointers before and after GC") | |
239 DEFINE_bool(print_handles, false, "report handles after GC") | |
240 DEFINE_bool(print_global_handles, false, "report global handles after GC") | |
241 DEFINE_bool(print_rset, false, "print remembered sets before GC") | |
242 | |
243 // ic.cc | |
244 DEFINE_bool(trace_ic, false, "trace inline cache state transitions") | |
245 | |
246 // objects.cc | |
247 DEFINE_bool(trace_normalization, | |
248 false, | |
249 "prints when objects are turned into dictionaries.") | |
250 | |
251 // runtime.cc | |
252 DEFINE_bool(trace_lazy, false, "trace lazy compilation") | |
253 | |
254 // serialize.cc | |
255 DEFINE_bool(debug_serialization, false, | |
256 "write debug information into the snapshot.") | |
257 | |
258 // spaces.cc | |
259 DEFINE_bool(collect_heap_spill_statistics, false, | |
260 "report heap spill statistics along with heap_stats " | |
261 "(requires heap_stats)") | |
262 | |
263 // | |
264 // Logging and profiling only flags | |
265 // | |
266 #undef FLAG | |
267 #ifdef ENABLE_LOGGING_AND_PROFILING | |
268 #define FLAG FLAG_FULL | |
269 #else | |
270 #define FLAG FLAG_READONLY | |
271 #endif | |
272 | |
273 // log.cc | |
274 DEFINE_bool(log, false, | |
275 "Minimal logging (no API, code, GC, suspect, or handles samples).") | |
276 DEFINE_bool(log_all, false, "Log all events to the log file.") | |
277 DEFINE_bool(log_api, false, "Log API events to the log file.") | |
278 DEFINE_bool(log_code, false, | |
279 "Log code events to the log file without profiling.") | |
280 DEFINE_bool(log_gc, false, | |
281 "Log heap samples on garbage collection for the hp2ps tool.") | |
282 DEFINE_bool(log_handles, false, "Log global handle events.") | |
283 DEFINE_bool(log_state_changes, false, "Log state changes.") | |
284 DEFINE_bool(log_suspect, false, "Log suspect operations.") | |
285 DEFINE_bool(prof, false, | |
286 "Log statistical profiling information (implies --log-code).") | |
287 DEFINE_bool(log_regexp, false, "Log regular expression execution.") | |
288 DEFINE_bool(sliding_state_window, false, | |
289 "Update sliding state window counters.") | |
290 DEFINE_string(logfile, "v8.log", "Specify the name of the log file.") | |
291 | |
292 // | |
293 // Disassembler only flags | |
294 // | |
295 #undef FLAG | |
296 #ifdef ENABLE_DISASSEMBLER | |
297 #define FLAG FLAG_FULL | |
298 #else | |
299 #define FLAG FLAG_READONLY | |
300 #endif | |
301 | |
302 // codegen-ia32.cc / codegen-arm.cc | |
303 DEFINE_bool(print_code, false, "print generated code") | |
304 | |
305 | |
306 // Cleanup... | |
307 #undef FLAG_FULL | |
308 #undef FLAG_READONLY | |
309 #undef FLAG | |
310 | |
311 #undef DEFINE_bool | |
312 #undef DEFINE_int | |
313 #undef DEFINE_string | |
314 | |
315 #undef FLAG_MODE_DECLARE | |
316 #undef FLAG_MODE_DEFINE | |
317 #undef FLAG_MODE_DEFINE_DEFAULTS | |
318 #undef FLAG_MODE_META | |
OLD | NEW |