Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Issue 289503002: ES6 Map/Set iterators/forEach improvements (Closed)

Created:
6 years, 7 months ago by arv (Not doing code reviews)
Modified:
6 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

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 Committed: https://code.google.com/p/v8/source/detail?r=21389

Patch Set 1 #

Patch Set 2 : Comment improvements #

Total comments: 5

Patch Set 3 : partial code review feedback update #

Total comments: 1

Patch Set 4 : Store the removed indexes in the old table #

Patch Set 5 : Ready for review again #

Total comments: 8

Patch Set 6 : Rename and more #

Patch Set 7 : Expanded tests and fixed edge case #

Total comments: 2

Patch Set 8 : Add more tests #

Total comments: 2

Patch Set 9 : Add comment for Transition #

Total comments: 2

Patch Set 10 : Updated test #

Patch Set 11 : git rebase to fix merge conflict #

Unified diffs Side-by-side diffs Delta from patch set Stats (+280 lines, -267 lines) Patch
M src/collection.js View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -12 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 10 chunks +58 lines, -65 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 9 10 12 chunks +81 lines, -135 lines 0 comments Download
M src/objects-debug.cc View 2 chunks +0 lines, -12 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -5 lines 0 comments Download
M src/objects-printer.cc View 1 chunk +0 lines, -6 lines 0 comments Download
M src/runtime.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -18 lines 0 comments Download
M test/mjsunit/harmony/collections.js View 1 2 3 4 5 6 7 8 9 1 chunk +135 lines, -0 lines 0 comments Download
D test/mjsunit/runtime-gen/mapiteratorclose.js View 1 chunk +0 lines, -5 lines 0 comments Download
D test/mjsunit/runtime-gen/setiteratorclose.js View 1 chunk +0 lines, -5 lines 0 comments Download
M tools/generate-runtime-tests.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
arv (Not doing code reviews)
Comment improvements
6 years, 7 months ago (2014-05-13 22:26:12 UTC) #1
arv (Not doing code reviews)
Thanks Andreas for all the help. This turned out to be a lot simpler than ...
6 years, 7 months ago (2014-05-13 22:27:42 UTC) #2
rossberg
This looks good already. But I wonder if we can do even better and avoid ...
6 years, 7 months ago (2014-05-14 12:13:46 UTC) #3
arv (Not doing code reviews)
partial code review feedback update
6 years, 7 months ago (2014-05-14 13:55:46 UTC) #4
arv (Not doing code reviews)
On 2014/05/14 12:13:46, rossberg wrote: > This looks good already. But I wonder if we ...
6 years, 7 months ago (2014-05-14 14:02:31 UTC) #5
arv (Not doing code reviews)
https://codereview.chromium.org/289503002/diff/20001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/289503002/diff/20001/src/objects.cc#newcode16513 src/objects.cc:16513: if (entry_index < index) { On 2014/05/14 12:13:46, rossberg ...
6 years, 7 months ago (2014-05-14 14:02:38 UTC) #6
rossberg
On 2014/05/14 14:02:31, arv wrote: > On 2014/05/14 12:13:46, rossberg wrote: > > This looks ...
6 years, 7 months ago (2014-05-14 14:23:31 UTC) #7
rossberg
https://codereview.chromium.org/289503002/diff/40001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/289503002/diff/40001/src/objects.cc#newcode16513 src/objects.cc:16513: if (entry_index < index) { You can simplify this ...
6 years, 7 months ago (2014-05-14 14:27:25 UTC) #8
arv (Not doing code reviews)
On 2014/05/14 14:23:31, rossberg wrote: > On 2014/05/14 14:02:31, arv wrote: > > On 2014/05/14 ...
6 years, 7 months ago (2014-05-14 14:42:47 UTC) #9
arv (Not doing code reviews)
Store the removed indexes in the old table
6 years, 7 months ago (2014-05-14 16:25:37 UTC) #10
arv (Not doing code reviews)
Ready for review again
6 years, 7 months ago (2014-05-14 16:42:14 UTC) #11
arv (Not doing code reviews)
PTAL
6 years, 7 months ago (2014-05-14 16:42:48 UTC) #12
rossberg
Looks pretty good now. One thing: do we have tests for the edge cases? In ...
6 years, 7 months ago (2014-05-14 17:21:36 UTC) #13
arv (Not doing code reviews)
Rename and more
6 years, 7 months ago (2014-05-14 17:50:53 UTC) #14
arv (Not doing code reviews)
I'll expand on the tests. Make sure all code paths are covered. https://codereview.chromium.org/289503002/diff/100001/src/objects.cc File src/objects.cc ...
6 years, 7 months ago (2014-05-14 17:51:23 UTC) #15
arv (Not doing code reviews)
Expanded tests and fixed edge case
6 years, 7 months ago (2014-05-14 20:31:03 UTC) #16
arv (Not doing code reviews)
PTAL https://codereview.chromium.org/289503002/diff/140001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/289503002/diff/140001/src/objects.cc#newcode16244 src/objects.cc:16244: if (nof >= (capacity >> 2)) return table; ...
6 years, 7 months ago (2014-05-14 20:36:36 UTC) #17
rossberg
The implementation looks good to go, but it would be preferable to also have separate ...
6 years, 7 months ago (2014-05-15 09:09:34 UTC) #18
arv (Not doing code reviews)
Add more tests
6 years, 7 months ago (2014-05-15 16:26:14 UTC) #19
arv (Not doing code reviews)
Add more tests
6 years, 7 months ago (2014-05-15 16:26:59 UTC) #20
arv (Not doing code reviews)
On 2014/05/15 09:09:34, rossberg wrote: > The implementation looks good to go, but it would ...
6 years, 7 months ago (2014-05-15 16:29:14 UTC) #21
Michael Starzinger
LGTM on the implementation. I like this approach! I'll leave judgment of the test coverage ...
6 years, 7 months ago (2014-05-15 18:23:56 UTC) #22
arv (Not doing code reviews)
Add comment for Transition
6 years, 7 months ago (2014-05-15 18:33:45 UTC) #23
arv (Not doing code reviews)
Thanks Michael. https://codereview.chromium.org/289503002/diff/180001/src/objects.h File src/objects.h (right): https://codereview.chromium.org/289503002/diff/180001/src/objects.h#newcode10036 src/objects.h:10036: void Transition(); On 2014/05/15 18:23:57, Michael Starzinger ...
6 years, 7 months ago (2014-05-15 18:34:23 UTC) #24
rossberg
https://codereview.chromium.org/289503002/diff/200001/test/mjsunit/harmony/collections.js File test/mjsunit/harmony/collections.js (right): https://codereview.chromium.org/289503002/diff/200001/test/mjsunit/harmony/collections.js#newcode922 test/mjsunit/harmony/collections.js:922: map.delete(v + 1); If I read this correctly, this ...
6 years, 7 months ago (2014-05-16 16:10:18 UTC) #25
arv (Not doing code reviews)
Updated test
6 years, 7 months ago (2014-05-20 00:00:33 UTC) #26
arv (Not doing code reviews)
git rebase to fix merge conflict
6 years, 7 months ago (2014-05-20 00:16:25 UTC) #27
arv (Not doing code reviews)
PTAL https://codereview.chromium.org/289503002/diff/200001/test/mjsunit/harmony/collections.js File test/mjsunit/harmony/collections.js (right): https://codereview.chromium.org/289503002/diff/200001/test/mjsunit/harmony/collections.js#newcode922 test/mjsunit/harmony/collections.js:922: map.delete(v + 1); On 2014/05/16 16:10:18, rossberg wrote: ...
6 years, 7 months ago (2014-05-20 00:29:58 UTC) #28
rossberg
Thanks, LGTM
6 years, 7 months ago (2014-05-20 12:14:20 UTC) #29
adamk
6 years, 7 months ago (2014-05-20 14:22:24 UTC) #30
Message was sent while issue was closed.
Committed patchset #11 manually as r21389 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698