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