ES6 Map/Set iterators/forEach improvements
authoradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 20 May 2014 14:22:05 +0000 (14:22 +0000)
committeradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 20 May 2014 14:22:05 +0000 (14:22 +0000)
commit70c3a714a134ba989fc9e28f8944df3ead95cc02
treeda70a8b6d8bb1eba2405247aa6b9d3b0157d4023
parent014bf8b407e92183da27ddf1192d250391f9a2ad
ES6 Map/Set iterators/forEach improvements

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
12 files changed:
src/collection.js
src/objects-debug.cc
src/objects-inl.h
src/objects-printer.cc
src/objects.cc
src/objects.h
src/runtime.cc
src/runtime.h
test/mjsunit/harmony/collections.js
test/mjsunit/runtime-gen/mapiteratorclose.js [deleted file]
test/mjsunit/runtime-gen/setiteratorclose.js [deleted file]
tools/generate-runtime-tests.py