[webkit-changes] [WebKit/WebKit] 95d8b8: [JSC] `return` in async generators doesn't correct...

Commit Queue noreply at github.com
Tue Dec 19 13:06:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 95d8b89d755cf9607a3fcf6e68cf1d9ac07c4abb
      https://github.com/WebKit/WebKit/commit/95d8b89d755cf9607a3fcf6e68cf1d9ac07c4abb
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-12-19 (Tue, 19 Dec 2023)

  Changed paths:
    A JSTests/stress/async-generator-return-is-awaited-in-finally.js
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

  Log Message:
  -----------
  [JSC] `return` in async generators doesn't correctly `await` its value
https://bugs.webkit.org/show_bug.cgi?id=266604
<rdar://problem/119834751>

Reviewed by Justin Michaud.

This change:

  1. Makes emitAwait() unconditional on presence of `finally`, which appears to be a bug of initial
     async generators implementation. Before this patch, if `return` was enclosed by a `try` block
     with `finally`, returned IteratorResult's value was a promise rather than awaited value.

  2. Makes emitAwait() conditional on presence of `return` node's value as per spec [1], which is
     also observable.

Aligns JSC with V8 and SpiderMonkey on both counts.

[1]: https://tc39.es/ecma262/#sec-return-statement-runtime-semantics-evaluation

* JSTests/stress/async-generator-return-is-awaited-in-finally.js: Added.
* JSTests/test262/expectations.yaml: Mark 2 tests as passing.
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ReturnNode::emitBytecode):

Canonical link: https://commits.webkit.org/272289@main




More information about the webkit-changes mailing list