• Leszek Swirski's avatar
    [csa] Add "Iterate" helper to IteratorBuiltinsAssembler · 50304f87
    Leszek Swirski authored
    "Iterate" takes an iterable and a function of TNode<Object>, and
    implements the iterator protocol to iterate the iterable, applying the
    function to each element.
    
    It handles exceptions thrown during iteration and closes the iterator as
    appropriate -- the hope is that if the body of the iteration has no
    exception-throwing nodes, TurboFan can dead-code eliminate this close.
    
    In the future, we may want to add an array fast-path to this method;
    centralising the implementation means that this fast-path will then be
    used by all callers of Iterate.
    
    Change-Id: I9fe2f862b78619fe21ea7cb6469ed7ba93f14a30
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3581770Reviewed-by: 's avatarFrank Tang <ftang@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#80075}
    50304f87