• Benedikt Meurer's avatar
    [turbofan] Remove unnecessary MaybeGrowFastElements operations. · 4bfa074b
    Benedikt Meurer authored
    When we detect during SimplifiedLowering that the index for the
    MaybeGrowFastElements operation is less than the length of the
    array, which are both passed as explicit parameters to the
    operation, we can just drop the operation from the graph completely
    and go with the existing elements. This happens for example when
    code creates a new Array and immediately stores to it, i.e. like
    in the case of
    
    ```js
    const array = new Array();
    array.push(something);
    ```
    
    where the `new Array()` already creates a backing store of 4 elements,
    so the check for growing in `Array#push()` is redundant here.
    
    Change-Id: I548049b2c7b60c5f189f8ffdcb20b3a6ff1b0555
    Reviewed-on: https://chromium-review.googlesource.com/1238655Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#56153}
    4bfa074b
simplified-lowering.cc 159 KB