mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 00:49:46 +00:00
Revert "LibJS: Use HashMap::ensure() in VM string cache helpers"
This reverts commit 5810ddf339.
Appears to have introduced flakiness on WPT.
This commit is contained in:
parent
0d62803f15
commit
7a2fe53c65
Notes:
github-actions[bot]
2025-10-06 10:18:09 +00:00
Author: https://github.com/awesomekling
Commit: 7a2fe53c65
2 changed files with 13 additions and 10 deletions
|
|
@ -35,9 +35,12 @@ GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, Utf16String const& stri
|
|||
}
|
||||
|
||||
auto& string_cache = vm.utf16_string_cache();
|
||||
return *string_cache.ensure(string, [&] {
|
||||
return vm.heap().allocate<PrimitiveString>(string);
|
||||
});
|
||||
if (auto it = string_cache.find(string); it != string_cache.end())
|
||||
return *it->value;
|
||||
|
||||
auto new_string = vm.heap().allocate<PrimitiveString>(string);
|
||||
string_cache.set(move(string), new_string);
|
||||
return *new_string;
|
||||
}
|
||||
|
||||
GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, Utf16View const& string)
|
||||
|
|
@ -64,9 +67,9 @@ GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, String const& string)
|
|||
if (auto it = string_cache.find(string); it != string_cache.end())
|
||||
return *it->value;
|
||||
|
||||
return string_cache.ensure(string, [&] {
|
||||
return vm.heap().allocate<PrimitiveString>(string);
|
||||
});
|
||||
auto new_string = vm.heap().allocate<PrimitiveString>(string);
|
||||
string_cache.set(move(string), new_string);
|
||||
return *new_string;
|
||||
}
|
||||
|
||||
GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, StringView string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue