Mark the given object gray if it is on the heap.
Note marking is done implicitly by placing it in a buffer, to avoid repeated re-scanning.
This function must be executed once the thread lock has been acquired.