First-principles study on the electronic and optical properties of cubic ABX 3 halide perovskites