Samsung posts record Q2 profit