• adamk@chromium.org's avatar
    ES6 Map/Set iterators/forEach improvements · 70c3a714
    adamk@chromium.org authored
    This changes how Map/Set interacts with its iterators. When the
    underlying table is rehashed or cleared, we create a new table (like
    before) but we add a reference from the old table to the new table. We
    also add an array describing how to transition the iterator from the
    old table to the new table.
    
    When Next is called on the iterator it checks if there is a newer table
    that it should transition to. If there is, it updates the index based
    on the previously recorded changes and finally changes itself to point
    at the new table.
    
    With these changes Map/Set no longer keeps the iterators alive. Also,
    as before, the iterators keep the underlying table(s) alive but not the
    actual Map/Set.
    
    BUG=v8:1793
    LOG=Y
    R=mstarzinger@chromium.org, rossberg@chromium.org
    
    Review URL: https://codereview.chromium.org/289503002
    
    Patch from Erik Arvidsson <arv@chromium.org>.
    
    git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21389 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    70c3a714
collection.js 5.7 KB