Ab initio study of ferroelectric and nonlinear optical performance in BiFeO3 ultrathin films