Molecular oxygen formation from irradiation of ice grains in the protosolar nebula