Context : Aims : The goal of this work is to measure the evolution of the Galaxy Stellar Mass Function and of the resulting Stellar Mass Density up to redshift \simeq 4 , in order to study the assembly of massive galaxies in the high redshift Universe . Methods : We have used the GOODS-MUSIC catalog , containing \sim 3000 Ks-selected galaxies with multi-wavelength coverage extending from the U band to the Spitzer 8 \mu m band , of which 27 % have spectroscopic redshifts and the remaining fraction have accurate photometric redshifts . On this sample we have applied a standard fitting procedure to measure stellar masses . We compute the Galaxy Stellar Mass Function and the resulting Stellar Mass Density up to redshift \simeq 4 , taking into proper account the biases and incompleteness effects . Results : Within the well known trend of global decline of the Stellar Mass Density with redshift , we show that the decline of the more massive galaxies may be described by an exponential timescale of \simeq 6 Gyrs up to z \simeq 1.5 , and proceeds much faster thereafter , with an exponential timescale of \simeq 0.6 Gyrs . We also show that there is some evidence for a differential evolution of the Galaxy Stellar Mass Function , with low mass galaxies evolving faster than more massive ones up to z \simeq 1 - 1.5 and that the Galaxy Stellar Mass Function remains remarkably flat ( i.e . with a slope close to the local one ) up to z \simeq 1 - 1.3 . Conclusions : The observed behaviour of the Galaxy Stellar Mass Function is consistent with a scenario where about 50 % of present–day massive galaxies formed at a vigorous rate in the epoch between redshift 4 and 1.5 , followed by a milder evolution until the present-day epoch .