OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 23 matching lines...) Expand all Loading... |
34 // a mode defined before it's included. The modes are FLAG_MODE_... below: | 34 // a mode defined before it's included. The modes are FLAG_MODE_... below: |
35 | 35 |
36 // We want to declare the names of the variables for the header file. Normally | 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 | 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. | 38 // compiler make better optimizations by giving it the value. |
39 #if defined(FLAG_MODE_DECLARE) | 39 #if defined(FLAG_MODE_DECLARE) |
40 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 40 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
41 extern ctype FLAG_##nam; | 41 extern ctype FLAG_##nam; |
42 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \ | 42 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \ |
43 static ctype const FLAG_##nam = def; | 43 static ctype const FLAG_##nam = def; |
44 #define DEFINE_implication(whenflag, thenflag) | |
45 | 44 |
46 // We want to supply the actual storage and value for the flag variable in the | 45 // 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. | 46 // .cc file. We only do this for writable flags. |
48 #elif defined(FLAG_MODE_DEFINE) | 47 #elif defined(FLAG_MODE_DEFINE) |
49 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 48 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
50 ctype FLAG_##nam = def; | 49 ctype FLAG_##nam = def; |
51 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
52 #define DEFINE_implication(whenflag, thenflag) | |
53 | 50 |
54 // We need to define all of our default values so that the Flag structure can | 51 // 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, | 52 // 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. | 53 // for MODE_META, so there is no impact on the flags interface. |
57 #elif defined(FLAG_MODE_DEFINE_DEFAULTS) | 54 #elif defined(FLAG_MODE_DEFINE_DEFAULTS) |
58 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 55 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
59 static ctype const FLAGDEFAULT_##nam = def; | 56 static ctype const FLAGDEFAULT_##nam = def; |
60 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
61 #define DEFINE_implication(whenflag, thenflag) | |
62 | 57 |
63 // We want to write entries into our meta data table, for internal parsing and | 58 // 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. | 59 // printing / etc in the flag parser code. We only do this for writable flags. |
65 #elif defined(FLAG_MODE_META) | 60 #elif defined(FLAG_MODE_META) |
66 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 61 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
67 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false }, | 62 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false }, |
68 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | 63 #define FLAG_ALIAS(ftype, ctype, alias, nam) \ |
69 #define DEFINE_implication(whenflag, thenflag) | 64 { Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \ |
| 65 "alias for --"#nam, false }, |
70 | 66 |
71 // We produce the code to set flags when it is implied by another flag. | 67 // We produce the code to set flags when it is implied by another flag. |
72 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS) | 68 #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) \ | 69 #define DEFINE_implication(whenflag, thenflag) \ |
76 if (FLAG_##whenflag) FLAG_##thenflag = true; | 70 if (FLAG_##whenflag) FLAG_##thenflag = true; |
77 | 71 |
78 #else | 72 #else |
79 #error No mode supplied when including flags.defs | 73 #error No mode supplied when including flags.defs |
80 #endif | 74 #endif |
81 | 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 |
82 #ifdef FLAG_MODE_DECLARE | 94 #ifdef FLAG_MODE_DECLARE |
83 // Structure used to hold a collection of arguments to the JavaScript code. | 95 // Structure used to hold a collection of arguments to the JavaScript code. |
84 #define JSARGUMENTS_INIT {{}} | 96 #define JSARGUMENTS_INIT {{}} |
85 struct JSArguments { | 97 struct JSArguments { |
86 public: | 98 public: |
87 inline int argc() const { | 99 inline int argc() const { |
88 return static_cast<int>(storage_[0]); | 100 return static_cast<int>(storage_[0]); |
89 } | 101 } |
90 inline const char** argv() const { | 102 inline const char** argv() const { |
91 return reinterpret_cast<const char**>(storage_[1]); | 103 return reinterpret_cast<const char**>(storage_[1]); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 # define ENABLE_ARMV7_DEFAULT true | 140 # define ENABLE_ARMV7_DEFAULT true |
129 #else | 141 #else |
130 # define ENABLE_ARMV7_DEFAULT false | 142 # define ENABLE_ARMV7_DEFAULT false |
131 #endif | 143 #endif |
132 #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST) | 144 #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST) |
133 # define ENABLE_32DREGS_DEFAULT true | 145 # define ENABLE_32DREGS_DEFAULT true |
134 #else | 146 #else |
135 # define ENABLE_32DREGS_DEFAULT false | 147 # define ENABLE_32DREGS_DEFAULT false |
136 #endif | 148 #endif |
137 | 149 |
138 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) | 150 #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) | 151 #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) | 152 #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) | 153 #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) | 154 #define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt) |
| 155 |
| 156 #define DEFINE_ALIAS_bool(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam) |
| 157 #define DEFINE_ALIAS_int(alias, nam) FLAG_ALIAS(INT, int, alias, nam) |
| 158 #define DEFINE_ALIAS_float(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam) |
| 159 #define DEFINE_ALIAS_string(alias, nam) \ |
| 160 FLAG_ALIAS(STRING, const char*, alias, nam) |
| 161 #define DEFINE_ALIAS_args(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam) |
143 | 162 |
144 // | 163 // |
145 // Flags in all modes. | 164 // Flags in all modes. |
146 // | 165 // |
147 #define FLAG FLAG_FULL | 166 #define FLAG FLAG_FULL |
148 | 167 |
149 // Flags for language modes and experimental language features. | 168 // Flags for language modes and experimental language features. |
150 DEFINE_bool(use_strict, false, "enforce strict mode") | 169 DEFINE_bool(use_strict, false, "enforce strict mode") |
151 DEFINE_bool(es5_readonly, true, | 170 DEFINE_bool(es5_readonly, true, |
152 "activate correct semantics for inheriting readonliness") | 171 "activate correct semantics for inheriting readonliness") |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 DEFINE_bool(inline_arguments, true, "inline functions with arguments object") | 315 DEFINE_bool(inline_arguments, true, "inline functions with arguments object") |
297 DEFINE_bool(inline_accessors, true, "inline JavaScript accessors") | 316 DEFINE_bool(inline_accessors, true, "inline JavaScript accessors") |
298 DEFINE_int(loop_weight, 1, "loop weight for representation inference") | 317 DEFINE_int(loop_weight, 1, "loop weight for representation inference") |
299 | 318 |
300 DEFINE_bool(optimize_for_in, true, | 319 DEFINE_bool(optimize_for_in, true, |
301 "optimize functions containing for-in loops") | 320 "optimize functions containing for-in loops") |
302 DEFINE_bool(opt_safe_uint32_operations, true, | 321 DEFINE_bool(opt_safe_uint32_operations, true, |
303 "allow uint32 values on optimize frames if they are used only in " | 322 "allow uint32 values on optimize frames if they are used only in " |
304 "safe operations") | 323 "safe operations") |
305 | 324 |
306 DEFINE_bool(parallel_recompilation, true, | 325 DEFINE_bool(concurrent_recompilation, true, |
307 "optimizing hot functions asynchronously on a separate thread") | 326 "optimizing hot functions asynchronously on a separate thread") |
308 DEFINE_bool(trace_parallel_recompilation, false, "track parallel recompilation") | 327 DEFINE_bool(trace_concurrent_recompilation, false, |
309 DEFINE_int(parallel_recompilation_queue_length, 8, | 328 "track concurrent recompilation") |
310 "the length of the parallel compilation queue") | 329 DEFINE_int(concurrent_recompilation_queue_length, 8, |
311 DEFINE_int(parallel_recompilation_delay, 0, | 330 "the length of the concurrent compilation queue") |
| 331 DEFINE_int(concurrent_recompilation_delay, 0, |
312 "artificial compilation delay in ms") | 332 "artificial compilation delay in ms") |
| 333 |
| 334 // TODO(yangguo): to ease transitioning to the new naming scheme, we keep |
| 335 // the old flags for now as aliases. Remove soon. |
| 336 DEFINE_ALIAS_bool(parallel_recompilation, concurrent_recompilation) |
| 337 DEFINE_ALIAS_bool(trace_parallel_recompilation, trace_concurrent_recompilation) |
| 338 DEFINE_ALIAS_int(parallel_recompilation_queue_length, |
| 339 concurrent_recompilation_queue_length) |
| 340 DEFINE_ALIAS_int(parallel_recompilation_delay, concurrent_recompilation_delay) |
| 341 |
| 342 |
313 DEFINE_bool(omit_map_checks_for_leaf_maps, true, | 343 DEFINE_bool(omit_map_checks_for_leaf_maps, true, |
314 "do not emit check maps for constant values that have a leaf map, " | 344 "do not emit check maps for constant values that have a leaf map, " |
315 "deoptimize the optimized code if the layout of the maps changes.") | 345 "deoptimize the optimized code if the layout of the maps changes.") |
316 | 346 |
317 // Experimental profiler changes. | 347 // Experimental profiler changes. |
318 DEFINE_bool(experimental_profiler, true, "enable all profiler experiments") | 348 DEFINE_bool(experimental_profiler, true, "enable all profiler experiments") |
319 DEFINE_bool(watch_ic_patching, false, "profiler considers IC stability") | 349 DEFINE_bool(watch_ic_patching, false, "profiler considers IC stability") |
320 DEFINE_int(frame_count, 1, "number of stack frames inspected by the profiler") | 350 DEFINE_int(frame_count, 1, "number of stack frames inspected by the profiler") |
321 DEFINE_bool(self_optimization, false, | 351 DEFINE_bool(self_optimization, false, |
322 "primitive functions trigger their own optimization") | 352 "primitive functions trigger their own optimization") |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 DEFINE_implication(print_all_code, code_comments) | 830 DEFINE_implication(print_all_code, code_comments) |
801 #ifdef DEBUG | 831 #ifdef DEBUG |
802 DEFINE_implication(print_all_code, trace_codegen) | 832 DEFINE_implication(print_all_code, trace_codegen) |
803 #endif | 833 #endif |
804 #endif | 834 #endif |
805 | 835 |
806 // Cleanup... | 836 // Cleanup... |
807 #undef FLAG_FULL | 837 #undef FLAG_FULL |
808 #undef FLAG_READONLY | 838 #undef FLAG_READONLY |
809 #undef FLAG | 839 #undef FLAG |
| 840 #undef FLAG_ALIAS |
810 | 841 |
811 #undef DEFINE_bool | 842 #undef DEFINE_bool |
812 #undef DEFINE_int | 843 #undef DEFINE_int |
813 #undef DEFINE_string | 844 #undef DEFINE_string |
| 845 #undef DEFINE_float |
| 846 #undef DEFINE_args |
814 #undef DEFINE_implication | 847 #undef DEFINE_implication |
| 848 #undef DEFINE_ALIAS_bool |
| 849 #undef DEFINE_ALIAS_int |
| 850 #undef DEFINE_ALIAS_string |
| 851 #undef DEFINE_ALIAS_float |
| 852 #undef DEFINE_ALIAS_args |
815 | 853 |
816 #undef FLAG_MODE_DECLARE | 854 #undef FLAG_MODE_DECLARE |
817 #undef FLAG_MODE_DEFINE | 855 #undef FLAG_MODE_DEFINE |
818 #undef FLAG_MODE_DEFINE_DEFAULTS | 856 #undef FLAG_MODE_DEFINE_DEFAULTS |
819 #undef FLAG_MODE_META | 857 #undef FLAG_MODE_META |
820 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 858 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
OLD | NEW |