First-principles calculations on dislocations in MgO