We exploit the first public data release of VIPERS to investigate environmental effects in the evolution of galaxies between z ∼ 0.5 and 0.9. The large number of spectroscopic redshifts (more than 50 000) over an area of about 10 deg 2 provides a galaxy sample with high statistical power. The accurate redshift measurements (σ z = 0.00047(1 + z spec )) allow us to robustly isolate galaxies living in the lowest and highest density environments (δ < 0.7 and δ > 4, respectively) as defined in terms of spatial 3D density contrast δ. We estimate the stellar mass function of galaxies residing in these two environments and constrain the high-mass end (M 10 11 M ) with unprecedented precision. We find that the galaxy stellar mass function in the densest regions has a different shape than was measured at low densities, with an enhancement of massive galaxies and a hint of a flatter (less negative) slope at z < 0.8. We normalise each mass function to the comoving volume occupied by the corresponding environment and relate estimates from different redshift bins. We observe an evolution of the stellar mass function of VIPERS galaxies in high densities, while the low-density one is nearly constant. We compare these results to semi-analytical models and find consistent environmental signatures in the simulated stellar mass functions. We discuss how the halo mass function and fraction of central/satellite galaxies depend on the environments considered, making intrinsic and environmental properties of galaxies physically coupled, hence difficult to disentangle. The evolution of our lowdensity regions is described well by the formalism introduced by Peng et al. (2010, ApJ, 721, 193), and is consistent with the idea that galaxies become progressively passive because of internal physical processes. The same formalism could also describe the evolution of the mass function in the high density regions, but only if a significant contribution from dry mergers is considered.