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

Side by Side Diff: src/flags.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/factory.h ('k') | src/frame-element.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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 332
333 static Flag* FindFlag(const char* name) { 333 static Flag* FindFlag(const char* name) {
334 for (size_t i = 0; i < num_flags; ++i) { 334 for (size_t i = 0; i < num_flags; ++i) {
335 if (EqualNames(name, flags[i].name())) 335 if (EqualNames(name, flags[i].name()))
336 return &flags[i]; 336 return &flags[i];
337 } 337 }
338 return NULL; 338 return NULL;
339 } 339 }
340 340
341 static MutexLockAdapter flag_list_lock(OS::CreateMutex());
341 342
342 // static 343 // static
343 int FlagList::SetFlagsFromCommandLine(int* argc, 344 int FlagList::SetFlagsFromCommandLine(int* argc,
344 char** argv, 345 char** argv,
345 bool remove_flags) { 346 bool remove_flags) {
347 V8SharedStateLocker flags_list_locker(&flag_list_lock);
346 // parse arguments 348 // parse arguments
347 for (int i = 1; i < *argc;) { 349 for (int i = 1; i < *argc;) {
348 int j = i; // j > 0 350 int j = i; // j > 0
349 const char* arg = argv[i++]; 351 const char* arg = argv[i++];
350 352
351 // split arg into flag components 353 // split arg into flag components
352 char buffer[1*KB]; 354 char buffer[1*KB];
353 const char* name; 355 const char* name;
354 const char* value; 356 const char* value;
355 bool is_bool; 357 bool is_bool;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 464
463 465
464 static char* SkipBlackSpace(char* p) { 466 static char* SkipBlackSpace(char* p) {
465 while (*p != '\0' && isspace(*p) == 0) p++; 467 while (*p != '\0' && isspace(*p) == 0) p++;
466 return p; 468 return p;
467 } 469 }
468 470
469 471
470 // static 472 // static
471 int FlagList::SetFlagsFromString(const char* str, int len) { 473 int FlagList::SetFlagsFromString(const char* str, int len) {
474 V8SharedStateLocker flags_list_locker(&flag_list_lock);
472 // make a 0-terminated copy of str 475 // make a 0-terminated copy of str
473 char* copy0 = NewArray<char>(len + 1); 476 char* copy0 = NewArray<char>(len + 1);
474 memcpy(copy0, str, len); 477 memcpy(copy0, str, len);
475 copy0[len] = '\0'; 478 copy0[len] = '\0';
476 479
477 // strip leading white space 480 // strip leading white space
478 char* copy = SkipWhiteSpace(copy0); 481 char* copy = SkipWhiteSpace(copy0);
479 482
480 // count the number of 'arguments' 483 // count the number of 'arguments'
481 int argc = 1; // be compatible with SetFlagsFromCommandLine() 484 int argc = 1; // be compatible with SetFlagsFromCommandLine()
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 const char** JSArguments::argv() { return argv_; } 549 const char** JSArguments::argv() { return argv_; }
547 const char*& JSArguments::operator[](int idx) { return argv_[idx]; } 550 const char*& JSArguments::operator[](int idx) { return argv_[idx]; }
548 JSArguments& JSArguments::operator=(JSArguments args) { 551 JSArguments& JSArguments::operator=(JSArguments args) {
549 argc_ = args.argc_; 552 argc_ = args.argc_;
550 argv_ = args.argv_; 553 argv_ = args.argv_;
551 return *this; 554 return *this;
552 } 555 }
553 556
554 557
555 } } // namespace v8::internal 558 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/frame-element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698