| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index 4fd1a041eabfc73b4fa6ed112c0970447e163c06..037e460c3f86ea4cb063b277c419e9342459e666 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -4428,13 +4428,14 @@ MaybeObject* Heap::AllocateStringFromAscii(Vector<const char> string,
|
|
|
|
|
| MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string,
|
| + int non_ascii_start,
|
| PretenureFlag pretenure) {
|
| - // Count the number of characters in the UTF-8 string and check if
|
| - // it is an ASCII string.
|
| + // Continue counting the number of characters in the UTF-8 string, starting
|
| + // from the first non-ascii character or word.
|
| + int chars = non_ascii_start;
|
| Access<UnicodeCache::Utf8Decoder>
|
| decoder(isolate_->unicode_cache()->utf8_decoder());
|
| - decoder->Reset(string.start(), string.length());
|
| - int chars = 0;
|
| + decoder->Reset(string.start() + non_ascii_start, string.length() - chars);
|
| while (decoder->has_more()) {
|
| uint32_t r = decoder->GetNext();
|
| if (r <= unibrow::Utf16::kMaxNonSurrogateCharCode) {
|
|
|