The Nasdaq and S&P 500 indices have both attained new all-time highs, surpassing their previous record peaks.