• Benedikt Meurer's avatar
    [es2015] Use [[ArrayIteratorNextIndex]] to indicate exhaustion. · 6031f172
    Benedikt Meurer authored
    Instead of changing the [[IteratedObject]] field to undefined to mark an
    array iterator as exhausted, store the appropriate maximum value into
    the [[ArrayIteratorNextIndex]] field such that the iterator will never
    produce any values again.
    
    Without this change the map check and the "length" access on the
    [[IteratedObject]] cannot be eliminated inside the loop, since the
    object can either be the array or undefined. Even with this change
    it's still not possible immediately due to missing aliasing
    information in the LoadElimination, but it paves the way for follow
    up improvements. Eventually the goal is to have `for..of` as fast as
    a traditional `for` loop even for really tight loops.
    
    This CL also hardens the implementation of the ArrayIterator by using
    proper CASTs and CSA_ASSERTs. The readability of the CSA builtin was
    improved by utilizing proper helper functions.
    
    Bug: v8:7510, v8:7514, v8:8070
    Change-Id: Ib46604fadad1a0f80e77fe71a1f47b0ca31ab841
    Reviewed-on: https://chromium-review.googlesource.com/1181902
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#55261}
    6031f172
objects-debug.cc 73.7 KB