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

Side by Side Diff: src/flags.cc

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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/execution.cc ('k') | src/gdb-jit.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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 memcpy(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 inline char NormalizeChar(char ch) { 318 inline char NormalizeChar(char ch) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 memcpy(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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 540
541 541
542 void FlagList::EnforceFlagImplications() { 542 void FlagList::EnforceFlagImplications() {
543 #define FLAG_MODE_DEFINE_IMPLICATIONS 543 #define FLAG_MODE_DEFINE_IMPLICATIONS
544 #include "flag-definitions.h" 544 #include "flag-definitions.h"
545 #undef FLAG_MODE_DEFINE_IMPLICATIONS 545 #undef FLAG_MODE_DEFINE_IMPLICATIONS
546 } 546 }
547 547
548 } } // namespace v8::internal 548 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698