Implement Warp Compiled Async Functions
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox86 | --- | fixed |
People
(Reporter: mgaudet, Assigned: mgaudet)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(13 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Currently Warp cannot compile generators nor async functions. This limits our potential performance.
This also leads to potential performance cliffs as developers adopt APIs that use promises, where writing async functions substantially eases the burden of working with them.
Assignee | ||
Comment 1•4 years ago
|
||
Assignee | ||
Comment 2•4 years ago
|
||
The TrySkipAwait opcode optimization is challenging to JIT compile because of
the complicate semantics of its return values. In order to make this
dramatically more simple to JIT implement, this patch splits TrySkipAwait into
two ops: CanSkipAwait
and MaybeExtractAwaitValue
.
The first op, CanSkipAwait
does the preparation to ensure that it would be
legal to skip the await enqueue. The second op, MaybeExtractAwaitValue
uses
the result of the CanSkipAwait
to decide if it should leave the value alone
or instead replace it with the awaited value. This pair of ops is a bit easier
for Warp to model in MIR than a single op.
Depends on D98755
Assignee | ||
Comment 3•4 years ago
|
||
Depends on D98756
Assignee | ||
Comment 4•4 years ago
|
||
When Warp compiled generators are enabled, we can no longer rely on
BaselineFrameReg being preserved, so we should instead recompute it from the
frame descriptor.
Depends on D98757
Assignee | ||
Comment 5•4 years ago
|
||
This doesn't matter at the moment, but once we can Warp compile generators we
will need the JIT stack to be JitStack aligned. As well, we will need
BaselineBailouts to understand that one of the possible stack frames could be
the BaselineFrame created by a generator body OSR'ing into Warp.
We need to zero out the area for alignment, as during GC it can be inspected
assuming it contains valid values.
Depends on D98758
Assignee | ||
Comment 6•4 years ago
|
||
Depends on D98759
Assignee | ||
Comment 7•4 years ago
|
||
This patch allows us to warp compile a function that has been marked as async
unnecessarily; for example async foo() { return 10; }
.
Handling this case doesn't require too much special code as we are able to
identify these via bytecode inspection, and the semantics of the newly required
bytecode aren't too complex. We don't need to handle yield or resume.
Depends on D98760
Assignee | ||
Comment 8•4 years ago
|
||
MPseudoReturn generates the same sequence as MReturn, but from the perspective
of MIR is simply a regular opcode which consumes a value. This will be used to
handle yields in async functions and generators.
Depends on D98761
Assignee | ||
Comment 9•4 years ago
|
||
Depends on D98762
Assignee | ||
Comment 10•4 years ago
|
||
Depends on D98763
Updated•4 years ago
|
Assignee | ||
Comment 11•4 years ago
|
||
Depends on D98760
Assignee | ||
Comment 12•4 years ago
|
||
Depends on D98764
Assignee | ||
Comment 13•4 years ago
|
||
Depends on D99691
Assignee | ||
Comment 14•4 years ago
|
||
(Marking leave open, as we're landing in a disabled state)
Updated•4 years ago
|
Comment 15•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 16•4 years ago
|
||
(Will add a new bug to enable, allowing this one to get closed)
Comment 17•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8cc2056a0216
https://hg.mozilla.org/mozilla-central/rev/db358fced289
https://hg.mozilla.org/mozilla-central/rev/e4c40b24f5dd
https://hg.mozilla.org/mozilla-central/rev/15983b7d4b34
https://hg.mozilla.org/mozilla-central/rev/038847f6366c
https://hg.mozilla.org/mozilla-central/rev/81978ede452f
https://hg.mozilla.org/mozilla-central/rev/94851e694f9c
https://hg.mozilla.org/mozilla-central/rev/6dda9ceb4625
https://hg.mozilla.org/mozilla-central/rev/04b71d7076e3
https://hg.mozilla.org/mozilla-central/rev/9b74983c1c00
https://hg.mozilla.org/mozilla-central/rev/553d30e157b4
https://hg.mozilla.org/mozilla-central/rev/e3e9dda1ede2
https://hg.mozilla.org/mozilla-central/rev/dd3293cb1a1b
Updated•2 years ago
|
Description
•