The evolution of dosage-compensation mechanisms