Measurement of double-differential cross sections for top quark pair production in pp collisions at sqrt(s)=8TeV and impact on parton distribution functions