Bug 150290 - [ES6] Implement Generators
Summary: [ES6] Implement Generators
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 151547 150769 150792 151545 151546 151552
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-17 16:08 PDT by Yusuke Suzuki
Modified: 2015-11-22 11:30 PST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2015-10-17 16:08:13 PDT
Implement ES6 generators.
Consider the following case,

let generator = gen();
// first example.
for (let value of generator) {
    ...
}

function* gen() {
    // (1).
    ...
    // (2).
    yield;
}

in for-of, we call generator.next(). In the first case, it starts from (1). And the second call starts from (2).
So I think generating the following code for ES6 generator is the easiest way to handle it in DFG / FTL. How about this?

// Entry point is only one. Every time we call generator.next(), the function will start from here.
resume_to_yield (generator_object)  // This resumes frame and jump.
label_1:
// (1).
special_return;
label_2:
// (2).
special_return;
Comment 1 Yusuke Suzuki 2015-10-31 10:34:10 PDT
Working on syntax part at first...