ART: checkpoint mechanism optimization

GC thread and trim thread are both using checkpoint mechanism. GC thread
will request java threads to mark their thread roots by themselves. Trim
thread will request java threads to trim their jni local reference
tables by themselves.

The checkpint mechanism semantics is that the runnable java threads will
run checkpoint function itself at safepoint, and finally the java
threads and gc thread or trim thread is synchronized via barrier. If the
java threads are not runnable, gc thread or trim thread will suspend
them and then run their checkpoint functions one by one on behalf of
them. If all the java threads are not runnable, then gc thread or trim
thread will do all the work itself. In this case, there is no need
synchronization. This will save unnecessary synchronization and thread
state transitions.

Change-Id: If55940946cb3f8b1af42c7237c334f09c8ec7a9f
4 files changed