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

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

Issue 1714743002: VM: Separate precompilation-specific code, make flags const. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix build after merge 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.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
(...skipping 12 matching lines...) Expand all
23 #if defined(DEBUG) 23 #if defined(DEBUG)
24 #define DEBUG_FLAG_MARCO(name, type, default_value, comment) \ 24 #define DEBUG_FLAG_MARCO(name, type, default_value, comment) \
25 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ 25 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
26 #name, \ 26 #name, \
27 default_value, \ 27 default_value, \
28 comment); 28 comment);
29 #else // defined(DEBUG) 29 #else // defined(DEBUG)
30 #define DEBUG_FLAG_MARCO(name, type, default_value, comment) 30 #define DEBUG_FLAG_MARCO(name, type, default_value, comment)
31 #endif // defined(DEBUG) 31 #endif // defined(DEBUG)
32 32
33 #if defined(PRODUCT) 33 #if defined(PRODUCT) && defined(DART_PRECOMPILED_RUNTIME)
34 // Nothing to be done for the product flag definitions. 34 // Nothing to be done for the product flag definitions.
35 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) 35 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment)
36 #else // defined(PRODUCT) 36 // Nothing to be done for the precompilation flag definitions.
37 #define PRECOMPILE_FLAG_MARCO(name, pre_value, product_value, type, \
38 default_value, comment)
39
40 #elif defined(PRODUCT) // !PRECOMPILED
41 // Nothing to be done for the product flag definitions.
42 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment)
43
44 #elif defined(DART_PRECOMPILED_RUNTIME) // !PRODUCT
37 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \ 45 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \
38 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ 46 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
39 #name, \ 47 #name, \
40 default_value, \ 48 default_value, \
41 comment); 49 comment);
42 #endif // defined(PRODUCT) 50 // Nothing to be done for the precompilation flag definitions.
51 #define PRECOMPILE_FLAG_MARCO(name, pre_value, product_value, type, \
52 default_value, comment)
53
54 #else // !PRODUCT && !PRECOMPILED
55 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \
56 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
57 #name, \
58 default_value, \
59 comment);
60 #define PRECOMPILE_FLAG_MARCO(name, pre_value, product_value, type, \
61 default_value, comment) \
62 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
63 #name, \
64 default_value, \
65 comment);
66 #endif
67
43 68
44 // Define all of the non-product flags here. 69 // Define all of the non-product flags here.
45 FLAG_LIST(PRODUCT_FLAG_MARCO, RELEASE_FLAG_MARCO, DEBUG_FLAG_MARCO) 70 FLAG_LIST(PRODUCT_FLAG_MARCO,
71 RELEASE_FLAG_MARCO,
72 DEBUG_FLAG_MARCO,
73 PRECOMPILE_FLAG_MARCO)
46 74
47 #undef RELEASE_FLAG_MARCO 75 #undef RELEASE_FLAG_MARCO
48 #undef DEBUG_FLAG_MARCO 76 #undef DEBUG_FLAG_MARCO
49 #undef PRODUCT_FLAG_MARCO 77 #undef PRODUCT_FLAG_MARCO
50 78 #undef PRECOMPILE_FLAG_MARCO
51 79
52 bool Flags::initialized_ = false; 80 bool Flags::initialized_ = false;
53 81
54 // List of registered flags. 82 // List of registered flags.
55 Flag** Flags::flags_ = NULL; 83 Flag** Flags::flags_ = NULL;
56 intptr_t Flags::capacity_ = 0; 84 intptr_t Flags::capacity_ = 0;
57 intptr_t Flags::num_flags_ = 0; 85 intptr_t Flags::num_flags_ = 0;
58 86
59 class Flag { 87 class Flag {
60 public: 88 public:
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 533 }
506 JSONObject jsobj(js); 534 JSONObject jsobj(js);
507 jsobj.AddProperty("type", "FlagList"); 535 jsobj.AddProperty("type", "FlagList");
508 JSONArray jsarr(&jsobj, "flags"); 536 JSONArray jsarr(&jsobj, "flags");
509 for (intptr_t i = 0; i < num_flags_; ++i) { 537 for (intptr_t i = 0; i < num_flags_; ++i) {
510 PrintFlagToJSONArray(&jsarr, flags_[i]); 538 PrintFlagToJSONArray(&jsarr, flags_[i]);
511 } 539 }
512 } 540 }
513 541
514 } // namespace dart 542 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flags.h ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698