Factor out repeated Ref key string generation code.

In src/core/obj.js, we convert a Ref to a string to index into a table like
this: 'R1.0'.  This conversion is repeated numerous times.

This patch factors out the conversion into a new function.
Ref.prototype.toString().
Merge pull request #4973 from nnethercote/better-ref-keys

Factor out repeated Ref key string generation code.