0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

refactor(core): run pending dynamic imports before ops (#18592)

This is in preparation to limit number of times we have to cross Rust ->
V8 boundary on each tick of event loop.
This commit is contained in:
Bartek Iwańczuk 2023-04-05 00:07:26 +02:00 committed by GitHub
parent c4628aa809
commit 686fe47749
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1205,8 +1205,6 @@ impl JsRuntime {
self.pump_v8_message_loop()?; self.pump_v8_message_loop()?;
// Ops
self.resolve_async_ops(cx)?;
// Dynamic module loading - ie. modules loaded using "import()" // Dynamic module loading - ie. modules loaded using "import()"
{ {
// Run in a loop so that dynamic imports that only depend on another // Run in a loop so that dynamic imports that only depend on another
@ -1232,6 +1230,9 @@ impl JsRuntime {
} }
} }
} }
// Ops
self.resolve_async_ops(cx)?;
// Run all next tick callbacks and macrotasks callbacks and only then // Run all next tick callbacks and macrotasks callbacks and only then
// check for any promise exceptions (`unhandledrejection` handlers are // check for any promise exceptions (`unhandledrejection` handlers are
// run in macrotasks callbacks so we need to let them run first). // run in macrotasks callbacks so we need to let them run first).