Replace objects with identical values by function calls.