v8: backport b3775cf3 from upstream