I figured out what's going on with this test case. It's a tricky issue. The
problem is that CompileRun() will return the return value of the script in the current handle scope. Since the return value of Object.observe(o,f) is "o", the
object being observed will be strongly reachable from the HandleScope of the
test, which in turn means it cannot be collected.

The solution is either to 1) wrap the CompileRun calls in a separate HandleScope
or 2) change the return value by using something like
"CompileRun("Object.observe({}, function(){}); 0;");"

The drawback of 1) is that it might mask real leaks that happen within the
object-observe implementation due to missing HandleScopes.

The drawback of 2) is that it is, well, ugly.

Both fixes make the test run just fine. Please not that you don't need two GCs for the WeakMaps to be cleared, just one is sufficient. That is one of the cool
things about WeakMaps. Hope this helps.

https://codereview.chromium.org/12092079/

--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to