Taiwan Semiconductor Manufacturing Co. booked a 58% surge in profit, a sign that the Middle East war in its first few weeks did not depress booming AI investment.