[utils] Fix new length computation when growing BitVector
The {std::min} followed by a loop does ensure that the new length is bigger than {needed_value}, but does not ensure that we always allocate at least {kInitialLength}. Maybe this was intended to be {std::max}? Anyway, this CL replaces the loop by a computation which ensures that we allocate a power of two that is greater than {needed_value} and at least {kInitialLength}. It also adds a CHECK to guard against integer overflows. R=jkummerow@chromium.org Bug: v8:13063 Change-Id: I374d304204a499536643a6c5df7111231d41d4bd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3760674Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#81724}
Showing
Please
register
or
sign in
to comment