US tech giant’s valuation set to pass $4tn as investors embrace plans spend $120bn on artificial intelligence next year