Commit fc0cbc14 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[runtime] Don't add slack capacity to StringTable shrink

Since we now add the additional required capacity when assessing
StringTable shrinking during LookupKey-caused string insertion, we no
longer have to add a slack capacity. This more closely matches previous
behaviour, which didn't consider the additional required capacity but
did add slack (which, because of rounding to the next power of two,
amounts to the same thing).

Bug: chromium:1108258
Change-Id: I81f513fdc800a2caab76e030c0c5e767cd1360d1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2324253
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69127}
parent a6e93ab5
......@@ -6168,10 +6168,7 @@ int StringTable::ComputeCapacityWithCautiousShrink(int current_capacity,
if (current_capacity <= StringTable::kMinCapacity) return current_capacity;
if (at_least_room_for > (current_capacity / kMaxEmptyFactor))
return current_capacity;
// Keep capacity for at least a quarter of the current nof elements.
int slack_capacity = at_least_room_for / 4;
return ComputeCapacityWithShrink(current_capacity,
at_least_room_for + slack_capacity);
return ComputeCapacityWithShrink(current_capacity, at_least_room_for);
}
namespace {
......
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