Collect a paycheck while you go to interviews. Jump ship when you get a better offer.
A friend of mine put himself on the market every two years whether he wanted a job or not. In retrospect, I feel that was the most insightful and logical decision to be made at the time. As he pointed out, "nothing might come from it, but if they offer me my dream job there's no way I wouldn't take it".
IIRC, he had some rule about not taking a new job unless it paid more than 15% higher than his current job, or some such.
A further consideration is what you do *while* in your job. Always be looking for your next job, but that can also be within the same company. Talk to people at other departments, get a feel for what they do, listen in on a few staff meetings, and maybe volunteer to do some task or other that they are struggling with.
In other words, be curious and don't be afraid to learn new things.
When your department gets cut, lots of times you can switch to a different department. If you have shown that you understand the job requirements and get a recommendation from other people in that department, the company doesn't have to spend all the money needed to interview people.
I started in the OS division, then switched to Networking, then switched to compilers, then became a consultant. Switching allowed me to keep my job for several more years than would have been otherwise possible, and having a background in multiple disciplines was useful in finding jobs at other companies.
You're not actually working for the company, you're working for *yourself*. Lots of people don't understand this, the company can and will "unhire" you for any reason, or no reason. It might not even be your fault.
Always be on the lookout for your next job. You take care of yourself.
(And needless to say you don't go around trumpeting that opinion at the company. You can still have loyalty and still expect to continue working, but just know that your ultimate allegiance is to yourself.)