OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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) | |
44 | 45 |
45 // We want to supply the actual storage and value for the flag variable in the | 46 // 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 // .cc file. We only do this for writable flags. |
47 #elif defined(FLAG_MODE_DEFINE) | 48 #elif defined(FLAG_MODE_DEFINE) |
48 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 49 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
49 ctype FLAG_##nam = def; | 50 ctype FLAG_##nam = def; |
50 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | 51 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) |
52 #define DEFINE_implication(whenflag, thenflag) | |
51 | 53 |
52 // We need to define all of our default values so that the Flag structure can | 54 // 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, | 55 // 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. | 56 // for MODE_META, so there is no impact on the flags interface. |
55 #elif defined(FLAG_MODE_DEFINE_DEFAULTS) | 57 #elif defined(FLAG_MODE_DEFINE_DEFAULTS) |
56 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 58 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
57 static ctype const FLAGDEFAULT_##nam = def; | 59 static ctype const FLAGDEFAULT_##nam = def; |
58 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | 60 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) |
59 | 61 #define DEFINE_implication(whenflag, thenflag) |
60 | 62 |
61 // We want to write entries into our meta data table, for internal parsing and | 63 // 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. | 64 // printing / etc in the flag parser code. We only do this for writable flags. |
63 #elif defined(FLAG_MODE_META) | 65 #elif defined(FLAG_MODE_META) |
64 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ | 66 #define FLAG_FULL(ftype, ctype, nam, def, cmt) \ |
65 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false }, | 67 { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false }, |
66 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | 68 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) |
69 #define DEFINE_implication(whenflag, thenflag) | |
70 | |
71 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS) | |
Michael Starzinger
2011/12/15 16:23:16
Can we add a short comment explaining the defines
| |
72 #define FLAG_FULL(ftype, ctype, nam, def, cmt) | |
73 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | |
74 #define DEFINE_implication(whenflag, thenflag) \ | |
75 if (FLAG_##whenflag) FLAG_##thenflag = true; | |
67 | 76 |
68 #else | 77 #else |
69 #error No mode supplied when including flags.defs | 78 #error No mode supplied when including flags.defs |
70 #endif | 79 #endif |
71 | 80 |
72 #ifdef FLAG_MODE_DECLARE | 81 #ifdef FLAG_MODE_DECLARE |
73 // Structure used to hold a collection of arguments to the JavaScript code. | 82 // Structure used to hold a collection of arguments to the JavaScript code. |
74 struct JSArguments { | 83 struct JSArguments { |
75 public: | 84 public: |
76 JSArguments(); | 85 JSArguments(); |
(...skipping 19 matching lines...) Expand all Loading... | |
96 // | 105 // |
97 #define FLAG FLAG_FULL | 106 #define FLAG FLAG_FULL |
98 | 107 |
99 // Flags for experimental language features. | 108 // Flags for experimental language features. |
100 DEFINE_bool(harmony_typeof, false, "enable harmony semantics for typeof") | 109 DEFINE_bool(harmony_typeof, false, "enable harmony semantics for typeof") |
101 DEFINE_bool(harmony_scoping, false, "enable harmony block scoping") | 110 DEFINE_bool(harmony_scoping, false, "enable harmony block scoping") |
102 DEFINE_bool(harmony_proxies, false, "enable harmony proxies") | 111 DEFINE_bool(harmony_proxies, false, "enable harmony proxies") |
103 DEFINE_bool(harmony_collections, false, | 112 DEFINE_bool(harmony_collections, false, |
104 "enable harmony collections (sets, maps, and weak maps)") | 113 "enable harmony collections (sets, maps, and weak maps)") |
105 DEFINE_bool(harmony, false, "enable all harmony features") | 114 DEFINE_bool(harmony, false, "enable all harmony features") |
115 DEFINE_implication(harmony, harmony_typeof) | |
116 DEFINE_implication(harmony, harmony_scoping) | |
117 DEFINE_implication(harmony, harmony_proxies) | |
118 DEFINE_implication(harmony, harmony_collections) | |
106 | 119 |
107 // Flags for experimental implementation features. | 120 // Flags for experimental implementation features. |
108 DEFINE_bool(unbox_double_arrays, true, "automatically unbox arrays of doubles") | 121 DEFINE_bool(unbox_double_arrays, true, "automatically unbox arrays of doubles") |
109 DEFINE_bool(smi_only_arrays, false, "tracks arrays with only smi values") | 122 DEFINE_bool(smi_only_arrays, false, "tracks arrays with only smi values") |
110 DEFINE_bool(string_slices, true, "use string slices") | 123 DEFINE_bool(string_slices, true, "use string slices") |
111 | 124 |
112 DEFINE_bool(clever_optimizations, | 125 DEFINE_bool(clever_optimizations, |
113 true, | 126 true, |
114 "Optimize object size, Array shift, DOM strings and string +") | 127 "Optimize object size, Array shift, DOM strings and string +") |
115 | 128 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 DEFINE_bool(print_code_stubs, false, "print code stubs") | 548 DEFINE_bool(print_code_stubs, false, "print code stubs") |
536 | 549 |
537 // codegen-ia32.cc / codegen-arm.cc | 550 // codegen-ia32.cc / codegen-arm.cc |
538 DEFINE_bool(print_code, false, "print generated code") | 551 DEFINE_bool(print_code, false, "print generated code") |
539 DEFINE_bool(print_opt_code, false, "print optimized code") | 552 DEFINE_bool(print_opt_code, false, "print optimized code") |
540 DEFINE_bool(print_unopt_code, false, "print unoptimized code before " | 553 DEFINE_bool(print_unopt_code, false, "print unoptimized code before " |
541 "printing optimized code based on it") | 554 "printing optimized code based on it") |
542 DEFINE_bool(print_code_verbose, false, "print more information for code") | 555 DEFINE_bool(print_code_verbose, false, "print more information for code") |
543 DEFINE_bool(print_builtin_code, false, "print generated code for builtins") | 556 DEFINE_bool(print_builtin_code, false, "print generated code for builtins") |
544 | 557 |
558 DEFINE_bool(print_all_code, false, "enable all flags related to printing code") | |
559 DEFINE_implication(print_all_code, print_code) | |
560 DEFINE_implication(print_all_code, print_opt_code) | |
561 DEFINE_implication(print_all_code, print_unopt_code) | |
562 DEFINE_implication(print_all_code, print_code_verbose) | |
563 DEFINE_implication(print_all_code, print_builtin_code) | |
564 DEFINE_implication(print_all_code, print_code_stubs) | |
565 DEFINE_implication(print_all_code, trace_codegen) | |
566 | |
545 // Cleanup... | 567 // Cleanup... |
546 #undef FLAG_FULL | 568 #undef FLAG_FULL |
547 #undef FLAG_READONLY | 569 #undef FLAG_READONLY |
548 #undef FLAG | 570 #undef FLAG |
549 | 571 |
550 #undef DEFINE_bool | 572 #undef DEFINE_bool |
551 #undef DEFINE_int | 573 #undef DEFINE_int |
552 #undef DEFINE_string | 574 #undef DEFINE_string |
575 #undef DEFINE_implication | |
553 | 576 |
554 #undef FLAG_MODE_DECLARE | 577 #undef FLAG_MODE_DECLARE |
555 #undef FLAG_MODE_DEFINE | 578 #undef FLAG_MODE_DEFINE |
556 #undef FLAG_MODE_DEFINE_DEFAULTS | 579 #undef FLAG_MODE_DEFINE_DEFAULTS |
557 #undef FLAG_MODE_META | 580 #undef FLAG_MODE_META |
581 #undef FLAG_MODE_DEFINE_IMPLICATIONS | |
OLD | NEW |