Commit 90dc5c9e authored by yangguo@chromium.org's avatar yangguo@chromium.org

Do not use wide reads in CopyCharsUnsigned.

R=jkummerow@chromium.org
BUG=chromium:412967
LOG=Y

Review URL: https://codereview.chromium.org/566583002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23876 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4bee89e0
......@@ -1287,20 +1287,10 @@ template <typename sourcechar, typename sinkchar>
void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src, int chars) {
sinkchar* limit = dest + chars;
#ifdef V8_HOST_CAN_READ_UNALIGNED
if (sizeof(*dest) == sizeof(*src)) {
if (chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest))) {
MemCopy(dest, src, chars * sizeof(*dest));
return;
}
// Number of characters in a uintptr_t.
static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT
DCHECK(dest + kStepSize > dest); // Check for overflow.
while (dest + kStepSize <= limit) {
*reinterpret_cast<uintptr_t*>(dest) =
*reinterpret_cast<const uintptr_t*>(src);
dest += kStepSize;
src += kStepSize;
}
if ((sizeof(*dest) == sizeof(*src)) &&
(chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest)))) {
MemCopy(dest, src, chars * sizeof(*dest));
return;
}
#endif
while (dest < limit) {
......
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