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 <ctype.h> | 5 #include <cctype> |
6 #include <stdlib.h> | 6 #include <cstdlib> |
| 7 #include <sstream> |
7 | 8 |
8 #include "src/v8.h" | 9 #include "src/v8.h" |
9 | 10 |
10 #include "src/assembler.h" | 11 #include "src/assembler.h" |
11 #include "src/base/platform/platform.h" | 12 #include "src/base/platform/platform.h" |
12 #include "src/ostreams.h" | 13 #include "src/ostreams.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 case Flag::TYPE_INT: return "int"; | 175 case Flag::TYPE_INT: return "int"; |
175 case Flag::TYPE_FLOAT: return "float"; | 176 case Flag::TYPE_FLOAT: return "float"; |
176 case Flag::TYPE_STRING: return "string"; | 177 case Flag::TYPE_STRING: return "string"; |
177 case Flag::TYPE_ARGS: return "arguments"; | 178 case Flag::TYPE_ARGS: return "arguments"; |
178 } | 179 } |
179 UNREACHABLE(); | 180 UNREACHABLE(); |
180 return NULL; | 181 return NULL; |
181 } | 182 } |
182 | 183 |
183 | 184 |
184 OStream& operator<<(OStream& os, const Flag& flag) { // NOLINT | 185 std::ostream& operator<<(std::ostream& os, const Flag& flag) { // NOLINT |
185 switch (flag.type()) { | 186 switch (flag.type()) { |
186 case Flag::TYPE_BOOL: | 187 case Flag::TYPE_BOOL: |
187 os << (*flag.bool_variable() ? "true" : "false"); | 188 os << (*flag.bool_variable() ? "true" : "false"); |
188 break; | 189 break; |
189 case Flag::TYPE_MAYBE_BOOL: | 190 case Flag::TYPE_MAYBE_BOOL: |
190 os << (flag.maybe_bool_variable()->has_value | 191 os << (flag.maybe_bool_variable()->has_value |
191 ? (flag.maybe_bool_variable()->value ? "true" : "false") | 192 ? (flag.maybe_bool_variable()->value ? "true" : "false") |
192 : "unset"); | 193 : "unset"); |
193 break; | 194 break; |
194 case Flag::TYPE_INT: | 195 case Flag::TYPE_INT: |
(...skipping 29 matching lines...) Expand all Loading... |
224 for (size_t i = 0; i < num_flags; ++i) { | 225 for (size_t i = 0; i < num_flags; ++i) { |
225 Flag* f = &flags[i]; | 226 Flag* f = &flags[i]; |
226 if (!f->IsDefault()) { | 227 if (!f->IsDefault()) { |
227 if (f->type() == Flag::TYPE_ARGS) { | 228 if (f->type() == Flag::TYPE_ARGS) { |
228 DCHECK(args_flag == NULL); | 229 DCHECK(args_flag == NULL); |
229 args_flag = f; // Must be last in arguments. | 230 args_flag = f; // Must be last in arguments. |
230 continue; | 231 continue; |
231 } | 232 } |
232 { | 233 { |
233 bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable(); | 234 bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable(); |
234 OStringStream os; | 235 std::ostringstream os; |
235 os << (disabled ? "--no" : "--") << f->name(); | 236 os << (disabled ? "--no" : "--") << f->name(); |
236 args->Add(StrDup(os.c_str())); | 237 args->Add(StrDup(os.str().c_str())); |
237 } | 238 } |
238 if (f->type() != Flag::TYPE_BOOL) { | 239 if (f->type() != Flag::TYPE_BOOL) { |
239 OStringStream os; | 240 std::ostringstream os; |
240 os << *f; | 241 os << *f; |
241 args->Add(StrDup(os.c_str())); | 242 args->Add(StrDup(os.str().c_str())); |
242 } | 243 } |
243 } | 244 } |
244 } | 245 } |
245 if (args_flag != NULL) { | 246 if (args_flag != NULL) { |
246 OStringStream os; | 247 std::ostringstream os; |
247 os << "--" << args_flag->name(); | 248 os << "--" << args_flag->name(); |
248 args->Add(StrDup(os.c_str())); | 249 args->Add(StrDup(os.str().c_str())); |
249 JSArguments jsargs = *args_flag->args_variable(); | 250 JSArguments jsargs = *args_flag->args_variable(); |
250 for (int j = 0; j < jsargs.argc; j++) { | 251 for (int j = 0; j < jsargs.argc; j++) { |
251 args->Add(StrDup(jsargs[j])); | 252 args->Add(StrDup(jsargs[j])); |
252 } | 253 } |
253 } | 254 } |
254 return args; | 255 return args; |
255 } | 256 } |
256 | 257 |
257 | 258 |
258 inline char NormalizeChar(char ch) { | 259 inline char NormalizeChar(char ch) { |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 543 |
543 | 544 |
544 // static | 545 // static |
545 void FlagList::EnforceFlagImplications() { | 546 void FlagList::EnforceFlagImplications() { |
546 #define FLAG_MODE_DEFINE_IMPLICATIONS | 547 #define FLAG_MODE_DEFINE_IMPLICATIONS |
547 #include "src/flag-definitions.h" | 548 #include "src/flag-definitions.h" |
548 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 549 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
549 } | 550 } |
550 | 551 |
551 } } // namespace v8::internal | 552 } } // namespace v8::internal |
OLD | NEW |