[oilpan]: fix for bug 393834.
[oilpan]: fix for bug 393834.

The issue is because I don't take the threadAttachMutex while doing thread local GCs. When doing marking we have debug asserts that check we are not marking objects that are not in the heap pages. This assert iterates over our threadAttachedSet which can be modified during the thread local GC, ie. a new thread can attach itself or another thread that just did shutdown could remove itself.

This means that we could be iterating a set while it is being modified. To avoid this I have changed the thread local GC to take the threadAttachMutex rather than use a new threadShutdownMutex in debug builds. This ensures no other threads are added/removed in debug.

I am still undecided whether patch 1 or 2 is the best approach. The latter is still a bit fragile since it relies on attachedThreads set not being iterated in release builds. Also the threadedWeakness test should ideally not assume that the GC succeeded and collected any garbage since it could be busy (as it is in this case).

R=ager@chromium.org, erik.corry@gmail.com, haraken@chromium.org, oilpan-reviews@chromium.org, tkent@chromium.org, vegorov@chromium.org, zerny@chromium.org
BUG=393834

Review URL: https://codereview.chromium.org/396213003

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@178352 bbb929c8-8fbe-4397-9dbb-9b2b20218538

primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs