Commit 5cf05dca authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[json] Restore string two-to-one-byte conversion during internalization

This was accidentally dropped when unifying the internalization code.

Change-Id: I2fd7127f85f0e3e9abd1ae834130f0c9da37363e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627529Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61788}
parent 7b386394
......@@ -988,24 +988,20 @@ Handle<String> JsonParser<Char>::DecodeString(
{
DisallowHeapAllocation no_gc;
SinkChar* dest = intermediate->GetChars(no_gc);
if (string.has_escape()) {
DecodeString(dest, string.start(), string.length());
} else {
DCHECK_IMPLIES(string.internalize(), string.needs_conversion());
if (!string.has_escape()) {
DCHECK(!string.internalize());
CopyChars(dest, chars_ + string.start(), string.length());
return intermediate;
}
DecodeString(dest, string.start(), string.length());
if (!string.internalize()) return intermediate;
Vector<const SinkChar> data(dest, string.length());
if (!hint.is_null() && Matches(data, hint)) {
DCHECK(string.internalize());
return hint;
}
if (!hint.is_null() && Matches(data, hint)) return hint;
}
if (string.internalize()) {
return factory()->InternalizeString(intermediate, 0, string.length());
}
return intermediate;
}
template <typename Char>
......@@ -1020,10 +1016,11 @@ Handle<String> JsonParser<Char>::MakeString(const JsonString& string,
}
if (chars_may_relocate_) {
return factory()->InternalizeString(Handle<SeqString>::cast(source_),
string.start(), string.length());
string.start(), string.length(),
string.needs_conversion());
}
Vector<const Char> chars(chars_ + string.start(), string.length());
return factory()->InternalizeString(chars);
return factory()->InternalizeString(chars, string.needs_conversion());
}
if (sizeof(Char) == 1 ? V8_LIKELY(!string.needs_conversion())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment