Search for narrow resonances using the dijet mass spectrum in pp collisions at sqrt[s]=8  TeV