Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #ifndef FLAG_ALIAS | 85 #ifndef FLAG_ALIAS |
| 86 #define FLAG_ALIAS(ftype, ctype, alias, nam) | 86 #define FLAG_ALIAS(ftype, ctype, alias, nam) |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 #ifndef DEFINE_implication | 89 #ifndef DEFINE_implication |
| 90 #define DEFINE_implication(whenflag, thenflag) | 90 #define DEFINE_implication(whenflag, thenflag) |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 #define COMMA , | |
| 93 | 94 |
| 94 #ifdef FLAG_MODE_DECLARE | 95 #ifdef FLAG_MODE_DECLARE |
| 95 // Structure used to hold a collection of arguments to the JavaScript code. | 96 // Structure used to hold a collection of arguments to the JavaScript code. |
| 96 #define JSARGUMENTS_INIT {{}} | |
| 97 struct JSArguments { | 97 struct JSArguments { |
| 98 public: | 98 public: |
| 99 inline int argc() const { | |
| 100 return static_cast<int>(storage_[0]); | |
| 101 } | |
| 102 inline const char** argv() const { | |
| 103 return reinterpret_cast<const char**>(storage_[1]); | |
| 104 } | |
| 105 inline const char*& operator[] (int idx) const { | 99 inline const char*& operator[] (int idx) const { |
| 106 return argv()[idx]; | 100 return argv[idx]; |
| 107 } | |
| 108 inline JSArguments& operator=(JSArguments args) { | |
| 109 set_argc(args.argc()); | |
| 110 set_argv(args.argv()); | |
| 111 return *this; | |
| 112 } | 101 } |
| 113 static JSArguments Create(int argc, const char** argv) { | 102 static JSArguments Create(int argc, const char** argv) { |
| 114 JSArguments args; | 103 JSArguments args; |
| 115 args.set_argc(argc); | 104 args.argc = argc; |
| 116 args.set_argv(argv); | 105 args.argv = argv; |
| 117 return args; | 106 return args; |
| 118 } | 107 } |
| 119 private: | 108 int argc; |
|
Sven Panne
2013/09/17 13:46:49
Let's hope that the previous type "AtomicWord" did
| |
| 120 void set_argc(int argc) { | 109 const char** argv; |
| 121 storage_[0] = argc; | 110 }; |
| 111 | |
| 112 struct MaybeBoolFlag { | |
| 113 static MaybeBoolFlag Create(bool has_value, bool value) { | |
| 114 MaybeBoolFlag flag; | |
| 115 flag.has_value = has_value; | |
| 116 flag.value = value; | |
| 117 return flag; | |
| 122 } | 118 } |
| 123 void set_argv(const char** argv) { | 119 bool has_value; |
| 124 storage_[1] = reinterpret_cast<AtomicWord>(argv); | 120 bool value; |
| 125 } | |
| 126 public: | |
| 127 // Contains argc and argv. Unfortunately we have to store these two fields | |
| 128 // into a single one to avoid making the initialization macro (which would be | |
| 129 // "{ 0, NULL }") contain a coma. | |
| 130 AtomicWord storage_[2]; | |
| 131 }; | 121 }; |
| 132 #endif | 122 #endif |
| 133 | 123 |
| 134 #if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST) | 124 #if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST) |
| 135 # define ENABLE_VFP3_DEFAULT true | 125 # define ENABLE_VFP3_DEFAULT true |
| 136 #else | 126 #else |
| 137 # define ENABLE_VFP3_DEFAULT false | 127 # define ENABLE_VFP3_DEFAULT false |
| 138 #endif | 128 #endif |
| 139 #if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST) | 129 #if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST) |
| 140 # define ENABLE_ARMV7_DEFAULT true | 130 # define ENABLE_ARMV7_DEFAULT true |
| 141 #else | 131 #else |
| 142 # define ENABLE_ARMV7_DEFAULT false | 132 # define ENABLE_ARMV7_DEFAULT false |
| 143 #endif | 133 #endif |
| 144 #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST) | 134 #if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST) |
| 145 # define ENABLE_32DREGS_DEFAULT true | 135 # define ENABLE_32DREGS_DEFAULT true |
| 146 #else | 136 #else |
| 147 # define ENABLE_32DREGS_DEFAULT false | 137 # define ENABLE_32DREGS_DEFAULT false |
| 148 #endif | 138 #endif |
| 149 | 139 |
| 150 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) | 140 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) |
| 141 #define DEFINE_maybe_bool(nam, cmt) FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, \ | |
| 142 { false COMMA false }, cmt) | |
| 151 #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt) | 143 #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt) |
| 152 #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt) | 144 #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt) |
| 153 #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt) | 145 #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt) |
| 154 #define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt) | 146 #define DEFINE_args(nam, cmt) FLAG(ARGS, JSArguments, nam, \ |
| 147 { 0 COMMA NULL }, cmt) | |
| 155 | 148 |
| 156 #define DEFINE_ALIAS_bool(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam) | 149 #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) | 150 #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) | 151 #define DEFINE_ALIAS_float(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam) |
| 159 #define DEFINE_ALIAS_string(alias, nam) \ | 152 #define DEFINE_ALIAS_string(alias, nam) \ |
| 160 FLAG_ALIAS(STRING, const char*, alias, nam) | 153 FLAG_ALIAS(STRING, const char*, alias, nam) |
| 161 #define DEFINE_ALIAS_args(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam) | 154 #define DEFINE_ALIAS_args(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam) |
| 162 | 155 |
| 163 // | 156 // |
| 164 // Flags in all modes. | 157 // Flags in all modes. |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 DEFINE_bool(preallocate_message_memory, false, | 586 DEFINE_bool(preallocate_message_memory, false, |
| 594 "preallocate some memory to build stack traces.") | 587 "preallocate some memory to build stack traces.") |
| 595 DEFINE_bool(randomize_hashes, | 588 DEFINE_bool(randomize_hashes, |
| 596 true, | 589 true, |
| 597 "randomize hashes to avoid predictable hash collisions " | 590 "randomize hashes to avoid predictable hash collisions " |
| 598 "(with snapshots this option cannot override the baked-in seed)") | 591 "(with snapshots this option cannot override the baked-in seed)") |
| 599 DEFINE_int(hash_seed, | 592 DEFINE_int(hash_seed, |
| 600 0, | 593 0, |
| 601 "Fixed seed to use to hash property keys (0 means random)" | 594 "Fixed seed to use to hash property keys (0 means random)" |
| 602 "(with snapshots this option cannot override the baked-in seed)") | 595 "(with snapshots this option cannot override the baked-in seed)") |
| 596 DEFINE_maybe_bool(force_memory_constrained, | |
| 597 "force (if true) or prevent (if false) the runtime from treating " | |
| 598 "the device as being memory constrained.") | |
| 603 | 599 |
| 604 // v8.cc | 600 // v8.cc |
| 605 DEFINE_bool(preemption, false, | 601 DEFINE_bool(preemption, false, |
| 606 "activate a 100ms timer that switches between V8 threads") | 602 "activate a 100ms timer that switches between V8 threads") |
| 607 | 603 |
| 608 // Regexp | 604 // Regexp |
| 609 DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") | 605 DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") |
| 610 | 606 |
| 611 // Testing flags test/cctest/test-{flags,api,serialization}.cc | 607 // Testing flags test/cctest/test-{flags,api,serialization}.cc |
| 612 DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") | 608 DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") |
| 609 DEFINE_maybe_bool(testing_maybe_bool_flag, "testing_maybe_bool_flag") | |
| 613 DEFINE_int(testing_int_flag, 13, "testing_int_flag") | 610 DEFINE_int(testing_int_flag, 13, "testing_int_flag") |
| 614 DEFINE_float(testing_float_flag, 2.5, "float-flag") | 611 DEFINE_float(testing_float_flag, 2.5, "float-flag") |
| 615 DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") | 612 DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") |
| 616 DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") | 613 DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") |
| 617 #ifdef _WIN32 | 614 #ifdef _WIN32 |
| 618 DEFINE_string(testing_serialization_file, "C:\\Windows\\Temp\\serdes", | 615 DEFINE_string(testing_serialization_file, "C:\\Windows\\Temp\\serdes", |
| 619 "file in which to testing_serialize heap") | 616 "file in which to testing_serialize heap") |
| 620 #else | 617 #else |
| 621 DEFINE_string(testing_serialization_file, "/tmp/serdes", | 618 DEFINE_string(testing_serialization_file, "/tmp/serdes", |
| 622 "file in which to serialize heap") | 619 "file in which to serialize heap") |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 635 | 632 |
| 636 #ifdef ENABLE_DEBUGGER_SUPPORT | 633 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 637 DEFINE_bool(debugger, false, "Enable JavaScript debugger") | 634 DEFINE_bool(debugger, false, "Enable JavaScript debugger") |
| 638 DEFINE_bool(remote_debugger, false, "Connect JavaScript debugger to the " | 635 DEFINE_bool(remote_debugger, false, "Connect JavaScript debugger to the " |
| 639 "debugger agent in another process") | 636 "debugger agent in another process") |
| 640 DEFINE_bool(debugger_agent, false, "Enable debugger agent") | 637 DEFINE_bool(debugger_agent, false, "Enable debugger agent") |
| 641 DEFINE_int(debugger_port, 5858, "Port to use for remote debugging") | 638 DEFINE_int(debugger_port, 5858, "Port to use for remote debugging") |
| 642 #endif // ENABLE_DEBUGGER_SUPPORT | 639 #endif // ENABLE_DEBUGGER_SUPPORT |
| 643 | 640 |
| 644 DEFINE_string(map_counters, "", "Map counters to a file") | 641 DEFINE_string(map_counters, "", "Map counters to a file") |
| 645 DEFINE_args(js_arguments, JSARGUMENTS_INIT, | 642 DEFINE_args(js_arguments, |
| 646 "Pass all remaining arguments to the script. Alias for \"--\".") | 643 "Pass all remaining arguments to the script. Alias for \"--\".") |
| 647 | 644 |
| 648 #if defined(WEBOS__) | 645 #if defined(WEBOS__) |
| 649 DEFINE_bool(debug_compile_events, false, "Enable debugger compile events") | 646 DEFINE_bool(debug_compile_events, false, "Enable debugger compile events") |
| 650 DEFINE_bool(debug_script_collected_events, false, | 647 DEFINE_bool(debug_script_collected_events, false, |
| 651 "Enable debugger script collected events") | 648 "Enable debugger script collected events") |
| 652 #else | 649 #else |
| 653 DEFINE_bool(debug_compile_events, true, "Enable debugger compile events") | 650 DEFINE_bool(debug_compile_events, true, "Enable debugger compile events") |
| 654 DEFINE_bool(debug_script_collected_events, true, | 651 DEFINE_bool(debug_script_collected_events, true, |
| 655 "Enable debugger script collected events") | 652 "Enable debugger script collected events") |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 #endif | 824 #endif |
| 828 #endif | 825 #endif |
| 829 | 826 |
| 830 // Cleanup... | 827 // Cleanup... |
| 831 #undef FLAG_FULL | 828 #undef FLAG_FULL |
| 832 #undef FLAG_READONLY | 829 #undef FLAG_READONLY |
| 833 #undef FLAG | 830 #undef FLAG |
| 834 #undef FLAG_ALIAS | 831 #undef FLAG_ALIAS |
| 835 | 832 |
| 836 #undef DEFINE_bool | 833 #undef DEFINE_bool |
| 834 #undef DEFINE_maybe_bool | |
| 837 #undef DEFINE_int | 835 #undef DEFINE_int |
| 838 #undef DEFINE_string | 836 #undef DEFINE_string |
| 839 #undef DEFINE_float | 837 #undef DEFINE_float |
| 840 #undef DEFINE_args | 838 #undef DEFINE_args |
| 841 #undef DEFINE_implication | 839 #undef DEFINE_implication |
| 842 #undef DEFINE_ALIAS_bool | 840 #undef DEFINE_ALIAS_bool |
| 843 #undef DEFINE_ALIAS_int | 841 #undef DEFINE_ALIAS_int |
| 844 #undef DEFINE_ALIAS_string | 842 #undef DEFINE_ALIAS_string |
| 845 #undef DEFINE_ALIAS_float | 843 #undef DEFINE_ALIAS_float |
| 846 #undef DEFINE_ALIAS_args | 844 #undef DEFINE_ALIAS_args |
| 847 | 845 |
| 848 #undef FLAG_MODE_DECLARE | 846 #undef FLAG_MODE_DECLARE |
| 849 #undef FLAG_MODE_DEFINE | 847 #undef FLAG_MODE_DEFINE |
| 850 #undef FLAG_MODE_DEFINE_DEFAULTS | 848 #undef FLAG_MODE_DEFINE_DEFAULTS |
| 851 #undef FLAG_MODE_META | 849 #undef FLAG_MODE_META |
| 852 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 850 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
| 851 | |
| 852 #undef COMMA | |
| OLD | NEW |