Commit 35918904 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Properly handle thin strings in sliced strings

... when querying internalized strings table and computing hash.

Bug: chromium:974612
Change-Id: I59eed1477c8893cd0ff3eae593da092492668614
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1678418Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62416}
parent f7abd626
......@@ -6773,7 +6773,9 @@ Address StringTable::LookupStringIfExists_NoAllocate(Isolate* isolate,
}
if (source.IsThinString()) {
source = ThinString::cast(source).actual();
if (start == 0) return source.ptr();
if (string.length() == source.length()) {
return source.ptr();
}
}
if (source.IsOneByteRepresentation()) {
return i::LookupString<uint8_t>(isolate, string, source, start);
......
......@@ -1335,7 +1335,7 @@ uint32_t String::ComputeAndSetHash() {
}
if (string.IsThinString()) {
string = ThinString::cast(string).actual();
if (start == 0) {
if (length() == string.length()) {
set_hash_field(string.hash_field());
return hash_field() >> kHashShift;
}
......
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