TORONTO — Stock markets in Canada and the U.S. reached new highs, powered by gains in energy and AI, respectively.