Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: src/flag-definitions.h

Issue 9666052: Landing for pliard@chromium.org: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #define FLAG_READONLY(ftype, ctype, nam, def, cmt) 74 #define FLAG_READONLY(ftype, ctype, nam, def, cmt)
75 #define DEFINE_implication(whenflag, thenflag) \ 75 #define DEFINE_implication(whenflag, thenflag) \
76 if (FLAG_##whenflag) FLAG_##thenflag = true; 76 if (FLAG_##whenflag) FLAG_##thenflag = true;
77 77
78 #else 78 #else
79 #error No mode supplied when including flags.defs 79 #error No mode supplied when including flags.defs
80 #endif 80 #endif
81 81
82 #ifdef FLAG_MODE_DECLARE 82 #ifdef FLAG_MODE_DECLARE
83 // Structure used to hold a collection of arguments to the JavaScript code. 83 // Structure used to hold a collection of arguments to the JavaScript code.
84 #define JSARGUMENTS_INIT {{}}
84 struct JSArguments { 85 struct JSArguments {
85 public: 86 public:
86 JSArguments(); 87 inline int argc() const {
87 JSArguments(int argc, const char** argv); 88 return static_cast<int>(storage_[0]);
88 int argc() const; 89 }
89 const char** argv(); 90 inline const char** argv() const {
90 const char*& operator[](int idx); 91 return reinterpret_cast<const char**>(storage_[1]);
91 JSArguments& operator=(JSArguments args); 92 }
93 inline const char*& operator[] (int idx) const {
94 return argv()[idx];
95 }
96 inline JSArguments& operator=(JSArguments args) {
97 set_argc(args.argc());
98 set_argv(args.argv());
99 return *this;
100 }
101 static JSArguments Create(int argc, const char** argv) {
102 JSArguments args;
103 args.set_argc(argc);
104 args.set_argv(argv);
105 return args;
106 }
92 private: 107 private:
93 int argc_; 108 void set_argc(int argc) {
94 const char** argv_; 109 storage_[0] = argc;
110 }
111 void set_argv(const char** argv) {
112 storage_[1] = reinterpret_cast<AtomicWord>(argv);
113 }
114 public:
115 // Contains argc and argv. Unfortunately we have to store these two fields
116 // into a single one to avoid making the initialization macro (which would be
117 // "{ 0, NULL }") contain a coma.
118 AtomicWord storage_[2];
95 }; 119 };
96 #endif 120 #endif
97 121
98 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt) 122 #define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
99 #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt) 123 #define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
100 #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt) 124 #define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
101 #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt) 125 #define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
102 #define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt) 126 #define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt)
103 127
104 // 128 //
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 434
411 #ifdef ENABLE_DEBUGGER_SUPPORT 435 #ifdef ENABLE_DEBUGGER_SUPPORT
412 DEFINE_bool(debugger, false, "Enable JavaScript debugger") 436 DEFINE_bool(debugger, false, "Enable JavaScript debugger")
413 DEFINE_bool(remote_debugger, false, "Connect JavaScript debugger to the " 437 DEFINE_bool(remote_debugger, false, "Connect JavaScript debugger to the "
414 "debugger agent in another process") 438 "debugger agent in another process")
415 DEFINE_bool(debugger_agent, false, "Enable debugger agent") 439 DEFINE_bool(debugger_agent, false, "Enable debugger agent")
416 DEFINE_int(debugger_port, 5858, "Port to use for remote debugging") 440 DEFINE_int(debugger_port, 5858, "Port to use for remote debugging")
417 #endif // ENABLE_DEBUGGER_SUPPORT 441 #endif // ENABLE_DEBUGGER_SUPPORT
418 442
419 DEFINE_string(map_counters, "", "Map counters to a file") 443 DEFINE_string(map_counters, "", "Map counters to a file")
420 DEFINE_args(js_arguments, JSArguments(), 444 DEFINE_args(js_arguments, JSARGUMENTS_INIT,
421 "Pass all remaining arguments to the script. Alias for \"--\".") 445 "Pass all remaining arguments to the script. Alias for \"--\".")
422 446
423 #if defined(WEBOS__) 447 #if defined(WEBOS__)
424 DEFINE_bool(debug_compile_events, false, "Enable debugger compile events") 448 DEFINE_bool(debug_compile_events, false, "Enable debugger compile events")
425 DEFINE_bool(debug_script_collected_events, false, 449 DEFINE_bool(debug_script_collected_events, false,
426 "Enable debugger script collected events") 450 "Enable debugger script collected events")
427 #else 451 #else
428 DEFINE_bool(debug_compile_events, true, "Enable debugger compile events") 452 DEFINE_bool(debug_compile_events, true, "Enable debugger compile events")
429 DEFINE_bool(debug_script_collected_events, true, 453 DEFINE_bool(debug_script_collected_events, true,
430 "Enable debugger script collected events") 454 "Enable debugger script collected events")
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 #undef DEFINE_bool 637 #undef DEFINE_bool
614 #undef DEFINE_int 638 #undef DEFINE_int
615 #undef DEFINE_string 639 #undef DEFINE_string
616 #undef DEFINE_implication 640 #undef DEFINE_implication
617 641
618 #undef FLAG_MODE_DECLARE 642 #undef FLAG_MODE_DECLARE
619 #undef FLAG_MODE_DEFINE 643 #undef FLAG_MODE_DEFINE
620 #undef FLAG_MODE_DEFINE_DEFAULTS 644 #undef FLAG_MODE_DEFINE_DEFAULTS
621 #undef FLAG_MODE_META 645 #undef FLAG_MODE_META
622 #undef FLAG_MODE_DEFINE_IMPLICATIONS 646 #undef FLAG_MODE_DEFINE_IMPLICATIONS
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698