[oilpan]: Make thread shutdown more robust.

Change the way we shutdown threads to ensure we are not leaving dangling pointers from other thread heaps into pages being freed at shutdown.

Thread shutdown algorithm:

1. Mark all pages belonging to the thread as being in the shutdown phase. This helps us to avoid trace pages not belonging to the thread being shut down.
2. Trace the thread’s objects using only the thread local persistents as roots.
3. Sweep the thread’s pages, any empty pages are put in the orphaned page pool since there is a risk a conservatively found (dead) object in another thread could trace this thread’s pages in the following global GC. The page is moved from the orphaned page pool to the memory pool after a global GC marking at which point we know it cannot be reached.
4. Repeat step 2 and 3 until the number of thread local persistents reaches zero or does not decrease.
5. Do a final sweep with no tracing to finalize the remaining objects in the thread’s heaps.
6. When destructing the thread state move any remaining pages or large objects to the orphaned page pool.

To make the above assumption of the next global GC marking being sufficient to know that a page cannot be reached we need to guarantee that an object cannot be revived. Reviving an object can happen if a thread doesn’t get to sweep before the next GC marking phase. In that case the new marking could conservatively find an object on the heap that were not found in the first marking and hence revive an object that were dead.
This newly revived object could contain pointers to another object on a thread that had swept its pages and we would then try to trace potential garbage or even a newly allocated object on the swept object’s location.

We have introduced a dead bit to avoid the above. This dead bit is set during the prepareForGC call if a thread didn’t get to sweep before the new GC.

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=375671

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

git-svn-id: svn://svn.chromium.org/blink/trunk@178044 bbb929c8-8fbe-4397-9dbb-9b2b20218538