[web snapshots] Fix the perf fix: pre-reserve the right amount of space in the global object

Bug: v8:11525
Change-Id: I4df5144a7d0ed2b68cf15c7bfd72ce4a17ad4e41
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3416237
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78771}
This commit is contained in:
Marja Hölttä 2022-01-26 11:13:36 +01:00 committed by V8 LUCI CQ
parent 4c6331ba7e
commit 708cd79f98

View File

@ -1762,7 +1762,8 @@ void WebSnapshotDeserializer::DeserializeExports() {
Handle<GlobalDictionary> dictionary(
global->global_dictionary(isolate_, kAcquireLoad), isolate_);
dictionary = GlobalDictionary::EnsureCapacity(isolate_, dictionary, count,
dictionary = GlobalDictionary::EnsureCapacity(
isolate_, dictionary, dictionary->NumberOfElements() + count,
AllocationType::kYoung);
global->set_global_dictionary(*dictionary, kReleaseStore);