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 <ctype.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "assembler.h" | 10 #include "assembler.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 // find the end of the flag name | 299 // find the end of the flag name |
300 while (*arg != '\0' && *arg != '=') | 300 while (*arg != '\0' && *arg != '=') |
301 arg++; | 301 arg++; |
302 | 302 |
303 // get the value if any | 303 // get the value if any |
304 if (*arg == '=') { | 304 if (*arg == '=') { |
305 // make a copy so we can NUL-terminate flag name | 305 // make a copy so we can NUL-terminate flag name |
306 size_t n = arg - *name; | 306 size_t n = arg - *name; |
307 CHECK(n < static_cast<size_t>(buffer_size)); // buffer is too small | 307 CHECK(n < static_cast<size_t>(buffer_size)); // buffer is too small |
308 MemCopy(buffer, *name, n); | 308 OS::MemCopy(buffer, *name, n); |
309 buffer[n] = '\0'; | 309 buffer[n] = '\0'; |
310 *name = buffer; | 310 *name = buffer; |
311 // get the value | 311 // get the value |
312 *value = arg + 1; | 312 *value = arg + 1; |
313 } | 313 } |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 | 317 |
318 static bool EqualNames(const char* a, const char* b) { | 318 static bool EqualNames(const char* a, const char* b) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 static char* SkipBlackSpace(char* p) { | 468 static char* SkipBlackSpace(char* p) { |
469 while (*p != '\0' && isspace(*p) == 0) p++; | 469 while (*p != '\0' && isspace(*p) == 0) p++; |
470 return p; | 470 return p; |
471 } | 471 } |
472 | 472 |
473 | 473 |
474 // static | 474 // static |
475 int FlagList::SetFlagsFromString(const char* str, int len) { | 475 int FlagList::SetFlagsFromString(const char* str, int len) { |
476 // make a 0-terminated copy of str | 476 // make a 0-terminated copy of str |
477 ScopedVector<char> copy0(len + 1); | 477 ScopedVector<char> copy0(len + 1); |
478 MemCopy(copy0.start(), str, len); | 478 OS::MemCopy(copy0.start(), str, len); |
479 copy0[len] = '\0'; | 479 copy0[len] = '\0'; |
480 | 480 |
481 // strip leading white space | 481 // strip leading white space |
482 char* copy = SkipWhiteSpace(copy0.start()); | 482 char* copy = SkipWhiteSpace(copy0.start()); |
483 | 483 |
484 // count the number of 'arguments' | 484 // count the number of 'arguments' |
485 int argc = 1; // be compatible with SetFlagsFromCommandLine() | 485 int argc = 1; // be compatible with SetFlagsFromCommandLine() |
486 for (char* p = copy; *p != '\0'; argc++) { | 486 for (char* p = copy; *p != '\0'; argc++) { |
487 p = SkipBlackSpace(p); | 487 p = SkipBlackSpace(p); |
488 p = SkipWhiteSpace(p); | 488 p = SkipWhiteSpace(p); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 543 |
544 | 544 |
545 // static | 545 // static |
546 void FlagList::EnforceFlagImplications() { | 546 void FlagList::EnforceFlagImplications() { |
547 #define FLAG_MODE_DEFINE_IMPLICATIONS | 547 #define FLAG_MODE_DEFINE_IMPLICATIONS |
548 #include "flag-definitions.h" | 548 #include "flag-definitions.h" |
549 #undef FLAG_MODE_DEFINE_IMPLICATIONS | 549 #undef FLAG_MODE_DEFINE_IMPLICATIONS |
550 } | 550 } |
551 | 551 |
552 } } // namespace v8::internal | 552 } } // namespace v8::internal |
OLD | NEW |