OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/flags.h" | 5 #include "src/flags.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
11 #include "src/allocation.h" | 11 #include "src/allocation.h" |
12 #include "src/assembler.h" | 12 #include "src/assembler.h" |
13 #include "src/base/functional.h" | 13 #include "src/base/functional.h" |
14 #include "src/base/platform/platform.h" | 14 #include "src/base/platform/platform.h" |
15 #include "src/list-inl.h" | 15 #include "src/list-inl.h" |
16 #include "src/ostreams.h" | 16 #include "src/ostreams.h" |
17 #include "src/utils.h" | 17 #include "src/utils.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 // Define all of our flags. | 22 // Define all of our flags. |
23 #define FLAG_MODE_DEFINE | 23 #define FLAG_MODE_DEFINE |
24 #include "src/flag-definitions.h" // NOLINT | 24 #include "src/flag-definitions.h" // NOLINT(build/include) |
25 | 25 |
26 // Define all of our flags default values. | 26 // Define all of our flags default values. |
27 #define FLAG_MODE_DEFINE_DEFAULTS | 27 #define FLAG_MODE_DEFINE_DEFAULTS |
28 #include "src/flag-definitions.h" // NOLINT | 28 #include "src/flag-definitions.h" // NOLINT(build/include) |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // This structure represents a single entry in the flag system, with a pointer | 32 // This structure represents a single entry in the flag system, with a pointer |
33 // to the actual flag, default value, comment, etc. This is designed to be POD | 33 // to the actual flag, default value, comment, etc. This is designed to be POD |
34 // initialized as to avoid requiring static constructors. | 34 // initialized as to avoid requiring static constructors. |
35 struct Flag { | 35 struct Flag { |
36 enum FlagType { TYPE_BOOL, TYPE_MAYBE_BOOL, TYPE_INT, TYPE_FLOAT, | 36 enum FlagType { TYPE_BOOL, TYPE_MAYBE_BOOL, TYPE_INT, TYPE_FLOAT, |
37 TYPE_STRING, TYPE_ARGS }; | 37 TYPE_STRING, TYPE_ARGS }; |
38 | 38 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 break; | 157 break; |
158 case TYPE_ARGS: | 158 case TYPE_ARGS: |
159 *args_variable() = args_default(); | 159 *args_variable() = args_default(); |
160 break; | 160 break; |
161 } | 161 } |
162 } | 162 } |
163 }; | 163 }; |
164 | 164 |
165 Flag flags[] = { | 165 Flag flags[] = { |
166 #define FLAG_MODE_META | 166 #define FLAG_MODE_META |
167 #include "src/flag-definitions.h" | 167 #include "src/flag-definitions.h" // NOLINT(build/include) |
168 }; | 168 }; |
169 | 169 |
170 const size_t num_flags = sizeof(flags) / sizeof(*flags); | 170 const size_t num_flags = sizeof(flags) / sizeof(*flags); |
171 | 171 |
172 } // namespace | 172 } // namespace |
173 | 173 |
174 | 174 |
175 static const char* Type2String(Flag::FlagType type) { | 175 static const char* Type2String(Flag::FlagType type) { |
176 switch (type) { | 176 switch (type) { |
177 case Flag::TYPE_BOOL: return "bool"; | 177 case Flag::TYPE_BOOL: return "bool"; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 563 } |
564 std::string args(modified_args_as_string.str()); | 564 std::string args(modified_args_as_string.str()); |
565 flag_hash = static_cast<uint32_t>( | 565 flag_hash = static_cast<uint32_t>( |
566 base::hash_range(args.c_str(), args.c_str() + args.length())); | 566 base::hash_range(args.c_str(), args.c_str() + args.length())); |
567 } | 567 } |
568 | 568 |
569 | 569 |
570 // static | 570 // static |
571 void FlagList::EnforceFlagImplications() { | 571 void FlagList::EnforceFlagImplications() { |
572 #define FLAG_MODE_DEFINE_IMPLICATIONS | 572 #define FLAG_MODE_DEFINE_IMPLICATIONS |
573 #include "src/flag-definitions.h" | 573 #include "src/flag-definitions.h" // NOLINT(build/include) |
574 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 574 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
575 ComputeFlagListHash(); | 575 ComputeFlagListHash(); |
576 } | 576 } |
577 | 577 |
578 | 578 |
579 uint32_t FlagList::Hash() { return flag_hash; } | 579 uint32_t FlagList::Hash() { return flag_hash; } |
580 } // namespace internal | 580 } // namespace internal |
581 } // namespace v8 | 581 } // namespace v8 |
OLD | NEW |