summaryrefslogtreecommitdiff
path: root/core/ops_builtin_v8.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-04-14 02:41:32 +0200
committerGitHub <noreply@github.com>2023-04-14 02:41:32 +0200
commitcb2ca234bb39d8e02b08d2866860e8d3a00b5887 (patch)
tree660044dbb6f6ce62c3f542ade150788870e483a5 /core/ops_builtin_v8.rs
parentd192d84a0e0b9954882211b827f17512ad37be7d (diff)
refactor(core): limit number of boundary crossings between Rust and V8 (#18652)
This commit refactors "deno_core" to do fewer boundary crossings from Rust to V8. In other words we are now calling V8 from Rust fewer times. This is done by merging 3 distinct callbacks into a single one. Instead of having "op resolve" callback, "next tick" callback and "macrotask queue" callback, we now have only "Deno.core.eventLoopTick" callback, which is responsible for doing the same actions previous 3 callbacks. On each of the event loop we were doing at least 2 boundary crosses (timers macrotask queue callback and unhandled promise rejection callback) and up to 4 crosses if there were op response and next tick callbacks coming from Node.js compatibility layer. Now this is all done in a single callback. Closes https://github.com/denoland/deno/issues/18620
Diffstat (limited to 'core/ops_builtin_v8.rs')
-rw-r--r--core/ops_builtin_v8.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs
index 3d7b4a996..0d0da5843 100644
--- a/core/ops_builtin_v8.rs
+++ b/core/ops_builtin_v8.rs
@@ -50,28 +50,6 @@ fn op_unref_op(scope: &mut v8::HandleScope, promise_id: i32) {
}
#[op(v8)]
-fn op_set_macrotask_callback(
- scope: &mut v8::HandleScope,
- cb: serde_v8::Value,
-) -> Result<(), Error> {
- let cb = to_v8_fn(scope, cb)?;
- let state_rc = JsRuntime::state(scope);
- state_rc.borrow_mut().js_macrotask_cbs.push(cb);
- Ok(())
-}
-
-#[op(v8)]
-fn op_set_next_tick_callback(
- scope: &mut v8::HandleScope,
- cb: serde_v8::Value,
-) -> Result<(), Error> {
- let cb = to_v8_fn(scope, cb)?;
- let state_rc = JsRuntime::state(scope);
- state_rc.borrow_mut().js_nexttick_cbs.push(cb);
- Ok(())
-}
-
-#[op(v8)]
fn op_set_promise_reject_callback<'a>(
scope: &mut v8::HandleScope<'a>,
cb: serde_v8::Value,