Make ObjectRegistry::InternalAdd GC safe

Because a call to IdentityHashCode may cause GC, the object pointer
may become invalid (if the object has been moved) on next uses. We
now access the object through a Handle to be GC safe.

Also remove unused methods.

Bug: 18098424

(cherry picked from commit e2d628b5b0a1b9c29c173f3cbad3ef6cb6c24d2d)

Change-Id: I4fdff54053aa947765a39adf67345b08816387e5
2 files changed