-
Patrick Thier authored
This CL fixes 2 issues with string internalization when the string table is shared: 1. In-place migration of a string's map to Internalized was done before it was sure that the string is going to be internalized (outside the critical section). To fix this problem StringTableKey::AsHandle() is now split into StringTableKey::PrepareForInsertion(), which is invoked outside the critical section and creates a copy if necessary, and StringTableKey::GetHandleForInsertion(), which is invoked inside the critical section only for string table misses. Migration of the map is handled by this method. 2. TryStringToIndexOrLookupExisting() didn't handle already internalized strings. So far this was impossible, as this method was only invoked for strings that were checked not to be internalized. However with a shared string table, the string could be internalized after the checks. Bug: v8:12007 Change-Id: I193d6b54dc41360eee47d21cbcaa36d2652d85dd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3368103Reviewed-by: Shu-yu Guo <syg@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Patrick Thier <pthier@chromium.org> Cr-Commit-Position: refs/heads/main@{#78600}
cc3c93f1