why a switch statement for coroutine?

The code generation for coroutine resume is pretty much the same as a switch statement; for a few suspend points it generates if(state==x) goto label else…, and for many suspend points it uses a jump table.

https://godbolt.org/g/U3d1sz

I would have guessed that it would save the resume state as a call address directly, rather than save the state as an index into a jump table. What advantage does the switch approach have? Why not just save a new resume address in the frame prefix after each resume?