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

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: 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
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 23 matching lines...) Expand all
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 #else // defined(PRODUCT)
37 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \ 37 #define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \
38 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ 38 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
39 #name, \ 39 #name, \
40 default_value, \ 40 default_value, \
41 comment); 41 comment);
42 #endif // defined(PRODUCT) 42 #endif // defined(PRODUCT)
43 43
44 #if defined(DART_PRECOMPILED_RUNTIME)
45 // Nothing to be done for the product flag definitions.
46 #define PRECOMPILE_FLAG_MARCO(name, product_value, type, default_value, comment)
47 #else // defined(DART_PRECOMPILED_RUNTIME)
48 #define PRECOMPILE_FLAG_MARCO(name, product_value, type, default_value, \
49 comment) \
50 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
51 #name, \
52 default_value, \
53 comment);
54 #endif // defined(DART_PRECOMPILED_RUNTIME)
55
44 // Define all of the non-product flags here. 56 // Define all of the non-product flags here.
45 FLAG_LIST(PRODUCT_FLAG_MARCO, RELEASE_FLAG_MARCO, DEBUG_FLAG_MARCO) 57 FLAG_LIST(PRODUCT_FLAG_MARCO,
58 RELEASE_FLAG_MARCO,
59 DEBUG_FLAG_MARCO,
60 PRECOMPILE_FLAG_MARCO)
46 61
47 #undef RELEASE_FLAG_MARCO 62 #undef RELEASE_FLAG_MARCO
48 #undef DEBUG_FLAG_MARCO 63 #undef DEBUG_FLAG_MARCO
49 #undef PRODUCT_FLAG_MARCO 64 #undef PRODUCT_FLAG_MARCO
50 65 #undef PRECOMPILE_FLAG_MARCO
51 66
52 bool Flags::initialized_ = false; 67 bool Flags::initialized_ = false;
53 68
54 // List of registered flags. 69 // List of registered flags.
55 Flag** Flags::flags_ = NULL; 70 Flag** Flags::flags_ = NULL;
56 intptr_t Flags::capacity_ = 0; 71 intptr_t Flags::capacity_ = 0;
57 intptr_t Flags::num_flags_ = 0; 72 intptr_t Flags::num_flags_ = 0;
58 73
59 class Flag { 74 class Flag {
60 public: 75 public:
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 520 }
506 JSONObject jsobj(js); 521 JSONObject jsobj(js);
507 jsobj.AddProperty("type", "FlagList"); 522 jsobj.AddProperty("type", "FlagList");
508 JSONArray jsarr(&jsobj, "flags"); 523 JSONArray jsarr(&jsobj, "flags");
509 for (intptr_t i = 0; i < num_flags_; ++i) { 524 for (intptr_t i = 0; i < num_flags_; ++i) {
510 PrintFlagToJSONArray(&jsarr, flags_[i]); 525 PrintFlagToJSONArray(&jsarr, flags_[i]);
511 } 526 }
512 } 527 }
513 528
514 } // namespace dart 529 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698