Federer advances to quarterfinals at Toronto