On 2014/05/08 09:17:48, rossberg wrote:
I agree with Michael, that seems too simplistic an implementation. We need a proper solution for memory management and rehashing. That requires the use of
weakness in some form or the other.

Michael and I have discussed this a couple of days ago. The current
implementation with a doubly-linked list of iterators will be very hard to
make
weak correctly. We hence concluded that this is probably the wrong approach moving forward. One alternative might be to have each map/set carry a weak set
of its iterators, and defer rehashing to points where that is empty. But
perhaps
there are other solutions.

I'm also not sure iterators are worth introducing a separate flag, or a
separate
file.

It is true that this ties the lifetime of the iterator and the map together. It
is a known temporary restriction.

I know how to solve the memory management but I haven't yet been able to figure out how to get that working in the V8 code base. I've talked this through with
Adam so he knows the basics of the solution too.

The idea is to have a single linked list. When GC happens we remove the
collected items from this list. Similar to how you currently do VisitWeakList
and WeakListVisitor. This means that the Map/Set does not keep the iterator
alive but the iterator keeps the Map/Set alive which is a requirement. I took
some rough notes when I looked at this last time:
https://docs.google.com/a/google.com/document/d/1-v25eMlmIJFdeAlYEziSV0VXI9QWUSWbdz6tuE-A22o/edit#heading=h.e03fz1pee5xt

This was done as a seperate file because iterators depends on Symbol which we are not shipping and no other browser has implemented. Since everyone else is
shipping Map and Set I didn't want to gate Map and Set on Symbols.

https://codereview.chromium.org/259883002/

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to