Every year you are at a job you need to reassess and decide how staying is helping you and your career. Typically, if i haven't been promoted, gotten access to significantly more experience or a big raise, its time to go.
So if you got passed over, i would try to find out why first and foremost(unless you already know why). And then if you need to take your talents elsewhere then do what you got to do. I was passed over once for a promotion. However the dude had been there like 4 years longer than me and honestly was a beast. I knew i wouldnt ever get promoted with him there. So i dipped. Make 3 times as much now and in hindsight i wish i had left sooner.