Simplify generated generator code.

- Instead of storing things in the closure we store it on a context object.
- Remove the $G object
- Use a sentinel for termination
- Extract async function code into a runtime function to reduce code duplication.