Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 8203b36a97f1dee7ef9c14a2cf413ae2c370c7e4..32dd94f39b64457b6cbe853647222c22d49ba8e5 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -9172,33 +9172,22 @@ class String: public Name { |
static inline int NonAsciiStart(const char* chars, int length) { |
const char* start = chars; |
const char* limit = chars + length; |
- |
- if (length >= kIntptrSize) { |
- // Check unaligned bytes. |
- while (!IsAligned(reinterpret_cast<intptr_t>(chars), sizeof(uintptr_t))) { |
- if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) { |
- return static_cast<int>(chars - start); |
- } |
- ++chars; |
- } |
- // Check aligned words. |
- DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F); |
- const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFF * 0x80; |
- while (chars + sizeof(uintptr_t) <= limit) { |
- if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) { |
- return static_cast<int>(chars - start); |
- } |
- chars += sizeof(uintptr_t); |
+#ifdef V8_HOST_CAN_READ_UNALIGNED |
+ DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F); |
+ const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFF * 0x80; |
+ while (chars + sizeof(uintptr_t) <= limit) { |
+ if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) { |
+ return static_cast<int>(chars - start); |
} |
+ chars += sizeof(uintptr_t); |
} |
- // Check remaining unaligned bytes. |
+#endif |
while (chars < limit) { |
if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) { |
return static_cast<int>(chars - start); |
} |
++chars; |
} |
- |
return static_cast<int>(chars - start); |
} |