diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-03-31 18:12:14 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 14:42:14 +0200 |
commit | b9a379093264da47368ea9665f685016fe35bfca (patch) | |
tree | af6fd2e56846b8d0a6d1d8d88c0bfcffbb34c4d6 /core | |
parent | 0f41aff1d9f6c131ff69d6dd1dc053afb008a19d (diff) |
perf: `const` op declaration (#18288)
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/bindings.rs | 4 | ||||
-rw-r--r-- | core/extensions.rs | 2 | ||||
-rw-r--r-- | core/ops.rs | 6 | ||||
-rw-r--r-- | core/runtime.rs | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index 52db40f0d..00d0cf2e6 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -44,7 +44,7 @@ pub(crate) fn external_references(ops: &[OpCtx]) -> v8::ExternalReferences { }); if let Some(fast_fn) = &ctx.decl.fast_fn { references.push(v8::ExternalReference { - pointer: fast_fn.function() as _, + pointer: fast_fn.function as _, }); references.push(v8::ExternalReference { pointer: ctx.fast_fn_c_info.unwrap().as_ptr() as _, @@ -218,7 +218,7 @@ fn add_op_to_deno_core_ops( let templ = if let Some(fast_function) = &op_ctx.decl.fast_fn { builder.build_fast( scope, - &**fast_function, + fast_function, Some(op_ctx.fast_fn_c_info.unwrap().as_ptr()), None, None, diff --git a/core/extensions.rs b/core/extensions.rs index 9b4fb203a..ca618c9b7 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -72,8 +72,8 @@ pub struct OpDecl { pub is_async: bool, pub is_unstable: bool, pub is_v8: bool, - pub fast_fn: Option<Box<dyn FastFunction>>, pub force_registration: bool, + pub fast_fn: Option<FastFunction>, } impl OpDecl { diff --git a/core/ops.rs b/core/ops.rs index 3a276082f..cceeb5654 100644 --- a/core/ops.rs +++ b/core/ops.rs @@ -175,13 +175,13 @@ impl OpCtx { let mut fast_fn_c_info = None; if let Some(fast_fn) = &decl.fast_fn { - let args = CTypeInfo::new_from_slice(fast_fn.args()); - let ret = CTypeInfo::new(fast_fn.return_type()); + let args = CTypeInfo::new_from_slice(fast_fn.args); + let ret = CTypeInfo::new(fast_fn.return_type); // SAFETY: all arguments are coming from the trait and they have // static lifetime let c_fn = unsafe { - CFunctionInfo::new(args.as_ptr(), fast_fn.args().len(), ret.as_ptr()) + CFunctionInfo::new(args.as_ptr(), fast_fn.args.len(), ret.as_ptr()) }; fast_fn_c_info = Some(c_fn); } diff --git a/core/runtime.rs b/core/runtime.rs index 787bac972..bfb4c45cc 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -793,8 +793,8 @@ impl JsRuntime { true => op, false => OpDecl { v8_fn_ptr: match op.is_async { - true => op_void_async::v8_fn_ptr(), - false => op_void_sync::v8_fn_ptr(), + true => op_void_async::v8_fn_ptr as _, + false => op_void_sync::v8_fn_ptr as _, }, ..op }, |