Update async generator implementation to reflect the latest spec steps
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox97 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(43 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Async generator's spec steps are heavily rewritten, based on abstract closures and different set of abstract operations.
Updating our implementation based on them should make it easier to follow the future spec change
| Assignee | ||
Comment 1•4 years ago
|
||
Given the current implementation and the spec is very different, I'll perform the following:
- Remove the spec steps comments
- Apply a bunch of minor refactoring to the implementation, to make the implementation close to the spec, step by step
- Once the implementation matches the spec, add the spec steps comments
| Assignee | ||
Comment 2•4 years ago
|
||
| Assignee | ||
Comment 3•4 years ago
|
||
Debugger allows calling async generator methods before the state is
changed from executing to suspendedStart.
That was accidentally supported in the previous spec, but the latest spec
optimizes out the behavior for such situation, and it assumes the queue is
empty if suspendedStart, and there's no correct interpretation for such
debugger interaction.
Disable the testcase that hits the issue, until it's handled in Part 43.
| Assignee | ||
Comment 4•4 years ago
|
||
As a preparation to move async generator functions into AsyncIteration.cpp,
expose PromiseHandler in header file.
Depends on D133228
| Assignee | ||
Comment 5•4 years ago
|
||
Also make functions called by AsyncGeneratorPromiseReactionJob file static.
Depends on D133229
| Assignee | ||
Comment 6•4 years ago
|
||
To keep PromiseReactionRecord Promise.cpp-internal, while exposing InternalAwait
to AsyncIteration.cpp, add dedicate entry point and expose it in the header.
Depends on D133230
| Assignee | ||
Comment 7•4 years ago
|
||
Depends on D133231
| Assignee | ||
Comment 8•4 years ago
|
||
Depends on D133232
| Assignee | ||
Comment 9•4 years ago
|
||
The remaining patches until Part 42 refactor the current implementation
step by step, ignoring the spec step comments, while keeping the behavior
same.
Depends on D133233
| Assignee | ||
Comment 10•4 years ago
|
||
Those parts correspond to AsyncGeneratorCompleteStep in the latest spec.
Depends on D133234
| Assignee | ||
Comment 11•4 years ago
|
||
Depends on D133236
| Assignee | ||
Comment 12•4 years ago
|
||
Depends on D133238
| Assignee | ||
Comment 13•4 years ago
|
||
The part corresponds to AsyncGeneratorDrainQueue in the latest spec.
Depends on D133239
| Assignee | ||
Comment 14•4 years ago
|
||
They correspond to AsyncGeneratorValidate in the latest spec.
Depends on D133240
| Assignee | ||
Comment 15•4 years ago
|
||
It corresponds to AsyncGeneratorUnwrapYieldResumption in the latest spec.
Depends on D133241
| Assignee | ||
Comment 16•4 years ago
|
||
Optimized out some branches based on isSuspendedYield condition.
Depends on D133242
| Assignee | ||
Comment 17•4 years ago
|
||
There's different AsyncGeneratorEnqueue in the latest spec.
Depends on D133243
| Assignee | ||
Comment 18•4 years ago
|
||
It corresponds to AsyncGeneratorEnqueue in the latest spec.
Depends on D133244
| Assignee | ||
Comment 19•4 years ago
|
||
Depends on D133245
| Assignee | ||
Comment 20•4 years ago
|
||
It corresponds to AsyncGeneratorAwaitReturn in the latest spec.
Depends on D133246
| Assignee | ||
Comment 21•4 years ago
|
||
AsyncGeneratorMethodCommon is going to be inlined into the callers.
Factor out the common code.
Depends on D133247
| Assignee | ||
Comment 22•4 years ago
|
||
The latest spec assumes the queue is empty if the generator is suspended,
and that is what the previous spec also guaranteed, but our debugger allows
breaking the assumption, by calling async generator methods and enqueueing
requests, before it becomes suspendedStart state.
The debugger case is handled in Part 43.
Depends on D133248
| Assignee | ||
Comment 23•4 years ago
|
||
Depends on D133249
| Assignee | ||
Comment 24•4 years ago
|
||
Depends on D133250
| Assignee | ||
Comment 25•4 years ago
|
||
Optimization for each method is applied in later patches.
Depends on D133252
| Assignee | ||
Comment 26•4 years ago
|
||
The queue must be empty also after the async generator becomes completed state
(except for the case the debugger breaks the assumption).
Optimize out the queue handling (enqueue + dequeue), and directly pass the
completion to ResolvePromiseInternal.
Again, the debugger case is handled in Part 43.
Depends on D133253
| Assignee | ||
Comment 27•4 years ago
|
||
setExecuting is moved into AsyncGeneratorResume in the next part,
so move setExecuting just before AsyncGeneratorResume call.
Depends on D133254
| Assignee | ||
Comment 28•4 years ago
|
||
Depends on D133255
| Assignee | ||
Comment 29•4 years ago
|
||
Depends on D133256
| Assignee | ||
Comment 30•4 years ago
|
||
Depends on D133257
| Assignee | ||
Comment 31•4 years ago
|
||
Depends on D133258
| Assignee | ||
Comment 32•4 years ago
|
||
Depends on D133259
| Assignee | ||
Comment 33•4 years ago
|
||
Depends on D133260
| Assignee | ||
Comment 34•4 years ago
|
||
Depends on D133261
| Assignee | ||
Comment 35•4 years ago
|
||
isCompleted() is asserted at the beginning of the function, and the
state doesn't change.
Depends on D133262
| Assignee | ||
Comment 36•4 years ago
|
||
Depends on D133263
| Assignee | ||
Comment 37•4 years ago
|
||
Depends on D133264
| Assignee | ||
Comment 38•4 years ago
|
||
Depends on D133265
| Assignee | ||
Comment 39•4 years ago
|
||
Depends on D133266
| Assignee | ||
Comment 40•4 years ago
|
||
Depends on D133267
| Assignee | ||
Comment 41•4 years ago
|
||
Depends on D133268
| Assignee | ||
Comment 42•4 years ago
|
||
Depends on D133269
| Assignee | ||
Comment 43•4 years ago
|
||
Depends on D133271
| Assignee | ||
Comment 44•4 years ago
|
||
Also tweaked some variable names, and added assertions.
Depends on D133272
| Assignee | ||
Comment 45•4 years ago
|
||
As noted in the Part 1, debugger can break the assumption used in the spec,
by calling async generator methods before it becomes suspendedStart,
and there's no correct interpretation for such method call and method calls
after that, because the request queue contains unexpected entry.
Make the async generator methods throw if it's already in such invalid state.
Depends on D133273
Updated•4 years ago
|
Comment 46•4 years ago
|
||
Comment 47•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/85035e07a46f
https://hg.mozilla.org/mozilla-central/rev/32be9ee6760e
https://hg.mozilla.org/mozilla-central/rev/3f9f786e9efb
https://hg.mozilla.org/mozilla-central/rev/e1d371cbb78f
https://hg.mozilla.org/mozilla-central/rev/2477fb97fafc
https://hg.mozilla.org/mozilla-central/rev/46951c1eed5f
https://hg.mozilla.org/mozilla-central/rev/f9e742e82fd0
https://hg.mozilla.org/mozilla-central/rev/8a5f8ca4af15
https://hg.mozilla.org/mozilla-central/rev/1fa1faf9b198
https://hg.mozilla.org/mozilla-central/rev/6df8942df583
https://hg.mozilla.org/mozilla-central/rev/be4a39bb8a67
https://hg.mozilla.org/mozilla-central/rev/da51ef36d048
https://hg.mozilla.org/mozilla-central/rev/a2b5535e166c
https://hg.mozilla.org/mozilla-central/rev/b35debc6633d
https://hg.mozilla.org/mozilla-central/rev/5633e13203e3
https://hg.mozilla.org/mozilla-central/rev/71e7ca9ea4cf
https://hg.mozilla.org/mozilla-central/rev/cb48a1f029d6
https://hg.mozilla.org/mozilla-central/rev/78344977f6b9
https://hg.mozilla.org/mozilla-central/rev/22bc4f406d24
https://hg.mozilla.org/mozilla-central/rev/fcc4d2ed0e71
https://hg.mozilla.org/mozilla-central/rev/a0d1f20fea59
https://hg.mozilla.org/mozilla-central/rev/2e0a1c43ee35
https://hg.mozilla.org/mozilla-central/rev/db9b6b3ed734
https://hg.mozilla.org/mozilla-central/rev/192fd6189f1f
https://hg.mozilla.org/mozilla-central/rev/3adfd839f628
https://hg.mozilla.org/mozilla-central/rev/2fa82bfad4c4
https://hg.mozilla.org/mozilla-central/rev/c1cd4b9204e4
https://hg.mozilla.org/mozilla-central/rev/096247ef83af
https://hg.mozilla.org/mozilla-central/rev/7f4f59a149c9
https://hg.mozilla.org/mozilla-central/rev/f3da2da99748
https://hg.mozilla.org/mozilla-central/rev/76381320de77
https://hg.mozilla.org/mozilla-central/rev/c2d43eaa4a0e
https://hg.mozilla.org/mozilla-central/rev/d7e10f507c65
https://hg.mozilla.org/mozilla-central/rev/a4b60264d467
https://hg.mozilla.org/mozilla-central/rev/3a50a0a5fd83
https://hg.mozilla.org/mozilla-central/rev/82d2e0736efa
https://hg.mozilla.org/mozilla-central/rev/e60cfb44c44d
https://hg.mozilla.org/mozilla-central/rev/471e291fadc9
https://hg.mozilla.org/mozilla-central/rev/554ccce91dd5
https://hg.mozilla.org/mozilla-central/rev/0e13d5548fce
https://hg.mozilla.org/mozilla-central/rev/a809dff7324e
https://hg.mozilla.org/mozilla-central/rev/d0570f34b3c6
https://hg.mozilla.org/mozilla-central/rev/4243f988e94a
| Assignee | ||
Updated•2 years ago
|
Description
•