Index: src/v8utils.h |
diff --git a/src/v8utils.h b/src/v8utils.h |
index 8661f9b88c2baba1cc3c656ab727a703d55887b8..96493b19d7a373f9b72c3670d98283db768bfc7a 100644 |
--- a/src/v8utils.h |
+++ b/src/v8utils.h |
@@ -227,6 +227,34 @@ inline void MoveBytes(T* dst, const T* src, size_t num_bytes) { |
*reinterpret_cast<uint32_t*>(dst + num_bytes - 4) = part2; |
return; |
} |
+#ifdef V8_TARGET_ARCH_ARM |
+ case 9: |
+ case 10: |
+ case 11: |
+ case 12: { |
+ uint32_t part1 = *reinterpret_cast<const uint32_t*>(src); |
+ uint32_t part2 = *reinterpret_cast<const uint32_t*>(src + 4); |
+ uint32_t part3 = *reinterpret_cast<const uint32_t*>(src + num_bytes - 4); |
+ *reinterpret_cast<uint32_t*>(dst) = part1; |
+ *reinterpret_cast<uint32_t*>(dst + 4) = part2; |
+ *reinterpret_cast<uint32_t*>(dst + num_bytes - 4) = part3; |
+ return; |
+ } |
+ case 13: |
+ case 14: |
+ case 15: |
+ case 16: { |
+ uint32_t part1 = *reinterpret_cast<const uint32_t*>(src); |
+ uint32_t part2 = *reinterpret_cast<const uint32_t*>(src + 4); |
+ uint32_t part3 = *reinterpret_cast<const uint32_t*>(src + 8); |
+ uint32_t part4 = *reinterpret_cast<const uint32_t*>(src + num_bytes - 4); |
+ *reinterpret_cast<uint32_t*>(dst) = part1; |
+ *reinterpret_cast<uint32_t*>(dst + 4) = part2; |
+ *reinterpret_cast<uint32_t*>(dst + 8) = part3; |
+ *reinterpret_cast<uint32_t*>(dst + num_bytes - 4) = part4; |
+ return; |
+ } |
+#else |
case 9: |
case 10: |
case 11: |
@@ -242,6 +270,7 @@ inline void MoveBytes(T* dst, const T* src, size_t num_bytes) { |
return; |
} |
#endif |
+#endif |
default: |
OS::MemMove(dst, src, num_bytes); |
return; |
@@ -317,6 +346,9 @@ template <typename sourcechar, typename sinkchar> |
INLINE(static void CopyCharsUnsigned(sinkchar* dest, |
const sourcechar* src, |
int chars)); |
+#if defined(V8_HOST_ARCH_ARM) && defined (V8_HOST_CAN_READ_UNALIGNED) |
+INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, int chars)); |
+#endif |
// Copy from ASCII/16bit chars to ASCII/16bit chars. |
template <typename sourcechar, typename sinkchar> |
@@ -351,30 +383,48 @@ void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { |
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>(OS::kMinComplexMemCopy / sizeof(*dest))) { |
OS::MemCopy(dest, src, chars * sizeof(*dest)); |
return; |
} |
+ sinkchar* limit = dest + chars; |
// Number of characters in a uintptr_t. |
static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT |
- ASSERT(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 (chars >= kStepSize) { |
+ sinkchar* limit2 = limit - kStepSize; |
+ while (dest <= limit2) { |
+ *reinterpret_cast<uintptr_t*>(dest) = |
+ *reinterpret_cast<const uintptr_t*>(src); |
+ dest += kStepSize; |
+ src += kStepSize; |
+ } |
+ } |
+ while (dest < limit) { |
+ *dest++ = static_cast<sinkchar>(*src++); |
} |
+ return; |
} |
#endif |
+ sinkchar* limit = dest + chars; |
while (dest < limit) { |
*dest++ = static_cast<sinkchar>(*src++); |
} |
} |
+#if defined(V8_HOST_ARCH_ARM) && defined (V8_HOST_CAN_READ_UNALIGNED) |
+void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, int chars) { |
+ if (chars >= OS::kMinComplexConvertMemCopy) { |
+ OS::MemCopyUint16Uint8(dest, src, chars); |
+ } else { |
+ OS::MemCopyUint16Uint8Wrapper(dest, src, chars); |
+ } |
+} |
+#endif |
+ |
+ |
class StringBuilder : public SimpleStringBuilder { |
public: |
explicit StringBuilder(int size) : SimpleStringBuilder(size) { } |