• adamk@chromium.org's avatar
    ES6: Add support for Map/Set forEach · 7c300d1f
    adamk@chromium.org authored
    This implements MapIterator and SetIterator which matches
    the same constructs in the ES6 spec. However, these 2
    iterators are not exposed to user code yet. They are only
    used internally to implement Map.prototype.forEach and
    Set.prototype.forEach.
    
    Each iterator has a reference to the OrderedHashTable where
    it directly accesses the hash table's entries.
    
    The OrderedHashTable has a reference to the newest iterator
    and each iterator has a reference to the next and previous
    iterator, effectively creating a double linked list.
    
    When the OrderedHashTable is mutated (or replaced) all the
    iterators are updated.
    
    When the iterator iterates passed the end of the data table
    it closes itself. Closed iterators no longer have a
    reference to the OrderedHashTable and they are removed from
    the double linked list. In the case of Map/Set forEach, we
    manually call Close on the iterator in case an exception was
    thrown so that the iterator never reached the end.
    
    At this point the OrderedHashTable keeps all the non finished
    iterators alive but since the only thing we currently expose
    is forEach there are no unfinished iterators outside a forEach
    call. Once we expose the iterators to user code we will need
    to make the references from the OrderedHashTable to the
    iterators weak and have some mechanism to close an iterator
    when it is garbage collected.
    
    BUG=1793,2323
    LOG=Y
    TBR=mstarzinger@chromium.org
    
    Review URL: https://codereview.chromium.org/240323003
    
    Patch from Erik Arvidsson <arv@chromium.org>.
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20823 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    7c300d1f
Name
Last commit
Last update
benchmarks Loading commit data...
build Loading commit data...
include Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
Makefile.nacl Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...