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

Side by Side Diff: runtime/vm/flags.cc

Issue 1663863002: Add product mode: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Reworked the flags setting: Moving to single file for all flag defintions. Created 4 years, 10 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
« no previous file with comments | « runtime/vm/flags.h ('k') | runtime/vm/flow_graph_compiler.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flags.h" 5 #include "vm/flags.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/json_stream.h" 8 #include "vm/json_stream.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_FLAG(bool, print_flags, false, "Print flags as they are being parsed."); 13 DEFINE_FLAG(bool, print_flags, false, "Print flags as they are being parsed.");
14 DEFINE_FLAG(bool, ignore_unrecognized_flags, false, 14 DEFINE_FLAG(bool, ignore_unrecognized_flags, false,
15 "Ignore unrecognized flags."); 15 "Ignore unrecognized flags.");
16 16
17 #define PRODUCT_FLAG_MARCO(name, type, default_value, comment) \
18 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
19 #name, \
20 default_value, \
21 comment);
22
23 #if defined(DEBUG)
24 #define DEBUG_FLAG_MARCO(name, type, default_value, comment) \
25 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
26 #name, \
27 default_value, \
28 comment);
29 #else // defined(DEBUG)
30 #define DEBUG_FLAG_MARCO(name, type, default_value, comment)
31 #endif // defined(DEBUG)
32
33 #if defined(PRODUCT)
34 // Nothing to be done for the product flag definitions.
35 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment)
36 #else // defined(PRODUCT)
37 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \
38 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
39 #name, \
40 default_value, \
41 comment);
42 #endif // defined(PRODUCT)
43
44 // Define all of the non-product flags here.
45 FLAG_LIST(PRODUCT_FLAG_MARCO, RELEASE_FLAG_MARCO, DEBUG_FLAG_MARCO)
46
47 #undef RELEASE_FLAG_MARCO
48 #undef DEBUG_FLAG_MARCO
49 #undef PRODUCT_FLAG_MARCO
50
51
17 bool Flags::initialized_ = false; 52 bool Flags::initialized_ = false;
18 53
19 // List of registered flags. 54 // List of registered flags.
20 Flag** Flags::flags_ = NULL; 55 Flag** Flags::flags_ = NULL;
21 intptr_t Flags::capacity_ = 0; 56 intptr_t Flags::capacity_ = 0;
22 intptr_t Flags::num_flags_ = 0; 57 intptr_t Flags::num_flags_ = 0;
23 58
24 class Flag { 59 class Flag {
25 public: 60 public:
26 enum FlagType { 61 enum FlagType {
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 void Flags::PrintJSON(JSONStream* js) { 499 void Flags::PrintJSON(JSONStream* js) {
465 JSONObject jsobj(js); 500 JSONObject jsobj(js);
466 jsobj.AddProperty("type", "FlagList"); 501 jsobj.AddProperty("type", "FlagList");
467 JSONArray jsarr(&jsobj, "flags"); 502 JSONArray jsarr(&jsobj, "flags");
468 for (intptr_t i = 0; i < num_flags_; ++i) { 503 for (intptr_t i = 0; i < num_flags_; ++i) {
469 PrintFlagToJSONArray(&jsarr, flags_[i]); 504 PrintFlagToJSONArray(&jsarr, flags_[i]);
470 } 505 }
471 } 506 }
472 507
473 } // namespace dart 508 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flags.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698