| Index: src/utils.h
|
| diff --git a/src/utils.h b/src/utils.h
|
| index 2fcd241fd5350082f60e243e17b906f0904b822c..2cad4c12e4a8f93ee46cd4d2214b8583d8f09dbb 100644
|
| --- a/src/utils.h
|
| +++ b/src/utils.h
|
| @@ -528,11 +528,11 @@ static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
|
| sinkchar* limit = dest + chars;
|
| #ifdef V8_HOST_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
|
| + // Number of characters in a uintptr_t.
|
| + static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT
|
| while (dest <= limit - kStepSize) {
|
| - *reinterpret_cast<uint32_t*>(dest) =
|
| - *reinterpret_cast<const uint32_t*>(src);
|
| + *reinterpret_cast<uintptr_t*>(dest) =
|
| + *reinterpret_cast<const uintptr_t*>(src);
|
| dest += kStepSize;
|
| src += kStepSize;
|
| }
|
| @@ -544,6 +544,34 @@ static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
|
| }
|
|
|
|
|
| +// Compare ASCII/16bit chars to ASCII/16bit chars.
|
| +template <typename lchar, typename rchar>
|
| +static inline int CompareChars(const lchar* lhs, const rchar* rhs, int chars) {
|
| + const lchar* limit = lhs + chars;
|
| +#ifdef V8_HOST_CAN_READ_UNALIGNED
|
| + if (sizeof(*lhs) == sizeof(*rhs)) {
|
| + // Number of characters in a uintptr_t.
|
| + static const int kStepSize = sizeof(uintptr_t) / sizeof(*lhs); // NOLINT
|
| + while (lhs <= limit - kStepSize) {
|
| + if (*reinterpret_cast<const uintptr_t*>(lhs) !=
|
| + *reinterpret_cast<const uintptr_t*>(rhs)) {
|
| + break;
|
| + }
|
| + lhs += kStepSize;
|
| + rhs += kStepSize;
|
| + }
|
| + }
|
| +#endif
|
| + while (lhs < limit) {
|
| + int r = static_cast<int>(*lhs) - static_cast<int>(*rhs);
|
| + if (r != 0) return r;
|
| + ++lhs;
|
| + ++rhs;
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| +
|
| // Calculate 10^exponent.
|
| int TenToThe(int exponent);
|
|
|
|
|