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

Side by Side Diff: src/flags.cc

Issue 9455088: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Florian's comments. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 case Flag::TYPE_ARGS: { 404 case Flag::TYPE_ARGS: {
405 int start_pos = (value == NULL) ? i : i - 1; 405 int start_pos = (value == NULL) ? i : i - 1;
406 int js_argc = *argc - start_pos; 406 int js_argc = *argc - start_pos;
407 const char** js_argv = NewArray<const char*>(js_argc); 407 const char** js_argv = NewArray<const char*>(js_argc);
408 if (value != NULL) { 408 if (value != NULL) {
409 js_argv[0] = StrDup(value); 409 js_argv[0] = StrDup(value);
410 } 410 }
411 for (int k = i; k < *argc; k++) { 411 for (int k = i; k < *argc; k++) {
412 js_argv[k - start_pos] = StrDup(argv[k]); 412 js_argv[k - start_pos] = StrDup(argv[k]);
413 } 413 }
414 *flag->args_variable() = JSArguments(js_argc, js_argv); 414 *flag->args_variable() = JSArguments::Create(js_argc, js_argv);
415 i = *argc; // Consume all arguments 415 i = *argc; // Consume all arguments
416 break; 416 break;
417 } 417 }
418 } 418 }
419 419
420 // handle errors 420 // handle errors
421 if ((flag->type() == Flag::TYPE_BOOL && value != NULL) || 421 if ((flag->type() == Flag::TYPE_BOOL && value != NULL) ||
422 (flag->type() != Flag::TYPE_BOOL && is_bool) || 422 (flag->type() != Flag::TYPE_BOOL && is_bool) ||
423 *endp != '\0') { 423 *endp != '\0') {
424 fprintf(stderr, "Error: illegal value for flag %s of type %s\n" 424 fprintf(stderr, "Error: illegal value for flag %s of type %s\n"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 printf(" run the new debugging shell\n\n"); 527 printf(" run the new debugging shell\n\n");
528 printf("Options:\n"); 528 printf("Options:\n");
529 for (size_t i = 0; i < num_flags; ++i) { 529 for (size_t i = 0; i < num_flags; ++i) {
530 Flag* f = &flags[i]; 530 Flag* f = &flags[i];
531 SmartArrayPointer<const char> value = ToString(f); 531 SmartArrayPointer<const char> value = ToString(f);
532 printf(" --%s (%s)\n type: %s default: %s\n", 532 printf(" --%s (%s)\n type: %s default: %s\n",
533 f->name(), f->comment(), Type2String(f->type()), *value); 533 f->name(), f->comment(), Type2String(f->type()), *value);
534 } 534 }
535 } 535 }
536 536
537 JSArguments::JSArguments()
538 : argc_(0), argv_(NULL) {}
539 JSArguments::JSArguments(int argc, const char** argv)
540 : argc_(argc), argv_(argv) {}
541 int JSArguments::argc() const { return argc_; }
542 const char** JSArguments::argv() { return argv_; }
543 const char*& JSArguments::operator[](int idx) { return argv_[idx]; }
544 JSArguments& JSArguments::operator=(JSArguments args) {
545 argc_ = args.argc_;
546 argv_ = args.argv_;
547 return *this;
548 }
549
550 537
551 void FlagList::EnforceFlagImplications() { 538 void FlagList::EnforceFlagImplications() {
552 #define FLAG_MODE_DEFINE_IMPLICATIONS 539 #define FLAG_MODE_DEFINE_IMPLICATIONS
553 #include "flag-definitions.h" 540 #include "flag-definitions.h"
554 } 541 }
555 542
556 } } // namespace v8::internal 543 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698