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

Issue 238063009: ES6: Add support for Map/Set forEach (Closed)

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

Description

ES6: Add support for Map/Set forEach 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 R=adamk@chromium.org TBR=mstarzinger@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=20857

Patch Set 1 #

Total comments: 4

Patch Set 2 : Remove explicit instantiation of private and functions in objects-inl.h #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1287 lines, -71 lines) Patch
M src/arm/full-codegen-arm.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/arm64/full-codegen-arm64.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/array-iterator.js View 2 chunks +5 lines, -10 lines 0 comments Download
M src/bootstrapper.cc View 2 chunks +27 lines, -16 lines 0 comments Download
M src/collection.js View 5 chunks +54 lines, -6 lines 0 comments Download
M src/contexts.h View 2 chunks +6 lines, -2 lines 0 comments Download
M src/factory.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/factory.cc View 2 chunks +13 lines, -0 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/macros.py View 1 chunk +5 lines, -0 lines 0 comments Download
M src/mips/full-codegen-mips.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/objects.h View 14 chunks +181 lines, -9 lines 0 comments Download
M src/objects.cc View 1 11 chunks +325 lines, -20 lines 0 comments Download
M src/objects-debug.cc View 3 chunks +40 lines, -0 lines 0 comments Download
M src/objects-inl.h View 5 chunks +48 lines, -0 lines 0 comments Download
M src/objects-printer.cc View 4 chunks +51 lines, -3 lines 1 comment Download
M src/objects-visiting.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/runtime.h View 1 chunk +10 lines, -0 lines 0 comments Download
M src/runtime.cc View 4 chunks +85 lines, -0 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/test-ordered-hash-table.cc View 8 chunks +84 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/collections.js View 1 chunk +344 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
arv (Not doing code reviews)
6 years, 8 months ago (2014-04-16 22:03:03 UTC) #1
arv (Not doing code reviews)
Now with explicit instantiation of all the functions instead of explicit instantiation of the class
6 years, 8 months ago (2014-04-16 22:03:50 UTC) #2
adamk
https://codereview.chromium.org/238063009/diff/1/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/238063009/diff/1/src/objects.cc#newcode16532 src/objects.cc:16532: OrderedHashTable<OrderedHashSet, JSSetIterator, 1>::Rehash( This is private, so all calls ...
6 years, 8 months ago (2014-04-16 22:13:14 UTC) #3
arv (Not doing code reviews)
Remove explicit instantiation of private and functions in objects-inl.h
6 years, 8 months ago (2014-04-16 22:36:26 UTC) #4
adamk
lgtm, will try one more time https://codereview.chromium.org/238063009/diff/20001/src/objects-printer.cc File src/objects-printer.cc (right): https://codereview.chromium.org/238063009/diff/20001/src/objects-printer.cc#newcode795 src/objects-printer.cc:795: OrderedHashMap>::OrderedHashTableIteratorPrint(FILE* out); I ...
6 years, 8 months ago (2014-04-16 22:48:05 UTC) #5
adamk
6 years, 8 months ago (2014-04-17 17:45:45 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 manually as r20857 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698