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 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 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
Updated•4 years ago
|
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
|
||
Pushed by mgaudet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8cc2056a0216 Eagerly allocate storage for generator saved slots r=jorendorff https://hg.mozilla.org/integration/autoland/rev/db358fced289 Split `TrySkipAwait` into two opcodes r=arai https://hg.mozilla.org/integration/autoland/rev/e4c40b24f5dd Add IonAbort JitSpew when a script is Warp disabled r=jandem https://hg.mozilla.org/integration/autoland/rev/15983b7d4b34 Prepare for Warp compiled generator functions by recomputing BaselineFrameReg in Resume implementation r=iain https://hg.mozilla.org/integration/autoland/rev/038847f6366c Align stack pointer, and clear alignment area, before calling GeneratorResume r=iain https://hg.mozilla.org/integration/autoland/rev/81978ede452f Implement GetRVal in Warp r=iain https://hg.mozilla.org/integration/autoland/rev/94851e694f9c Add JitOption for warp compiling generators and async functions r=iain https://hg.mozilla.org/integration/autoland/rev/6dda9ceb4625 Warp compile 'Accidentally Async' functions r=iain https://hg.mozilla.org/integration/autoland/rev/04b71d7076e3 Add MGeneratorReturn in anticipation of its use in Warp async functions r=jandem https://hg.mozilla.org/integration/autoland/rev/9b74983c1c00 Support Await in Warp compiled Generator Bodies r=iain https://hg.mozilla.org/integration/autoland/rev/553d30e157b4 Implement CanSkipAwait and MaybeExtractAwaitValue in Warp r=iain https://hg.mozilla.org/integration/autoland/rev/e3e9dda1ede2 Add OSR Mismatch JitSpew r=iain https://hg.mozilla.org/integration/autoland/rev/dd3293cb1a1b Disable Warp compiled Async Functions by default r=iain
Assignee | ||
Updated•4 years ago
|
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•1 year ago
|
Description
•