  We study the evolution of galactic bars and the link with disk and spheroid
formation in a sample of zoom-in cosmological simulations. Our simulation
sample focuses on galaxies with present-day stellar masses in the 10^10-10^11
Msun range, in field and loose group environments, with a broad variety of mass
growth histories. In our models, bars are almost absent from the progenitors of
present-day spirals at z>1.5, and they remain rare and generally too weak to be
observable down to z~1. After this characteristic epoch, the fractions of
observable and strong bars raise rapidly, bars being present in 80% of spiral
galaxies and easily observable in two thirds of these at z<0.5. This is
quantitatively consistent with the redshift evolution of the observed bar
fraction. Our models predict that the decrease in the bar fraction with
increasing redshift should continue with a fraction of observable bars <10-15%
in disk galaxies at z>1. Our models also predict later bar formation in
lower-mass galaxies, in agreement with existing data. We find that the
characteristic epoch of bar formation, namely redshift z~0.8-1, corresponds to
the epoch at which today's spirals acquire their disk-dominated morphology. At
higher redshift, disks tend to be rapidly destroyed by mergers and
gravitational instabilities and rarely develop significant bars. The bar
formation epoch corresponds to the transition between an early "violent" phase
of spiral galaxy formation at z>1 and a late "secular" phase at z<0.8. In the
secular phase, the presence of bars substantially contributes to the growth of
the bulge, but the bulge mass budget remains statistically dominated by the
contribution of mergers, interactions and disk instabilities at high redshift.
Early bars at z>1 are often short-lived, while most of the bars formed at z<1
persist down to z=0, late cosmological gas infall being necessary to maintain
some of them.
