• Clemens Backes's avatar
    [utils] Add OwnedVector::NewForOverwrite · ff2e485f
    Clemens Backes authored
    The existing {OwnedVector::New} value-initializes all elements, which
    means zeroing them in case on integral types. In many cases though we
    know that we will overwrite the content anyway, so the initialization is
    redundant.
    In the case of assembly buffers for wasm compilation, this zeroing
    showed up with several percent of execution times for some benchmarks.
    
    Hence this CL introduces a new {OwnedVector::NewForOverwrite} (along the
    lines of {std::make_unique_for_overwrite}), which only
    default-initializes the values (meaning no initialization for integral
    values).
    
    R=thibaudm@chromium.org
    
    Bug: v8:10576
    Change-Id: I8d2806088acebe8a264dea2c7ed74b0423671d4f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2237140
    Commit-Queue: Clemens Backes <clemensb@chromium.org>
    Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#68268}
    ff2e485f
vector.h 9.69 KB