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

Side by Side Diff: src/utils.h

Issue 7885: Copy strings 1 word at a time when flattening etc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | « no previous file | no next file » | 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 bool is_finalized() const { return position_ < 0; } 441 bool is_finalized() const { return position_ < 0; }
442 442
443 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); 443 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
444 }; 444 };
445 445
446 446
447 // Copy from ASCII/16bit chars to ASCII/16bit chars. 447 // Copy from ASCII/16bit chars to ASCII/16bit chars.
448 template <typename sourcechar, typename sinkchar> 448 template <typename sourcechar, typename sinkchar>
449 static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { 449 static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
450 while (chars--) { 450 sinkchar* limit = dest + chars;
451 #ifdef CAN_READ_UNALIGNED
452 if (sizeof(*dest) == sizeof(*src)) {
453 // Number of characters in a uint32_t.
454 static const int kStepSize = sizeof(uint32_t) / sizeof(*dest); // NOLINT
455 while (dest <= limit - kStepSize) {
456 *reinterpret_cast<uint32_t*>(dest) =
457 *reinterpret_cast<const uint32_t*>(src);
458 dest += kStepSize;
459 src += kStepSize;
460 }
461 }
462 #endif
463 while (dest < limit) {
451 *dest++ = static_cast<sinkchar>(*src++); 464 *dest++ = static_cast<sinkchar>(*src++);
452 } 465 }
453 } 466 }
454 467
455 } } // namespace v8::internal 468 } } // namespace v8::internal
456 469
457 #endif // V8_UTILS_H_ 470 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698