Improve performance of Reference processing.

By using synchronization on the ReferenceQueue instead of volatile
modifiers, and adding internal support for ReferenceQueue batch
enqueue and remove.

ReferenceBenchmark improvements on hammerhead:
                            Alloc   250 =>  150
                  AllocAndEnqueue  1060 =>  612
              AllocEnqueueAndPoll  1300 =>  725
            AllocEnqueueAndRemove  1350 =>  812
    AllocImplicitEnqueueAndRemove  7000 => 1758
                     Finalization 10000 => 6095

Bug: 24404957
Change-Id: I6c3e83f7c34f5c22b001e513b50c932a0d54fd43
4 files changed