Measurement of the CP-violating phase \phi s in Bbar_s^0 -> J/\psi\pi+\pi- decays