Speed up Finalizer Daemon

Finalization performance is occasionally performance critical.
Do as little per-object work in the finalizer as we possibly can.
This removes a per object lock acquisition, notify, and system
call (via JNI) to get the current time.

It also fixes a lost notify bug that could theoretically prevent
the last finalizer from ever timing out, and reduces the already
tiny chance of reporting the wrong object for a finalizer
timeout.

Minor disadvantages: A nonterminating finalizer can take twice
as long to time out.  The code is even more subtle.

Add benchmark to measure timing impact.

This was measured to improve performance on the added benchmark
by somewhere around 2 or 3%, which is hardly impressive.  But
we've discovered several otheri, probably more serious, performance
issues in this area, which should eventually make those 2 or 3% more
noticeable. And we have to start somewhere.

Bug: 24404957
Change-Id: I77cc1222752ad05caf90001126f3e9eb016b296e
2 files changed