Add support for ES6 generators that works in both V8 and SM

This patch adds support for ES6 generators that works both in V8 (with flag) and latest SpiderMonkey, while retaining support for legacy generators.