Allow synchronous proxying of async JS functions #26000
Open
+258
−224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This new mode allows the proxied work itself to be asynchronous (i.e.
return a promise). The new behaviour is triggered by marking a
functions as both
__proxy: 'sync'and also__async: true.We can use this new mode to replace the bespoke proxying code that
exists for
dlsyncas well as thepollsystem call. For the pollsystem call this bespoke code was added in #25523 and #25990, but can
now be completely removed.
In addition to this, because the
pollsyscall is now marked as__asyncit automatically works under JSPI too.One downside of this new mode is that the proxied work requires the main
thread event loop to run. Unlike the synchronous proxied work that can
complete even when we are deeply nested.
Fixes: #25970