Commit 631519c3 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Copy strings 1 word at a time when flattening etc.

Review URL: http://codereview.chromium.org/7885

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@562 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8e0979e2
......@@ -447,7 +447,20 @@ class StringBuilder {
// Copy from ASCII/16bit chars to ASCII/16bit chars.
template <typename sourcechar, typename sinkchar>
static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
while (chars--) {
sinkchar* limit = dest + chars;
#ifdef CAN_READ_UNALIGNED
if (sizeof(*dest) == sizeof(*src)) {
// Number of characters in a uint32_t.
static const int kStepSize = sizeof(uint32_t) / sizeof(*dest); // NOLINT
while (dest <= limit - kStepSize) {
*reinterpret_cast<uint32_t*>(dest) =
*reinterpret_cast<const uint32_t*>(src);
dest += kStepSize;
src += kStepSize;
}
}
#endif
while (dest < limit) {
*dest++ = static_cast<sinkchar>(*src++);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment