Fix race conditions caused by StartGC.

Race1: Heap trimming could happen when we were transitioning the heap.
This caused the space to get deleted in the middle of the trim.

Race2: IncrementDisableCompactingGC needed to WaitForConcurrentGC if
we were running a moving GC or about to starting a moving GC.

Race3: The logic for whether or not we had a compacting GC was
calculated before StartGC in CollectGarbageInternal. This could cause
us to get blocked waiting for the GC to complete and come out of the
wait with a new collector_type_ due to a heap transition.

Change-Id: I07c36ae5df1820e9cca70cf239e46175c1eb9575
3 files changed