Chromium Code Reviews| Index: src/flag-definitions.h |
| diff --git a/src/flag-definitions.h b/src/flag-definitions.h |
| index cc153af2542dfca612c4e12c579318931190acbd..8338e7f5aa6b9f14092a7537a79ebf4d0c487dad 100644 |
| --- a/src/flag-definitions.h |
| +++ b/src/flag-definitions.h |
| @@ -90,44 +90,34 @@ |
| #define DEFINE_implication(whenflag, thenflag) |
| #endif |
| +#define COMMA , |
| #ifdef FLAG_MODE_DECLARE |
| // Structure used to hold a collection of arguments to the JavaScript code. |
| -#define JSARGUMENTS_INIT {{}} |
| struct JSArguments { |
| public: |
| - inline int argc() const { |
| - return static_cast<int>(storage_[0]); |
| - } |
| - inline const char** argv() const { |
| - return reinterpret_cast<const char**>(storage_[1]); |
| - } |
| inline const char*& operator[] (int idx) const { |
| - return argv()[idx]; |
| - } |
| - inline JSArguments& operator=(JSArguments args) { |
| - set_argc(args.argc()); |
| - set_argv(args.argv()); |
| - return *this; |
| + return argv[idx]; |
| } |
| static JSArguments Create(int argc, const char** argv) { |
| JSArguments args; |
| - args.set_argc(argc); |
| - args.set_argv(argv); |
| + args.argc = argc; |
| + args.argv = argv; |
| return args; |
| } |
| -private: |
| - void set_argc(int argc) { |
| - storage_[0] = argc; |
| - } |
| - void set_argv(const char** argv) { |
| - storage_[1] = reinterpret_cast<AtomicWord>(argv); |
| + int argc; |
|
Sven Panne
2013/09/17 13:46:49
Let's hope that the previous type "AtomicWord" did
|
| + const char** argv; |
| +}; |
| + |
| +struct MaybeBoolFlag { |
| + static MaybeBoolFlag Create(bool has_value, bool value) { |
| + MaybeBoolFlag flag; |
| + flag.has_value = has_value; |
| + flag.value = value; |
| + return flag; |
| } |
| -public: |
| - // Contains argc and argv. Unfortunately we have to store these two fields |
| - // into a single one to avoid making the initialization macro (which would be |
| - // "{ 0, NULL }") contain a coma. |
| - AtomicWord storage_[2]; |
| + bool has_value; |
| + bool value; |
| }; |
| #endif |
| @@ -148,10 +138,13 @@ public: |
| #endif |
| #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) |
| +#define DEFINE_maybe_bool(nam, cmt) FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, \ |
| + { false COMMA false }, cmt) |
| #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt) |
| #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt) |
| #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt) |
| -#define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt) |
| +#define DEFINE_args(nam, cmt) FLAG(ARGS, JSArguments, nam, \ |
| + { 0 COMMA NULL }, cmt) |
| #define DEFINE_ALIAS_bool(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam) |
| #define DEFINE_ALIAS_int(alias, nam) FLAG_ALIAS(INT, int, alias, nam) |
| @@ -600,6 +593,9 @@ DEFINE_int(hash_seed, |
| 0, |
| "Fixed seed to use to hash property keys (0 means random)" |
| "(with snapshots this option cannot override the baked-in seed)") |
| +DEFINE_maybe_bool(force_memory_constrained, |
| + "force (if true) or prevent (if false) the runtime from treating " |
| + "the device as being memory constrained.") |
| // v8.cc |
| DEFINE_bool(preemption, false, |
| @@ -610,6 +606,7 @@ DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") |
| // Testing flags test/cctest/test-{flags,api,serialization}.cc |
| DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") |
| +DEFINE_maybe_bool(testing_maybe_bool_flag, "testing_maybe_bool_flag") |
| DEFINE_int(testing_int_flag, 13, "testing_int_flag") |
| DEFINE_float(testing_float_flag, 2.5, "float-flag") |
| DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") |
| @@ -642,7 +639,7 @@ DEFINE_int(debugger_port, 5858, "Port to use for remote debugging") |
| #endif // ENABLE_DEBUGGER_SUPPORT |
| DEFINE_string(map_counters, "", "Map counters to a file") |
| -DEFINE_args(js_arguments, JSARGUMENTS_INIT, |
| +DEFINE_args(js_arguments, |
| "Pass all remaining arguments to the script. Alias for \"--\".") |
| #if defined(WEBOS__) |
| @@ -834,6 +831,7 @@ DEFINE_implication(print_all_code, trace_codegen) |
| #undef FLAG_ALIAS |
| #undef DEFINE_bool |
| +#undef DEFINE_maybe_bool |
| #undef DEFINE_int |
| #undef DEFINE_string |
| #undef DEFINE_float |
| @@ -850,3 +848,5 @@ DEFINE_implication(print_all_code, trace_codegen) |
| #undef FLAG_MODE_DEFINE_DEFAULTS |
| #undef FLAG_MODE_META |
| #undef FLAG_MODE_DEFINE_IMPLICATIONS |
| + |
| +#undef COMMA |