One problem and one observation. If you don't think they are real problems, could you add unittests to prove that?
Problem. Imagine we have objects A and B, A refers to B, A is held only by weak handle, B is only held by really weak handle. Now, GC occurs and both A and B are found to be only weakly reachable. Now imagine that weak reference callback of A makes A strongly reachable. If I understand this change correctly, that's a problem as B would be already collected even though it becoms stronlgy reachable after A's weak callback. One solution I can immediately think of is to collect immediately only objects held exactly by one really weak handle, but I am not sure what's the price to pay. Another solution is to defer collect after all weak callbacks were ran, but that seems quite heaviweight. Observation. Imaging object A held by really weak handle. Once again GC occurs, finds this A only weakly reachable and collects it. However, before weak reference callback of A is invoked, some other weak reference callback is invoked which goes back to V8. This running code attempts to access A's handle (e.g. via DOM node map), handle is yet in the map (A's weak reference callback hasn't been invoked), but object is already collected. Cure is simple---for caches one need to check if handle is near death---but that need to be implemented and has (probably non-existent) performance penalties. http://codereview.chromium.org/260017 --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
