Move checks for references into slow paths.