Bug 156576

Summary: [ES7] yield star should not return if the inner iterator.throw returns { done: true }
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, darin, fpizlo, ggaren, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Yusuke Suzuki 2016-04-14 05:50:56 PDT
[ES6] yield star should not return if the inner iterator.throw returns { done: true }
Comment 1 Yusuke Suzuki 2016-04-14 05:54:58 PDT
Created attachment 276391 [details]
Patch
Comment 2 Yusuke Suzuki 2016-04-14 05:55:44 PDT
This change is also listed here. http://kangax.github.io/compat-table/esnext/
Comment 3 Yusuke Suzuki 2016-04-14 06:37:06 PDT
Created attachment 276395 [details]
Patch
Comment 4 Yusuke Suzuki 2016-04-14 06:40:15 PDT
Created attachment 276396 [details]
Patch
Comment 5 Yusuke Suzuki 2016-04-14 06:42:54 PDT
Comment on attachment 276396 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=276396&action=review

> Source/JavaScriptCore/builtins/GeneratorPrototype.js:83
> +    return @generatorResume(this, exception, @GeneratorResumeModeThrow);

Use bytecode intrinsic constants. We can keep in sync with JSGenerator::constants.

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4442
> +                    emitThrowTypeError(ASCIILiteral("Iterator result interface is not an object."));

When innerIterator.throw() does not throw, we fall into the usual iteration path (branchOnResult).

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4491
> +            emitLabel(branchOnResult.get());

The iterator loop's condition phase.
Comment 6 Yusuke Suzuki 2016-04-17 15:39:34 PDT
Note that this is not staging change. It is already introduced into the spec draft (ECMAScript 2016 spec).
Comment 7 Darin Adler 2016-04-17 16:18:14 PDT
Comment on attachment 276396 [details]
Patch

Looks OK to me, but it’s slightly outside my expertise which is why I am not marking it review+
Comment 8 Saam Barati 2016-04-17 20:24:05 PDT
Comment on attachment 276396 [details]
Patch

r=me
Comment 9 Yusuke Suzuki 2016-04-17 23:51:57 PDT
Comment on attachment 276396 [details]
Patch

Thanks!
Comment 10 WebKit Commit Bot 2016-04-18 00:35:35 PDT
Comment on attachment 276396 [details]
Patch

Clearing flags on attachment: 276396

Committed r199652: <http://trac.webkit.org/changeset/199652>
Comment 11 WebKit Commit Bot 2016-04-18 00:35:41 PDT
All reviewed patches have been landed.  Closing bug.