re2: import various changes from Google's copy

Change-Id: I63bd284d742da393713dfdd0164d2ff38fd44920
Reviewed-on: https://code-review.googlesource.com/1592
Reviewed-by: Russ Cox <rsc@swtch.com>