diff --git a/src/value-serializer.cc b/src/value-serializer.cc index acedb4be32..59e9b1031e 100644 --- a/src/value-serializer.cc +++ b/src/value-serializer.cc @@ -1261,10 +1261,9 @@ bool ValueDeserializer::ReadExpectedString(Handle expected) { // If the bytes are verbatim what is in the flattened string, then the string // is successfully consumed. - if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) { + if (tag == SerializationTag::kOneByteString && flat.IsOneByte()) { Vector chars = flat.ToOneByteVector(); if (byte_length == static_cast(chars.length()) && - String::IsAscii(chars.begin(), chars.length()) && memcmp(bytes.begin(), chars.begin(), byte_length) == 0) { return true; } @@ -1274,6 +1273,13 @@ bool ValueDeserializer::ReadExpectedString(Handle expected) { memcmp(bytes.begin(), chars.begin(), byte_length) == 0) { return true; } + } else if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) { + Vector chars = flat.ToOneByteVector(); + if (byte_length == static_cast(chars.length()) && + String::IsAscii(chars.begin(), chars.length()) && + memcmp(bytes.begin(), chars.begin(), byte_length) == 0) { + return true; + } } position_ = original_position;