Nvidia Corp. is on the verge of becoming the first company with a $6 trillion market capitalization as investors rotate back into the artificial-intelligence chipmaker.