OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file defines all of the flags. It is separated into different section, | 5 // This file defines all of the flags. It is separated into different section, |
6 // for Debug, Release, Logging and Profiling, etc. To add a new flag, find the | 6 // for Debug, Release, Logging and Profiling, etc. To add a new flag, find the |
7 // correct section, and use one of the DEFINE_ macros, without a trailing ';'. | 7 // correct section, and use one of the DEFINE_ macros, without a trailing ';'. |
8 // | 8 // |
9 // This include does not have a guard, because it is a template-style include, | 9 // This include does not have a guard, because it is a template-style include, |
10 // which can be included multiple times in different modes. It expects to have | 10 // which can be included multiple times in different modes. It expects to have |
11 // a mode defined before it's included. The modes are FLAG_MODE_... below: | 11 // a mode defined before it's included. The modes are FLAG_MODE_... below: |
12 | 12 |
13 #define DEFINE_IMPLICATION(whenflag, thenflag) \ | 13 #define DEFINE_IMPLICATION(whenflag, thenflag) \ |
14 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, true) | 14 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, true) |
15 | 15 |
16 #define DEFINE_NEG_IMPLICATION(whenflag, thenflag) \ | 16 #define DEFINE_NEG_IMPLICATION(whenflag, thenflag) \ |
17 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, false) | 17 DEFINE_VALUE_IMPLICATION(whenflag, thenflag, false) |
18 | 18 |
| 19 #define DEFINE_NEG_NEG_IMPLICATION(whenflag, thenflag) \ |
| 20 DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, false) |
| 21 |
19 // We want to declare the names of the variables for the header file. Normally | 22 // We want to declare the names of the variables for the header file. Normally |
20 // this will just be an extern declaration, but for a readonly flag we let the | 23 // this will just be an extern declaration, but for a readonly flag we let the |
21 // compiler make better optimizations by giving it the value. | 24 // compiler make better optimizations by giving it the value. |
22 #if defined(FLAG_MODE_DECLARE) | 25 #if defined(FLAG_MODE_DECLARE) |
23 #define FLAG_FULL(ftype, ctype, nam, def, cmt) extern ctype FLAG_##nam; | 26 #define FLAG_FULL(ftype, ctype, nam, def, cmt) extern ctype FLAG_##nam; |
24 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \ | 27 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \ |
25 static ctype const FLAG_##nam = def; | 28 static ctype const FLAG_##nam = def; |
26 | 29 |
27 // We want to supply the actual storage and value for the flag variable in the | 30 // We want to supply the actual storage and value for the flag variable in the |
28 // .cc file. We only do this for writable flags. | 31 // .cc file. We only do this for writable flags. |
(...skipping 18 matching lines...) Expand all Loading... |
47 Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \ | 50 Flag::TYPE_##ftype, #alias, &FLAG_##nam, &FLAGDEFAULT_##nam, \ |
48 "alias for --" #nam, false \ | 51 "alias for --" #nam, false \ |
49 } \ | 52 } \ |
50 , | 53 , |
51 | 54 |
52 // We produce the code to set flags when it is implied by another flag. | 55 // We produce the code to set flags when it is implied by another flag. |
53 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS) | 56 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS) |
54 #define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) \ | 57 #define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) \ |
55 if (FLAG_##whenflag) FLAG_##thenflag = value; | 58 if (FLAG_##whenflag) FLAG_##thenflag = value; |
56 | 59 |
| 60 #define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value) \ |
| 61 if (!FLAG_##whenflag) FLAG_##thenflag = value; |
| 62 |
57 #else | 63 #else |
58 #error No mode supplied when including flags.defs | 64 #error No mode supplied when including flags.defs |
59 #endif | 65 #endif |
60 | 66 |
61 // Dummy defines for modes where it is not relevant. | 67 // Dummy defines for modes where it is not relevant. |
62 #ifndef FLAG_FULL | 68 #ifndef FLAG_FULL |
63 #define FLAG_FULL(ftype, ctype, nam, def, cmt) | 69 #define FLAG_FULL(ftype, ctype, nam, def, cmt) |
64 #endif | 70 #endif |
65 | 71 |
66 #ifndef FLAG_READONLY | 72 #ifndef FLAG_READONLY |
67 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) | 73 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) |
68 #endif | 74 #endif |
69 | 75 |
70 #ifndef FLAG_ALIAS | 76 #ifndef FLAG_ALIAS |
71 #define FLAG_ALIAS(ftype, ctype, alias, nam) | 77 #define FLAG_ALIAS(ftype, ctype, alias, nam) |
72 #endif | 78 #endif |
73 | 79 |
74 #ifndef DEFINE_VALUE_IMPLICATION | 80 #ifndef DEFINE_VALUE_IMPLICATION |
75 #define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) | 81 #define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) |
76 #endif | 82 #endif |
77 | 83 |
| 84 #ifndef DEFINE_NEG_VALUE_IMPLICATION |
| 85 #define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value) |
| 86 #endif |
| 87 |
78 #define COMMA , | 88 #define COMMA , |
79 | 89 |
80 #ifdef FLAG_MODE_DECLARE | 90 #ifdef FLAG_MODE_DECLARE |
81 // Structure used to hold a collection of arguments to the JavaScript code. | 91 // Structure used to hold a collection of arguments to the JavaScript code. |
82 struct JSArguments { | 92 struct JSArguments { |
83 public: | 93 public: |
84 inline const char*& operator[](int idx) const { return argv[idx]; } | 94 inline const char*& operator[](int idx) const { return argv[idx]; } |
85 static JSArguments Create(int argc, const char** argv) { | 95 static JSArguments Create(int argc, const char** argv) { |
86 JSArguments args; | 96 JSArguments args; |
87 args.argc = argc; | 97 args.argc = argc; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 DEFINE_BOOL(id, false, "enable " #description " (in progress)") | 205 DEFINE_BOOL(id, false, "enable " #description " (in progress)") |
196 HARMONY_INPROGRESS(FLAG_INPROGRESS_FEATURES) | 206 HARMONY_INPROGRESS(FLAG_INPROGRESS_FEATURES) |
197 #undef FLAG_INPROGRESS_FEATURES | 207 #undef FLAG_INPROGRESS_FEATURES |
198 | 208 |
199 #define FLAG_STAGED_FEATURES(id, description) \ | 209 #define FLAG_STAGED_FEATURES(id, description) \ |
200 DEFINE_BOOL(id, false, "enable " #description) \ | 210 DEFINE_BOOL(id, false, "enable " #description) \ |
201 DEFINE_IMPLICATION(es_staging, id) | 211 DEFINE_IMPLICATION(es_staging, id) |
202 HARMONY_STAGED(FLAG_STAGED_FEATURES) | 212 HARMONY_STAGED(FLAG_STAGED_FEATURES) |
203 #undef FLAG_STAGED_FEATURES | 213 #undef FLAG_STAGED_FEATURES |
204 | 214 |
205 #define FLAG_SHIPPING_FEATURES(id, description) \ | 215 #define FLAG_SHIPPING_FEATURES(id, description) \ |
206 DEFINE_BOOL(id, false, "enable " #description) \ | 216 DEFINE_BOOL(id, true, "enable " #description) \ |
207 DEFINE_IMPLICATION(harmony_shipping, id) | 217 DEFINE_NEG_NEG_IMPLICATION(harmony_shipping, id) |
208 HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES) | 218 HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES) |
209 #undef FLAG_SHIPPING_FEATURES | 219 #undef FLAG_SHIPPING_FEATURES |
210 | 220 |
211 | 221 |
212 // Feature dependencies. | 222 // Feature dependencies. |
213 DEFINE_IMPLICATION(harmony_modules, harmony_scoping) | 223 DEFINE_IMPLICATION(harmony_modules, harmony_scoping) |
214 DEFINE_IMPLICATION(harmony_classes, harmony_scoping) | 224 DEFINE_IMPLICATION(harmony_classes, harmony_scoping) |
215 DEFINE_IMPLICATION(harmony_classes, harmony_object_literals) | 225 DEFINE_IMPLICATION(harmony_classes, harmony_object_literals) |
216 | 226 |
217 | 227 |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 #undef FLAG_ALIAS | 988 #undef FLAG_ALIAS |
979 | 989 |
980 #undef DEFINE_BOOL | 990 #undef DEFINE_BOOL |
981 #undef DEFINE_MAYBE_BOOL | 991 #undef DEFINE_MAYBE_BOOL |
982 #undef DEFINE_INT | 992 #undef DEFINE_INT |
983 #undef DEFINE_STRING | 993 #undef DEFINE_STRING |
984 #undef DEFINE_FLOAT | 994 #undef DEFINE_FLOAT |
985 #undef DEFINE_ARGS | 995 #undef DEFINE_ARGS |
986 #undef DEFINE_IMPLICATION | 996 #undef DEFINE_IMPLICATION |
987 #undef DEFINE_NEG_IMPLICATION | 997 #undef DEFINE_NEG_IMPLICATION |
| 998 #undef DEFINE_NEG_VALUE_IMPLICATION |
988 #undef DEFINE_VALUE_IMPLICATION | 999 #undef DEFINE_VALUE_IMPLICATION |
989 #undef DEFINE_ALIAS_BOOL | 1000 #undef DEFINE_ALIAS_BOOL |
990 #undef DEFINE_ALIAS_INT | 1001 #undef DEFINE_ALIAS_INT |
991 #undef DEFINE_ALIAS_STRING | 1002 #undef DEFINE_ALIAS_STRING |
992 #undef DEFINE_ALIAS_FLOAT | 1003 #undef DEFINE_ALIAS_FLOAT |
993 #undef DEFINE_ALIAS_ARGS | 1004 #undef DEFINE_ALIAS_ARGS |
994 | 1005 |
995 #undef FLAG_MODE_DECLARE | 1006 #undef FLAG_MODE_DECLARE |
996 #undef FLAG_MODE_DEFINE | 1007 #undef FLAG_MODE_DEFINE |
997 #undef FLAG_MODE_DEFINE_DEFAULTS | 1008 #undef FLAG_MODE_DEFINE_DEFAULTS |
998 #undef FLAG_MODE_META | 1009 #undef FLAG_MODE_META |
999 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 1010 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
1000 | 1011 |
1001 #undef COMMA | 1012 #undef COMMA |
OLD | NEW |