Search for resonances and quantum black holes using dijet mass spectra in proton-proton collisions at s =8TeV