Revert "[runtime] Speed up String::IsOneByte"
This reverts commit c2e4183adf
.
Reason for revert: Uninitialized value on MSAN, see https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20arm64%20-%20sim%20-%20MSAN/26888
Original change's description:
> [runtime] Speed up String::IsOneByte
>
> Check uintptr_t sized blocks of UTF16 chars at a time similar to NonAsciiStart.
>
> Change-Id: Ib4c498cc064e6ac7b6f8cc87ab700eafc8132c39
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1622107
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61693}
TBR=ishell@chromium.org,verwaest@chromium.org
Change-Id: I2e18c9476f0ed47e77da87d2308a3429ef4f515c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1622112
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61697}
This commit is contained in:
parent
bdfd1e4b38
commit
40e9360eed
@ -381,40 +381,12 @@ class String : public Name {
|
||||
}
|
||||
|
||||
static inline int NonOneByteStart(const uc16* chars, int length) {
|
||||
DCHECK(IsAligned(reinterpret_cast<Address>(chars), sizeof(uc16)));
|
||||
const uint16_t* start = chars;
|
||||
const uint16_t* limit = chars + length;
|
||||
|
||||
// Check unaligned chars.
|
||||
while (!IsAligned(reinterpret_cast<Address>(chars), kUIntptrSize)) {
|
||||
if (*chars > unibrow::Latin1::kMaxChar) {
|
||||
return static_cast<int>(chars - start);
|
||||
}
|
||||
++chars;
|
||||
}
|
||||
|
||||
// Check aligned words.
|
||||
STATIC_ASSERT(unibrow::Latin1::kMaxChar == 0xFF);
|
||||
#ifdef V8_TARGET_LITTLE_ENDIAN
|
||||
const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFFFF * 0xFF00;
|
||||
#else
|
||||
const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFFFF * 0x00FF;
|
||||
#endif
|
||||
while (chars + sizeof(uintptr_t) <= limit) {
|
||||
if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) {
|
||||
break;
|
||||
}
|
||||
chars += (sizeof(uintptr_t) / sizeof(uc16));
|
||||
}
|
||||
|
||||
// Check remaining unaligned chars, or find non-one-byte char in word.
|
||||
const uc16* limit = chars + length;
|
||||
const uc16* start = chars;
|
||||
while (chars < limit) {
|
||||
if (*chars > unibrow::Latin1::kMaxChar) {
|
||||
return static_cast<int>(chars - start);
|
||||
}
|
||||
if (*chars > kMaxOneByteCharCodeU) return static_cast<int>(chars - start);
|
||||
++chars;
|
||||
}
|
||||
|
||||
return static_cast<int>(chars - start);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user