From 201134e5326bfe3b961ec36d439220623b6a3a6b Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Mon, 20 Mar 2023 17:17:04 +0530
Subject: [PATCH 1/8] constant time op declaration

---
 Cargo.lock                                    |   2 -
 Cargo.toml                                    |   3 +-
 core/bindings.rs                              |   4 +-
 core/extensions.rs                            |   2 +-
 ops/fast_call.rs                              | 119 ++++--------------
 ops/lib.rs                                    |   6 +-
 ops/optimizer_tests/async_nop.out             |  37 ++----
 ops/optimizer_tests/async_result.out          |  37 ++----
 ops/optimizer_tests/callback_options.out      |  37 ++----
 ops/optimizer_tests/cow_str.out               |  37 ++----
 ops/optimizer_tests/f64_slice.out             |  37 ++----
 ops/optimizer_tests/incompatible_1.out        |   2 +-
 ops/optimizer_tests/issue16934.out            |   2 +-
 ops/optimizer_tests/issue16934_fast.out       |   2 +-
 .../op_blob_revoke_object_url.out             |   2 +-
 ops/optimizer_tests/op_ffi_ptr_value.out      |  37 ++----
 ops/optimizer_tests/op_print.out              |   2 +-
 ops/optimizer_tests/op_state.out              |  37 ++----
 ops/optimizer_tests/op_state_basic1.out       |  37 ++----
 ops/optimizer_tests/op_state_generics.out     |  40 ++----
 ops/optimizer_tests/op_state_result.out       |  37 ++----
 ops/optimizer_tests/op_state_warning.out      |  37 ++----
 .../op_state_with_transforms.out              |  40 ++----
 ops/optimizer_tests/opstate_with_arity.out    |  37 ++----
 ops/optimizer_tests/option_arg.out            |   2 +-
 ops/optimizer_tests/owned_string.out          |  37 ++----
 .../param_mut_binding_warning.out             |   2 +-
 ops/optimizer_tests/raw_ptr.out               |  45 +++----
 ops/optimizer_tests/serde_v8_value.out        |  37 ++----
 ops/optimizer_tests/strings.out               |  37 ++----
 ops/optimizer_tests/strings_result.out        |   2 +-
 ops/optimizer_tests/u64_result.out            |   2 +-
 ops/optimizer_tests/uint8array.out            |  37 ++----
 ops/optimizer_tests/unit_result.out           |  37 ++----
 ops/optimizer_tests/unit_result2.out          |  37 ++----
 ops/optimizer_tests/unit_ret.out              |  37 ++----
 ops/optimizer_tests/wasm_op.out               |  37 ++----
 37 files changed, 312 insertions(+), 670 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 264db40b8e8271..cdfb45342d5bf1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5222,8 +5222,6 @@ dependencies = [
 [[package]]
 name = "v8"
 version = "0.65.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1e4801bee61fc57f81441444d55c9c627e491aeca53b1c1e454ff8831c6f300"
 dependencies = [
  "bitflags",
  "fslock",
diff --git a/Cargo.toml b/Cargo.toml
index 0cd96c991598e8..039dc37823d2bd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -42,7 +42,8 @@ license = "MIT"
 repository = "https://github.com/denoland/deno"
 
 [workspace.dependencies]
-v8 = { version = "0.65.0", default-features = false }
+# v8 = { version = "0.65.0", default-features = false }
+v8 = { path = "../rusty_v8", default-features = false }
 deno_ast = { version = "0.24.0", features = ["transpiling"] }
 
 deno_core = { version = "0.175.0", path = "./core" }
diff --git a/core/bindings.rs b/core/bindings.rs
index 7970f9aaba550b..69999e52fe4603 100644
--- a/core/bindings.rs
+++ b/core/bindings.rs
@@ -47,7 +47,7 @@ pub(crate) fn external_references(
     if !snapshot_options.will_snapshot() {
       if let Some(fast_fn) = &ctx.decl.fast_fn {
         references.push(v8::ExternalReference {
-          pointer: fast_fn.function() as _,
+          pointer: fast_fn.function as _,
         });
       }
     }
@@ -207,7 +207,7 @@ fn add_op_to_deno_core_ops(
     // Don't initialize fast ops when snapshotting, the external references count mismatch.
     if !snapshot_options.will_snapshot() {
       // TODO(@littledivy): Support fast api overloads in ops.
-      builder.build_fast(scope, &**fast_function, None, None, None)
+      builder.build_fast(scope, fast_function, None, None, None)
     } else {
       builder.build(scope)
     }
diff --git a/core/extensions.rs b/core/extensions.rs
index 728ebd5128ae02..d6eb7fe2946e45 100644
--- a/core/extensions.rs
+++ b/core/extensions.rs
@@ -52,7 +52,7 @@ pub struct OpDecl {
   pub is_async: bool,
   pub is_unstable: bool,
   pub is_v8: bool,
-  pub fast_fn: Option<Box<dyn FastFunction>>,
+  pub fast_fn: Option<FastFunction>,
 }
 
 impl OpDecl {
diff --git a/ops/fast_call.rs b/ops/fast_call.rs
index a6162a01980264..74ba88deb161ba 100644
--- a/ops/fast_call.rs
+++ b/ops/fast_call.rs
@@ -62,13 +62,11 @@ pub(crate) fn generate(
     }
   };
 
-  // We've got 3 idents.
+  // We've got 2 idents.
   //
   // - op_foo, the public op declaration contains the user function.
-  // - op_foo_fast, the fast call type.
   // - op_foo_fast_fn, the fast call function.
   let ident = item_fn.sig.ident.clone();
-  let fast_ident = Ident::new(&format!("{ident}_fast"), Span::call_site());
   let fast_fn_ident =
     Ident::new(&format!("{ident}_fast_fn"), Span::call_site());
 
@@ -78,11 +76,6 @@ pub(crate) fn generate(
 
   // struct op_foo_fast <T, U> { ... }
   let struct_generics = exclude_lifetime_params(&generics.params);
-  // std::marker::PhantomData <A>
-  let phantom_generics: Quote = match struct_generics {
-    Some(ref params) => q!(Vars { params }, { params }),
-    None => q!({ <()> }),
-  };
   // op_foo_fast_fn :: <T>
   let caller_generics: Quote = match struct_generics {
     Some(ref params) => q!(Vars { params }, { ::params }),
@@ -90,28 +83,19 @@ pub(crate) fn generate(
   };
 
   // This goes in the FastFunction impl block.
-  let mut segments = Punctuated::new();
-  {
-    let mut arguments = PathArguments::None;
-    if let Some(ref struct_generics) = struct_generics {
-      arguments = PathArguments::AngleBracketed(parse_quote! {
-        #struct_generics
-      });
-    }
-    segments.push_value(PathSegment {
-      ident: fast_ident.clone(),
-      arguments,
-    });
-  }
-
-  // struct T <A> {
-  //   _phantom: ::std::marker::PhantomData<A>,
+  // let mut segments = Punctuated::new();
+  // {
+  //   let mut arguments = PathArguments::None;
+  //   if let Some(ref struct_generics) = struct_generics {
+  //     arguments = PathArguments::AngleBracketed(parse_quote! {
+  //       #struct_generics
+  //     });
+  //   }
+  //   segments.push_value(PathSegment {
+  //     ident: fast_ident.clone(),
+  //     arguments,
+  //   });
   // }
-  let fast_ty: Quote = q!(Vars { Type: &fast_ident, generics: &struct_generics, phantom_generics }, {
-    struct Type generics {
-      _phantom: ::std::marker::PhantomData phantom_generics,
-    }
-  });
 
   // Original inputs.
   let mut inputs = item_fn.sig.inputs.clone();
@@ -344,73 +328,22 @@ pub(crate) fn generate(
   let mut generics: Generics = parse_quote! { #impl_generics };
   generics.where_clause = where_clause.cloned();
 
-  // impl <A> fast_api::FastFunction for T <A> where A: B {
-  //   fn function(&self) -> *const ::std::ffi::c_void  {
-  //     f as *const ::std::ffi::c_void
-  //   }
-  //   fn args(&self) -> &'static [fast_api::Type] {
-  //     &[ CType::T, CType::U ]
-  //   }
-  //   fn return_type(&self) -> fast_api::CType {
-  //     CType::T
-  //   }
-  // }
-  let item: ItemImpl = ItemImpl {
-    attrs: vec![],
-    defaultness: None,
-    unsafety: None,
-    impl_token: Default::default(),
-    generics,
-    trait_: Some((
-      None,
-      parse_quote!(#core::v8::fast_api::FastFunction),
-      Default::default(),
-    )),
-    self_ty: Box::new(Type::Path(TypePath {
-      qself: None,
-      path: Path {
-        leading_colon: None,
-        segments,
-      },
-    })),
-    brace_token: Default::default(),
-    items: vec![
-      parse_quote! {
-        #[inline(always)]
-        fn function(&self) -> *const ::std::ffi::c_void {
-          #fast_fn_ident #caller_generics as *const ::std::ffi::c_void
-        }
-      },
-      parse_quote! {
-        #[inline(always)]
-        fn args(&self) -> &'static [#core::v8::fast_api::Type] {
-          use #core::v8::fast_api::Type::*;
-          use #core::v8::fast_api::CType;
-          &[ #input_variants ]
-        }
-      },
-      parse_quote! {
-        #[inline(always)]
-        fn return_type(&self) -> #core::v8::fast_api::CType {
-          #core::v8::fast_api::CType::#output_variant
-        }
-      },
-    ],
-  };
-
-  let mut tts = q!({});
-  tts.push_tokens(&fast_ty);
-  tts.push_tokens(&item);
-  tts.push_tokens(&fast_fn);
-
-  let impl_and_fn = tts.dump();
+  // fast_api::FastFunction::new(&[ CType::T, CType::U ], CType::T, f::<P> as *const ::std::ffi::c_void)
   let decl = q!(
-    Vars { fast_ident, caller_generics },
-    {
-      Some(Box::new(fast_ident caller_generics { _phantom: ::std::marker::PhantomData }))
-    }
+    Vars { core: core, fast_fn_ident: fast_fn_ident, generics: caller_generics, inputs: input_variants, output: output_variant },
+    {{
+      use core::v8::fast_api::Type::*;
+      use core::v8::fast_api::CType;
+      Some(core::v8::fast_api::FastFunction::new(
+        &[ inputs ],
+        CType :: output,
+        fast_fn_ident generics as *const ::std::ffi::c_void
+      ))
+    }}
   ).dump();
 
+  let impl_and_fn = fast_fn.dump();
+
   FastImplItems {
     impl_and_fn,
     decl,
diff --git a/ops/lib.rs b/ops/lib.rs
index f7c69ec8a4b29e..92d13be3b45e1c 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -183,16 +183,16 @@ impl Op {
 
       #[doc(hidden)]
       impl #name {
-        pub fn name() -> &'static str {
+        pub const fn name() -> &'static str {
           stringify!(#name)
         }
 
-        pub fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
+        pub const fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
           use #core::v8::MapFnTo;
           Self::v8_func::<#type_params>.map_fn_to()
         }
 
-        pub fn decl #generics () -> #core::OpDecl #where_clause {
+        pub const fn decl #generics () -> #core::OpDecl #where_clause {
           #core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index d1e9534063fb44..af08cb105fc619 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -13,16 +13,22 @@ impl op_void_async {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_void_async_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Int32, CallbackOptions],
+                        CType::Void,
+                        op_void_async_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: true,
             is_unstable: false,
             is_v8: false,
@@ -81,25 +87,6 @@ impl op_void_async {
         );
     }
 }
-struct op_void_async_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_void_async_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_void_async_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_void_async_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index 1d45b11f176ec0..ea8486085d0337 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -13,16 +13,22 @@ impl op_async_result {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_async_result_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Int32, Uint32, CallbackOptions],
+                        CType::Void,
+                        op_async_result_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: true,
             is_unstable: false,
             is_v8: false,
@@ -91,25 +97,6 @@ impl op_async_result {
         );
     }
 }
-struct op_async_result_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_async_result_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_async_result_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_async_result_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out
index 3a18be60f7ea0b..86d038ba320558 100644
--- a/ops/optimizer_tests/callback_options.out
+++ b/ops/optimizer_tests/callback_options.out
@@ -13,16 +13,22 @@ impl op_fallback {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_fallback_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, CallbackOptions],
+                        CType::Void,
+                        op_fallback_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -50,25 +56,6 @@ impl op_fallback {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_fallback_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_fallback_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_fallback_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_fallback_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out
index e676057630ece1..8a27f4a768b6fe 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -13,16 +13,22 @@ impl op_cow_str {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_cow_str_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, SeqOneByteString],
+                        CType::Void,
+                        op_cow_str_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -58,25 +64,6 @@ impl op_cow_str {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_cow_str_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_cow_str_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_cow_str_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_cow_str_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     c: *const deno_core::v8::fast_api::FastApiOneByteString,
diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out
index dd982b1937caaf..5fd8325d64bcbb 100644
--- a/ops/optimizer_tests/f64_slice.out
+++ b/ops/optimizer_tests/f64_slice.out
@@ -13,16 +13,22 @@ impl op_f64_buf {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_f64_buf_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, TypedArray(CType::Float64), CallbackOptions],
+                        CType::Void,
+                        op_f64_buf_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -76,25 +82,6 @@ impl op_f64_buf {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_f64_buf_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_f64_buf_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_f64_buf_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Float64), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_f64_buf_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     buffer: *const deno_core::v8::fast_api::FastApiTypedArray<f64>,
diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out
index cedfb1a8f9a73d..db468515abe28d 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -13,7 +13,7 @@ impl op_sync_serialize_object_with_numbers_as_keys {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index 2b8df30d2995c4..858cd6c693cab1 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -13,7 +13,7 @@ impl send_stdin {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index cf1e416800bd60..b0d32e3f744ec1 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -13,7 +13,7 @@ impl send_stdin {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out
index 8c5a569a50599f..9d9e47c689444d 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -13,7 +13,7 @@ impl op_blob_revoke_object_url {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out
index df38b722786020..11a1fb0eef6823 100644
--- a/ops/optimizer_tests/op_ffi_ptr_value.out
+++ b/ops/optimizer_tests/op_ffi_ptr_value.out
@@ -13,16 +13,22 @@ impl op_ffi_ptr_value {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_ffi_ptr_value_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions],
+                        CType::Void,
+                        op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -90,25 +96,6 @@ impl op_ffi_ptr_value {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_ffi_ptr_value_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_value_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_ffi_ptr_value_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     ptr: *mut ::std::ffi::c_void,
diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out
index f22553c767b010..a2d87d29c3372c 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -13,7 +13,7 @@ impl op_print {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out
index 619a097482c2b6..91848316237237 100644
--- a/ops/optimizer_tests/op_state.out
+++ b/ops/optimizer_tests/op_state.out
@@ -13,16 +13,22 @@ impl op_set_exit_code {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_set_exit_code_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Int32, CallbackOptions],
+                        CType::Void,
+                        op_set_exit_code_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -58,25 +64,6 @@ impl op_set_exit_code {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_set_exit_code_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_exit_code_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_set_exit_code_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_set_exit_code_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     code: i32,
diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out
index b2926753ea4772..f270d6f57f537e 100644
--- a/ops/optimizer_tests/op_state_basic1.out
+++ b/ops/optimizer_tests/op_state_basic1.out
@@ -13,16 +13,22 @@ impl foo {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(foo_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Uint32, Uint32, CallbackOptions],
+                        CType::Uint32,
+                        foo_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -85,25 +91,6 @@ impl foo {
         };
     }
 }
-struct foo_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        foo_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn foo_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     a: u32,
diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out
index 88eeefe1481cdf..b76e25826b2618 100644
--- a/ops/optimizer_tests/op_state_generics.out
+++ b/ops/optimizer_tests/op_state_generics.out
@@ -16,7 +16,7 @@ impl op_foo {
         use deno_core::v8::MapFnTo;
         Self::v8_func::<SP>.map_fn_to()
     }
-    pub fn decl<'scope, SP>() -> deno_core::OpDecl
+    pub const fn decl<'scope, SP>() -> deno_core::OpDecl
     where
         SP: SomePermission + 'static,
     {
@@ -24,11 +24,17 @@ impl op_foo {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr::<SP>(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_foo_fast::<SP> {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, CallbackOptions],
+                        CType::Void,
+                        op_foo_fast_fn::<SP> as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -57,28 +63,6 @@ impl op_foo {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_foo_fast<SP> {
-    _phantom: ::std::marker::PhantomData<SP>,
-}
-impl<'scope, SP> deno_core::v8::fast_api::FastFunction for op_foo_fast<SP>
-where
-    SP: SomePermission + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_foo_fast_fn::<SP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_foo_fast_fn<'scope, SP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out
index fb0fdb25f499c1..1a2f2335ca33e6 100644
--- a/ops/optimizer_tests/op_state_result.out
+++ b/ops/optimizer_tests/op_state_result.out
@@ -13,16 +13,22 @@ impl foo {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(foo_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Uint32, Uint32, CallbackOptions],
+                        CType::Uint32,
+                        foo_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -98,25 +104,6 @@ impl foo {
         };
     }
 }
-struct foo_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        foo_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn foo_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     a: u32,
diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out
index 5a4b481c4f9609..8f5efbd7a52093 100644
--- a/ops/optimizer_tests/op_state_warning.out
+++ b/ops/optimizer_tests/op_state_warning.out
@@ -13,16 +13,22 @@ impl op_listen {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_listen_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, CallbackOptions],
+                        CType::Uint32,
+                        op_listen_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -89,25 +95,6 @@ impl op_listen {
         };
     }
 }
-struct op_listen_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_listen_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_listen_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn op_listen_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out
index 07e1fefb93004d..48df2c0bce8faf 100644
--- a/ops/optimizer_tests/op_state_with_transforms.out
+++ b/ops/optimizer_tests/op_state_with_transforms.out
@@ -16,7 +16,7 @@ impl op_now {
         use deno_core::v8::MapFnTo;
         Self::v8_func::<TP>.map_fn_to()
     }
-    pub fn decl<'scope, TP>() -> deno_core::OpDecl
+    pub const fn decl<'scope, TP>() -> deno_core::OpDecl
     where
         TP: TimersPermission + 'static,
     {
@@ -24,11 +24,17 @@ impl op_now {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr::<TP>(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_now_fast::<TP> {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, TypedArray(CType::Uint8), CallbackOptions],
+                        CType::Void,
+                        op_now_fast_fn::<TP> as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -104,28 +110,6 @@ impl op_now {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_now_fast<TP> {
-    _phantom: ::std::marker::PhantomData<TP>,
-}
-impl<'scope, TP> deno_core::v8::fast_api::FastFunction for op_now_fast<TP>
-where
-    TP: TimersPermission + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_now_fast_fn::<TP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_now_fast_fn<'scope, TP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     buf: *const deno_core::v8::fast_api::FastApiTypedArray<u8>,
diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out
index ab4e905d5b5e31..4e896e89abbe94 100644
--- a/ops/optimizer_tests/opstate_with_arity.out
+++ b/ops/optimizer_tests/opstate_with_arity.out
@@ -13,16 +13,22 @@ impl op_add_4 {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_add_4_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions],
+                        CType::Uint32,
+                        op_add_4_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -116,25 +122,6 @@ impl op_add_4 {
         };
     }
 }
-struct op_add_4_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_add_4_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_add_4_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn op_add_4_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     x1: u32,
diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out
index 14dca548774407..d48000242dcfc5 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -13,7 +13,7 @@ impl op_try_close {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out
index 62fb45ed7a6e7a..c8eec54b415cdb 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -13,16 +13,22 @@ impl op_string_length {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_string_length_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, SeqOneByteString],
+                        CType::Uint32,
+                        op_string_length_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -70,25 +76,6 @@ impl op_string_length {
         };
     }
 }
-struct op_string_length_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_string_length_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn op_string_length_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     string: *const deno_core::v8::fast_api::FastApiOneByteString,
diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out
index 3a93a738f75a1b..7f6a62469e7a19 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -13,7 +13,7 @@ impl op_read_sync {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out
index 12f93f99d55e90..45366d1c458c03 100644
--- a/ops/optimizer_tests/raw_ptr.out
+++ b/ops/optimizer_tests/raw_ptr.out
@@ -16,7 +16,7 @@ impl op_ffi_ptr_of {
         use deno_core::v8::MapFnTo;
         Self::v8_func::<FP>.map_fn_to()
     }
-    pub fn decl<'scope, FP>() -> deno_core::OpDecl
+    pub const fn decl<'scope, FP>() -> deno_core::OpDecl
     where
         FP: FfiPermissions + 'static,
     {
@@ -24,11 +24,22 @@ impl op_ffi_ptr_of {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr::<FP>(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_ffi_ptr_of_fast::<FP> {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[
+                            V8Value,
+                            TypedArray(CType::Uint8),
+                            TypedArray(CType::Uint32),
+                            CallbackOptions,
+                        ],
+                        CType::Void,
+                        op_ffi_ptr_of_fast_fn::<FP> as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -130,28 +141,6 @@ impl op_ffi_ptr_of {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_ffi_ptr_of_fast<FP> {
-    _phantom: ::std::marker::PhantomData<FP>,
-}
-impl<'scope, FP> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_of_fast<FP>
-where
-    FP: FfiPermissions + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_ffi_ptr_of_fast_fn::<FP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint32), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_ffi_ptr_of_fast_fn<'scope, FP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     buf: *const deno_core::v8::fast_api::FastApiTypedArray<u8>,
diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out
index 6ee56d4606c3db..9509bb20448782 100644
--- a/ops/optimizer_tests/serde_v8_value.out
+++ b/ops/optimizer_tests/serde_v8_value.out
@@ -13,16 +13,22 @@ impl op_is_proxy {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_is_proxy_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, V8Value],
+                        CType::Bool,
+                        op_is_proxy_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -70,25 +76,6 @@ impl op_is_proxy {
         };
     }
 }
-struct op_is_proxy_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_is_proxy_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_is_proxy_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, V8Value]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Bool
-    }
-}
 fn op_is_proxy_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     value: deno_core::v8::Local<v8::Value>,
diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out
index 623ff1bbb0ccdd..89ba61dcb97257 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -13,16 +13,22 @@ impl op_string_length {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_string_length_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, SeqOneByteString],
+                        CType::Uint32,
+                        op_string_length_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -71,25 +77,6 @@ impl op_string_length {
         };
     }
 }
-struct op_string_length_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_string_length_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 fn op_string_length_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     string: *const deno_core::v8::fast_api::FastApiOneByteString,
diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out
index fd847d9ca83b51..c3fb1ad40d1b89 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -13,7 +13,7 @@ impl op_string_length {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out
index efe6c9d23fb2af..9259a28cc2a707 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -13,7 +13,7 @@ impl op_bench_now {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out
index 49926c747b4701..6b2f40208807ba 100644
--- a/ops/optimizer_tests/uint8array.out
+++ b/ops/optimizer_tests/uint8array.out
@@ -13,16 +13,22 @@ impl op_import_spki_x25519 {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_import_spki_x25519_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)],
+                        CType::Bool,
+                        op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -147,25 +153,6 @@ impl op_import_spki_x25519 {
         };
     }
 }
-struct op_import_spki_x25519_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_import_spki_x25519_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Bool
-    }
-}
 fn op_import_spki_x25519_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     key_data: *const deno_core::v8::fast_api::FastApiTypedArray<u8>,
diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out
index 0a66f4fe614efd..7c197da5bfd027 100644
--- a/ops/optimizer_tests/unit_result.out
+++ b/ops/optimizer_tests/unit_result.out
@@ -13,16 +13,22 @@ impl op_unit_result {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_unit_result_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, CallbackOptions],
+                        CType::Void,
+                        op_unit_result_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -70,25 +76,6 @@ impl op_unit_result {
         };
     }
 }
-struct op_unit_result_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_result_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_unit_result_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_unit_result_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out
index 045f022fafd10a..41ccb8bc31fb9b 100644
--- a/ops/optimizer_tests/unit_result2.out
+++ b/ops/optimizer_tests/unit_result2.out
@@ -13,16 +13,22 @@ impl op_set_nodelay {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_set_nodelay_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Uint32, Bool, CallbackOptions],
+                        CType::Void,
+                        op_set_nodelay_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -103,25 +109,6 @@ impl op_set_nodelay {
         };
     }
 }
-struct op_set_nodelay_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_nodelay_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_set_nodelay_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Bool, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_set_nodelay_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     rid: ResourceId,
diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out
index a3a0d5ea922e10..210993979ba0bc 100644
--- a/ops/optimizer_tests/unit_ret.out
+++ b/ops/optimizer_tests/unit_ret.out
@@ -13,16 +13,22 @@ impl op_unit {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_unit_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value],
+                        CType::Void,
+                        op_unit_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -59,25 +65,6 @@ impl op_unit {
         };
     }
 }
-struct op_unit_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_unit_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_unit_fast_fn<'scope>(_: deno_core::v8::Local<deno_core::v8::Object>) -> () {
     use deno_core::v8;
     use deno_core::_ops;
diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out
index 83592629296eeb..f4995e0e63deff 100644
--- a/ops/optimizer_tests/wasm_op.out
+++ b/ops/optimizer_tests/wasm_op.out
@@ -13,16 +13,22 @@ impl op_wasm {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_wasm_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, CallbackOptions],
+                        CType::Void,
+                        op_wasm_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: false,
             is_unstable: false,
             is_v8: false,
@@ -46,25 +52,6 @@ impl op_wasm {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_wasm_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_wasm_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_wasm_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 fn op_wasm_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,

From 5e5cb9a52249ad2ac6c9465c923763a2c19b90f5 Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Wed, 22 Mar 2023 12:07:25 +0530
Subject: [PATCH 2/8] compiles

---
 core/runtime.rs      |  4 +--
 ext/ffi/turbocall.rs | 38 ++++++----------------
 ext/flash/lib.rs     | 76 ++++++++++++++------------------------------
 ops/fast_call.rs     |  6 ----
 ops/lib.rs           | 11 ++++---
 5 files changed, 41 insertions(+), 94 deletions(-)

diff --git a/core/runtime.rs b/core/runtime.rs
index a08e651349b74d..3d69f9486dd10d 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -791,8 +791,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
         },
diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs
index 3d01f00f580b1c..bd7546edc402d4 100644
--- a/ext/ffi/turbocall.rs
+++ b/ext/ffi/turbocall.rs
@@ -40,26 +40,26 @@ pub(crate) fn compile_trampoline(sym: &Symbol) -> Trampoline {
   }
 }
 
-pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> Template {
+pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> fast_api::FastFunction {
   let mut params = once(fast_api::Type::V8Value) // Receiver
     .chain(sym.parameter_types.iter().map(|t| t.into()))
     .collect::<Vec<_>>();
 
   let ret = if needs_unwrap(&sym.result_type) {
     params.push(fast_api::Type::TypedArray(fast_api::CType::Int32));
-    fast_api::Type::Void
+    fast_api::CType::Void
   } else if sym.result_type == NativeType::Buffer {
     // Buffer can be used as a return type and converts differently than in parameters.
-    fast_api::Type::Pointer
+    fast_api::CType::Pointer
   } else {
-    fast_api::Type::from(&sym.result_type)
+    fast_api::CType::from(&fast_api::Type::from(&sym.result_type))
   };
 
-  Template {
-    args: params.into_boxed_slice(),
-    ret: (&ret).into(),
-    symbol_ptr: trampoline.ptr(),
-  }
+  fast_api::FastFunction::new(
+    Box::leak(params.into_boxed_slice()),
+    ret,
+    trampoline.ptr(),
+  )
 }
 
 /// Trampoline for fast-call FFI functions
@@ -73,26 +73,6 @@ impl Trampoline {
   }
 }
 
-pub(crate) struct Template {
-  pub args: Box<[fast_api::Type]>,
-  pub ret: fast_api::CType,
-  pub symbol_ptr: *const c_void,
-}
-
-impl fast_api::FastFunction for Template {
-  fn function(&self) -> *const c_void {
-    self.symbol_ptr
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    Box::leak(self.args.clone())
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    self.ret
-  }
-}
-
 impl From<&NativeType> for fast_api::Type {
   fn from(native_type: &NativeType) -> Self {
     match native_type {
diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs
index b6a586d1fe07fa..d883b9b5a5824a 100644
--- a/ext/flash/lib.rs
+++ b/ext/flash/lib.rs
@@ -316,26 +316,16 @@ async fn op_flash_write_resource(
   Ok(())
 }
 
-pub struct RespondFast;
-
-impl fast_api::FastFunction for RespondFast {
-  fn function(&self) -> *const c_void {
-    op_flash_respond_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[
-      fast_api::Type::V8Value,
-      fast_api::Type::Uint32,
-      fast_api::Type::TypedArray(fast_api::CType::Uint8),
-      fast_api::Type::Bool,
-    ]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+pub const RESPOND_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[
+    fast_api::Type::V8Value,
+    fast_api::Type::Uint32,
+    fast_api::Type::TypedArray(fast_api::CType::Uint8),
+    fast_api::Type::Bool,
+  ],
+  fast_api::CType::Uint32,
+  op_flash_respond_fast as *const c_void,
+);
 
 fn flash_respond(
   ctx: &mut ServerContext,
@@ -468,21 +458,11 @@ fn next_request_sync(ctx: &mut ServerContext) -> u32 {
   ctx.next_token - offset
 }
 
-pub struct NextRequestFast;
-
-impl fast_api::FastFunction for NextRequestFast {
-  fn function(&self) -> *const c_void {
-    op_flash_next_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[fast_api::Type::V8Value]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+const NEXT_REQUEST_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[fast_api::Type::V8Value],
+  fast_api::CType::Uint32,
+  op_flash_next_fast as *const c_void,
+);
 
 unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
   let ptr =
@@ -491,21 +471,11 @@ unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
   next_request_sync(ctx)
 }
 
-pub struct GetMethodFast;
-
-impl fast_api::FastFunction for GetMethodFast {
-  fn function(&self) -> *const c_void {
-    op_flash_get_method_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[fast_api::Type::V8Value, fast_api::Type::Uint32]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+const GET_METHOD_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[fast_api::Type::V8Value, fast_api::Type::Uint32],
+  fast_api::CType::Uint32,
+  op_flash_get_method_fast as *const c_void,
+);
 
 unsafe fn op_flash_get_method_fast(
   recv: v8::Local<v8::Object>,
@@ -549,7 +519,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &NextRequestFast, None, None, None);
+    let func = builder.build_fast(scope, &NEXT_REQUEST_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "nextRequest").unwrap();
@@ -572,7 +542,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &GetMethodFast, None, None, None);
+    let func = builder.build_fast(scope, &GET_METHOD_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "getMethod").unwrap();
@@ -610,7 +580,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &RespondFast, None, None, None);
+    let func = builder.build_fast(scope, &RESPOND_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "respond").unwrap();
diff --git a/ops/fast_call.rs b/ops/fast_call.rs
index 74ba88deb161ba..f1a56e3bbbba4d 100644
--- a/ops/fast_call.rs
+++ b/ops/fast_call.rs
@@ -14,12 +14,6 @@ use syn::GenericParam;
 use syn::Generics;
 use syn::Ident;
 use syn::ItemFn;
-use syn::ItemImpl;
-use syn::Path;
-use syn::PathArguments;
-use syn::PathSegment;
-use syn::Type;
-use syn::TypePath;
 
 use crate::optimizer::FastValue;
 use crate::optimizer::Optimizer;
diff --git a/ops/lib.rs b/ops/lib.rs
index 92d13be3b45e1c..323d427da9514a 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -187,15 +187,18 @@ impl Op {
           stringify!(#name)
         }
 
-        pub const fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
-          use #core::v8::MapFnTo;
-          Self::v8_func::<#type_params>.map_fn_to()
+        pub extern "C" fn v8_fn_ptr #generics (info: *const #core::v8::FunctionCallbackInfo) #where_clause {
+          let info = unsafe { &*info };
+          let scope = &mut unsafe { #core::v8::CallbackScope::new(info) };
+          let args = #core::v8::FunctionCallbackArguments::from_function_callback_info(info);
+          let rv = #core::v8::ReturnValue::from_function_callback_info(info);
+          Self::v8_func::<#type_params>(scope, args, rv);
         }
 
         pub const fn decl #generics () -> #core::OpDecl #where_clause {
           #core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<#type_params> as _,
             enabled: true,
             fast_fn: #decl,
             is_async: #is_async,

From 3a0f9959b266e91a5e9579495f3d7f102bd1a74e Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Wed, 22 Mar 2023 12:08:09 +0530
Subject: [PATCH 3/8] update tests

---
 core/runtime.rs                                 |  2 +-
 ext/ffi/turbocall.rs                            |  5 ++++-
 ops/optimizer_tests/async_nop.out               | 17 ++++++++++++-----
 ops/optimizer_tests/async_result.out            | 17 ++++++++++++-----
 ops/optimizer_tests/callback_options.out        | 17 ++++++++++++-----
 ops/optimizer_tests/cow_str.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/f64_slice.out               | 17 ++++++++++++-----
 ops/optimizer_tests/incompatible_1.out          | 17 ++++++++++++-----
 ops/optimizer_tests/issue16934.out              | 17 ++++++++++++-----
 ops/optimizer_tests/issue16934_fast.out         | 17 ++++++++++++-----
 .../op_blob_revoke_object_url.out               | 17 ++++++++++++-----
 ops/optimizer_tests/op_ffi_ptr_value.out        | 17 ++++++++++++-----
 ops/optimizer_tests/op_print.out                | 17 ++++++++++++-----
 ops/optimizer_tests/op_state.out                | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_basic1.out         | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_generics.out       | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_result.out         | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_warning.out        | 17 ++++++++++++-----
 .../op_state_with_transforms.out                | 17 ++++++++++++-----
 ops/optimizer_tests/opstate_with_arity.out      | 17 ++++++++++++-----
 ops/optimizer_tests/option_arg.out              | 17 ++++++++++++-----
 ops/optimizer_tests/owned_string.out            | 17 ++++++++++++-----
 .../param_mut_binding_warning.out               | 17 ++++++++++++-----
 ops/optimizer_tests/raw_ptr.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/serde_v8_value.out          | 17 ++++++++++++-----
 ops/optimizer_tests/strings.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/strings_result.out          | 17 ++++++++++++-----
 ops/optimizer_tests/u64_result.out              | 17 ++++++++++++-----
 ops/optimizer_tests/uint8array.out              | 17 ++++++++++++-----
 ops/optimizer_tests/unit_result.out             | 17 ++++++++++++-----
 ops/optimizer_tests/unit_result2.out            | 17 ++++++++++++-----
 ops/optimizer_tests/unit_ret.out                | 17 ++++++++++++-----
 ops/optimizer_tests/wasm_op.out                 | 17 ++++++++++++-----
 33 files changed, 377 insertions(+), 157 deletions(-)

diff --git a/core/runtime.rs b/core/runtime.rs
index 3d69f9486dd10d..797cfeeb8582c4 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -792,7 +792,7 @@ impl JsRuntime {
         false => OpDecl {
           v8_fn_ptr: match op.is_async {
             true => op_void_async::v8_fn_ptr as _,
-            false => op_void_sync::v8_fn_ptr as _
+            false => op_void_sync::v8_fn_ptr as _,
           },
           ..op
         },
diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs
index bd7546edc402d4..f25f9274f9f512 100644
--- a/ext/ffi/turbocall.rs
+++ b/ext/ffi/turbocall.rs
@@ -40,7 +40,10 @@ pub(crate) fn compile_trampoline(sym: &Symbol) -> Trampoline {
   }
 }
 
-pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> fast_api::FastFunction {
+pub(crate) fn make_template(
+  sym: &Symbol,
+  trampoline: &Trampoline,
+) -> fast_api::FastFunction {
   let mut params = once(fast_api::Type::V8Value) // Receiver
     .chain(sym.parameter_types.iter().map(|t| t.into()))
     .collect::<Vec<_>>();
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index af08cb105fc619..ca771cc3c0730e 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -6,17 +6,24 @@
 pub struct op_void_async;
 #[doc(hidden)]
 impl op_void_async {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_void_async)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index ea8486085d0337..7daeaa76cc5b53 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -6,17 +6,24 @@
 pub struct op_async_result;
 #[doc(hidden)]
 impl op_async_result {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_async_result)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out
index 86d038ba320558..1f19643b1792b7 100644
--- a/ops/optimizer_tests/callback_options.out
+++ b/ops/optimizer_tests/callback_options.out
@@ -6,17 +6,24 @@
 pub struct op_fallback;
 #[doc(hidden)]
 impl op_fallback {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_fallback)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out
index 8a27f4a768b6fe..69f330a145e27c 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -6,17 +6,24 @@
 pub struct op_cow_str;
 #[doc(hidden)]
 impl op_cow_str {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_cow_str)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out
index 5fd8325d64bcbb..5afc3cbc83ffa1 100644
--- a/ops/optimizer_tests/f64_slice.out
+++ b/ops/optimizer_tests/f64_slice.out
@@ -6,17 +6,24 @@
 pub struct op_f64_buf;
 #[doc(hidden)]
 impl op_f64_buf {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_f64_buf)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out
index db468515abe28d..7a6a3846a93be6 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -6,17 +6,24 @@
 pub struct op_sync_serialize_object_with_numbers_as_keys;
 #[doc(hidden)]
 impl op_sync_serialize_object_with_numbers_as_keys {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_sync_serialize_object_with_numbers_as_keys)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index 858cd6c693cab1..9f3255ed7c417a 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -6,17 +6,24 @@
 pub struct send_stdin;
 #[doc(hidden)]
 impl send_stdin {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: true,
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index b0d32e3f744ec1..07a43763ad263e 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -6,17 +6,24 @@
 pub struct send_stdin;
 #[doc(hidden)]
 impl send_stdin {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: true,
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out
index 9d9e47c689444d..8d7a4a2031eee1 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -6,17 +6,24 @@
 pub struct op_blob_revoke_object_url;
 #[doc(hidden)]
 impl op_blob_revoke_object_url {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_blob_revoke_object_url)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out
index 11a1fb0eef6823..1d09c22e8abeff 100644
--- a/ops/optimizer_tests/op_ffi_ptr_value.out
+++ b/ops/optimizer_tests/op_ffi_ptr_value.out
@@ -6,17 +6,24 @@
 pub struct op_ffi_ptr_value;
 #[doc(hidden)]
 impl op_ffi_ptr_value {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_value)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out
index a2d87d29c3372c..a918ffedc3f7b7 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -6,17 +6,24 @@
 pub struct op_print;
 #[doc(hidden)]
 impl op_print {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_print)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out
index 91848316237237..0a3e1194200ad2 100644
--- a/ops/optimizer_tests/op_state.out
+++ b/ops/optimizer_tests/op_state.out
@@ -6,17 +6,24 @@
 pub struct op_set_exit_code;
 #[doc(hidden)]
 impl op_set_exit_code {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_set_exit_code)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out
index f270d6f57f537e..d798dc909bd681 100644
--- a/ops/optimizer_tests/op_state_basic1.out
+++ b/ops/optimizer_tests/op_state_basic1.out
@@ -6,17 +6,24 @@
 pub struct foo;
 #[doc(hidden)]
 impl foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(foo)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out
index b76e25826b2618..4c1cdacbb71380 100644
--- a/ops/optimizer_tests/op_state_generics.out
+++ b/ops/optimizer_tests/op_state_generics.out
@@ -6,15 +6,22 @@
 pub struct op_foo;
 #[doc(hidden)]
 impl op_foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_foo)
     }
-    pub fn v8_fn_ptr<'scope, SP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, SP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         SP: SomePermission + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<SP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<SP>(scope, args, rv);
     }
     pub const fn decl<'scope, SP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_foo {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<SP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<SP> as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out
index 1a2f2335ca33e6..efc0ee25685a8e 100644
--- a/ops/optimizer_tests/op_state_result.out
+++ b/ops/optimizer_tests/op_state_result.out
@@ -6,17 +6,24 @@
 pub struct foo;
 #[doc(hidden)]
 impl foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(foo)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out
index 8f5efbd7a52093..85c6251c14aeef 100644
--- a/ops/optimizer_tests/op_state_warning.out
+++ b/ops/optimizer_tests/op_state_warning.out
@@ -6,17 +6,24 @@
 pub struct op_listen;
 #[doc(hidden)]
 impl op_listen {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_listen)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out
index 48df2c0bce8faf..8a479d13b5bfb6 100644
--- a/ops/optimizer_tests/op_state_with_transforms.out
+++ b/ops/optimizer_tests/op_state_with_transforms.out
@@ -6,15 +6,22 @@
 pub struct op_now;
 #[doc(hidden)]
 impl op_now {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_now)
     }
-    pub fn v8_fn_ptr<'scope, TP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, TP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         TP: TimersPermission + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<TP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<TP>(scope, args, rv);
     }
     pub const fn decl<'scope, TP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_now {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<TP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<TP> as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out
index 4e896e89abbe94..fe664d4790d2fc 100644
--- a/ops/optimizer_tests/opstate_with_arity.out
+++ b/ops/optimizer_tests/opstate_with_arity.out
@@ -6,17 +6,24 @@
 pub struct op_add_4;
 #[doc(hidden)]
 impl op_add_4 {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_add_4)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out
index d48000242dcfc5..d070a7a348000d 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -6,17 +6,24 @@
 pub struct op_try_close;
 #[doc(hidden)]
 impl op_try_close {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_try_close)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out
index c8eec54b415cdb..479a3e9910022e 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out
index 7f6a62469e7a19..c4b3eda6c7d7ca 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -6,17 +6,24 @@
 pub struct op_read_sync;
 #[doc(hidden)]
 impl op_read_sync {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_read_sync)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out
index 45366d1c458c03..25e7d81bf9626d 100644
--- a/ops/optimizer_tests/raw_ptr.out
+++ b/ops/optimizer_tests/raw_ptr.out
@@ -6,15 +6,22 @@
 pub struct op_ffi_ptr_of;
 #[doc(hidden)]
 impl op_ffi_ptr_of {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_of)
     }
-    pub fn v8_fn_ptr<'scope, FP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, FP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         FP: FfiPermissions + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<FP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<FP>(scope, args, rv);
     }
     pub const fn decl<'scope, FP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_ffi_ptr_of {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<FP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<FP> as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out
index 9509bb20448782..a6ba90d73c58a6 100644
--- a/ops/optimizer_tests/serde_v8_value.out
+++ b/ops/optimizer_tests/serde_v8_value.out
@@ -6,17 +6,24 @@
 pub struct op_is_proxy;
 #[doc(hidden)]
 impl op_is_proxy {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_is_proxy)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out
index 89ba61dcb97257..0ff5ef1eaa84cf 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out
index c3fb1ad40d1b89..c554fa52905e1f 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out
index 9259a28cc2a707..4dda2689bffca4 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -6,17 +6,24 @@
 pub struct op_bench_now;
 #[doc(hidden)]
 impl op_bench_now {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_bench_now)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out
index 6b2f40208807ba..fed6038d9427b4 100644
--- a/ops/optimizer_tests/uint8array.out
+++ b/ops/optimizer_tests/uint8array.out
@@ -6,17 +6,24 @@
 pub struct op_import_spki_x25519;
 #[doc(hidden)]
 impl op_import_spki_x25519 {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_import_spki_x25519)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out
index 7c197da5bfd027..36321adab2f714 100644
--- a/ops/optimizer_tests/unit_result.out
+++ b/ops/optimizer_tests/unit_result.out
@@ -6,17 +6,24 @@
 pub struct op_unit_result;
 #[doc(hidden)]
 impl op_unit_result {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_unit_result)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out
index 41ccb8bc31fb9b..e51516e9957b18 100644
--- a/ops/optimizer_tests/unit_result2.out
+++ b/ops/optimizer_tests/unit_result2.out
@@ -6,17 +6,24 @@
 pub struct op_set_nodelay;
 #[doc(hidden)]
 impl op_set_nodelay {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_set_nodelay)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out
index 210993979ba0bc..ddf830b708ce11 100644
--- a/ops/optimizer_tests/unit_ret.out
+++ b/ops/optimizer_tests/unit_ret.out
@@ -6,17 +6,24 @@
 pub struct op_unit;
 #[doc(hidden)]
 impl op_unit {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_unit)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out
index f4995e0e63deff..fd0c8678ad1834 100644
--- a/ops/optimizer_tests/wasm_op.out
+++ b/ops/optimizer_tests/wasm_op.out
@@ -6,17 +6,24 @@
 pub struct op_wasm;
 #[doc(hidden)]
 impl op_wasm {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_wasm)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;

From 7173f75268047b14e7fc40aa0c031b47e3129396 Mon Sep 17 00:00:00 2001
From: Levente Kurusa <lkurusa@kernelstuff.org>
Date: Tue, 28 Mar 2023 12:05:19 +0200
Subject: [PATCH 4/8] constant time op declaration

---
 Cargo.lock                                    |   4 +-
 Cargo.toml                                    |   2 +-
 core/bindings.rs                              |   4 +-
 core/extensions.rs                            |   2 +-
 ops/fast_call.rs                              | 119 ++++--------------
 ops/lib.rs                                    |   6 +-
 ops/optimizer_tests/async_nop.out             |  38 ++----
 ops/optimizer_tests/async_result.out          |  39 ++----
 ops/optimizer_tests/incompatible_1.out        |   2 +-
 ops/optimizer_tests/issue16934.out            |   2 +-
 ops/optimizer_tests/issue16934_fast.out       |   2 +-
 .../op_blob_revoke_object_url.out             |   2 +-
 ops/optimizer_tests/op_print.out              |   2 +-
 ops/optimizer_tests/option_arg.out            |   2 +-
 .../param_mut_binding_warning.out             |   2 +-
 ops/optimizer_tests/strings_result.out        |   2 +-
 ops/optimizer_tests/u64_result.out            |   2 +-
 17 files changed, 68 insertions(+), 164 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 019af1b6e02de9..e3daebbb137c4a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5306,9 +5306,9 @@ dependencies = [
 
 [[package]]
 name = "v8"
-version = "0.66.0"
+version = "0.67.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8ab8597b885c17b3761f6ffc29b7a62758612c409285a9271c6dacd17bb745"
+checksum = "c7bf30312144d97d3fb61a0c8893eec02f4fa53ec2b691a8d05da9605ab26024"
 dependencies = [
  "bitflags",
  "fslock",
diff --git a/Cargo.toml b/Cargo.toml
index b364a9cf4406c2..9b8a6169fc744f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,7 +43,7 @@ license = "MIT"
 repository = "https://github.com/denoland/deno"
 
 [workspace.dependencies]
-v8 = { version = "0.66.0", default-features = false }
+v8 = { version = "0.67.0", default-features = false }
 deno_ast = { version = "0.25.0", features = ["transpiling"] }
 
 deno_core = { version = "0.177.0", path = "./core" }
diff --git a/core/bindings.rs b/core/bindings.rs
index 52db40f0da275a..00d0cf2e6f4aeb 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 9b4fb203a1c1a5..ca618c9b7393e2 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/ops/fast_call.rs b/ops/fast_call.rs
index fa5af74b879ade..848cac4d62f716 100644
--- a/ops/fast_call.rs
+++ b/ops/fast_call.rs
@@ -62,13 +62,11 @@ pub(crate) fn generate(
     }
   };
 
-  // We've got 3 idents.
+  // We've got 2 idents.
   //
   // - op_foo, the public op declaration contains the user function.
-  // - op_foo_fast, the fast call type.
   // - op_foo_fast_fn, the fast call function.
   let ident = item_fn.sig.ident.clone();
-  let fast_ident = Ident::new(&format!("{ident}_fast"), Span::call_site());
   let fast_fn_ident =
     Ident::new(&format!("{ident}_fast_fn"), Span::call_site());
 
@@ -78,11 +76,6 @@ pub(crate) fn generate(
 
   // struct op_foo_fast <T, U> { ... }
   let struct_generics = exclude_lifetime_params(&generics.params);
-  // std::marker::PhantomData <A>
-  let phantom_generics: Quote = match struct_generics {
-    Some(ref params) => q!(Vars { params }, { params }),
-    None => q!({ <()> }),
-  };
   // op_foo_fast_fn :: <T>
   let caller_generics: Quote = match struct_generics {
     Some(ref params) => q!(Vars { params }, { ::params }),
@@ -90,28 +83,19 @@ pub(crate) fn generate(
   };
 
   // This goes in the FastFunction impl block.
-  let mut segments = Punctuated::new();
-  {
-    let mut arguments = PathArguments::None;
-    if let Some(ref struct_generics) = struct_generics {
-      arguments = PathArguments::AngleBracketed(parse_quote! {
-        #struct_generics
-      });
-    }
-    segments.push_value(PathSegment {
-      ident: fast_ident.clone(),
-      arguments,
-    });
-  }
-
-  // struct T <A> {
-  //   _phantom: ::std::marker::PhantomData<A>,
+  // let mut segments = Punctuated::new();
+  // {
+  //   let mut arguments = PathArguments::None;
+  //   if let Some(ref struct_generics) = struct_generics {
+  //     arguments = PathArguments::AngleBracketed(parse_quote! {
+  //       #struct_generics
+  //     });
+  //   }
+  //   segments.push_value(PathSegment {
+  //     ident: fast_ident.clone(),
+  //     arguments,
+  //   });
   // }
-  let fast_ty: Quote = q!(Vars { Type: &fast_ident, generics: &struct_generics, phantom_generics }, {
-    struct Type generics {
-      _phantom: ::std::marker::PhantomData phantom_generics,
-    }
-  });
 
   // Original inputs.
   let mut inputs = item_fn.sig.inputs.clone();
@@ -345,73 +329,22 @@ pub(crate) fn generate(
   let mut generics: Generics = parse_quote! { #impl_generics };
   generics.where_clause = where_clause.cloned();
 
-  // impl <A> fast_api::FastFunction for T <A> where A: B {
-  //   fn function(&self) -> *const ::std::ffi::c_void  {
-  //     f as *const ::std::ffi::c_void
-  //   }
-  //   fn args(&self) -> &'static [fast_api::Type] {
-  //     &[ CType::T, CType::U ]
-  //   }
-  //   fn return_type(&self) -> fast_api::CType {
-  //     CType::T
-  //   }
-  // }
-  let item: ItemImpl = ItemImpl {
-    attrs: vec![],
-    defaultness: None,
-    unsafety: None,
-    impl_token: Default::default(),
-    generics,
-    trait_: Some((
-      None,
-      parse_quote!(#core::v8::fast_api::FastFunction),
-      Default::default(),
-    )),
-    self_ty: Box::new(Type::Path(TypePath {
-      qself: None,
-      path: Path {
-        leading_colon: None,
-        segments,
-      },
-    })),
-    brace_token: Default::default(),
-    items: vec![
-      parse_quote! {
-        #[inline(always)]
-        fn function(&self) -> *const ::std::ffi::c_void {
-          #fast_fn_ident #caller_generics as *const ::std::ffi::c_void
-        }
-      },
-      parse_quote! {
-        #[inline(always)]
-        fn args(&self) -> &'static [#core::v8::fast_api::Type] {
-          use #core::v8::fast_api::Type::*;
-          use #core::v8::fast_api::CType;
-          &[ #input_variants ]
-        }
-      },
-      parse_quote! {
-        #[inline(always)]
-        fn return_type(&self) -> #core::v8::fast_api::CType {
-          #core::v8::fast_api::CType::#output_variant
-        }
-      },
-    ],
-  };
-
-  let mut tts = q!({});
-  tts.push_tokens(&fast_ty);
-  tts.push_tokens(&item);
-  tts.push_tokens(&fast_fn);
-
-  let impl_and_fn = tts.dump();
+  // fast_api::FastFunction::new(&[ CType::T, CType::U ], CType::T, f::<P> as *const ::std::ffi::c_void)
   let decl = q!(
-    Vars { fast_ident, caller_generics },
-    {
-      Some(Box::new(fast_ident caller_generics { _phantom: ::std::marker::PhantomData }))
-    }
+    Vars { core: core, fast_fn_ident: fast_fn_ident, generics: caller_generics, inputs: input_variants, output: output_variant },
+    {{
+      use core::v8::fast_api::Type::*;
+      use core::v8::fast_api::CType;
+      Some(core::v8::fast_api::FastFunction::new(
+        &[ inputs ],
+        CType :: output,
+        fast_fn_ident generics as *const ::std::ffi::c_void
+      ))
+    }}
   ).dump();
 
+  let impl_and_fn = fast_fn.dump();
+
   FastImplItems {
     impl_and_fn,
     decl,
diff --git a/ops/lib.rs b/ops/lib.rs
index bd87bc4920f86e..0c6212f98fd83d 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -184,16 +184,16 @@ impl Op {
 
       #[doc(hidden)]
       impl #name {
-        pub fn name() -> &'static str {
+        pub const fn name() -> &'static str {
           stringify!(#name)
         }
 
-        pub fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
+        pub const fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
           use #core::v8::MapFnTo;
           Self::v8_func::<#type_params>.map_fn_to()
         }
 
-        pub fn decl #generics () -> #core::OpDecl #where_clause {
+        pub const fn decl #generics () -> #core::OpDecl #where_clause {
           #core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index 83ffed142bb8df..014ae3996055e9 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -13,16 +13,22 @@ impl op_void_async {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_void_async_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Int32, CallbackOptions],
+                        CType::Void,
+                        op_void_async_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: true,
             is_unstable: false,
             is_v8: false,
@@ -82,26 +88,6 @@ impl op_void_async {
         );
     }
 }
-struct op_void_async_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_void_async_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_void_async_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
-#[allow(clippy::too_many_arguments)]
 fn op_void_async_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index 111430b77c90e8..ea8486085d0337 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -13,20 +13,25 @@ impl op_async_result {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
             enabled: true,
-            fast_fn: Some(
-                Box::new(op_async_result_fast {
-                    _phantom: ::std::marker::PhantomData,
-                }),
-            ),
+            fast_fn: {
+                use deno_core::v8::fast_api::Type::*;
+                use deno_core::v8::fast_api::CType;
+                Some(
+                    deno_core::v8::fast_api::FastFunction::new(
+                        &[V8Value, Int32, Uint32, CallbackOptions],
+                        CType::Void,
+                        op_async_result_fast_fn as *const ::std::ffi::c_void,
+                    ),
+                )
+            },
             is_async: true,
             is_unstable: false,
             is_v8: false,
-            force_registration: false,
         }
     }
     #[inline]
@@ -92,26 +97,6 @@ impl op_async_result {
         );
     }
 }
-struct op_async_result_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_async_result_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_async_result_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
-#[allow(clippy::too_many_arguments)]
 fn op_async_result_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out
index 4bd26ecccd92e0..f2a95d95fdae60 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -13,7 +13,7 @@ impl op_sync_serialize_object_with_numbers_as_keys {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index 5b0b208f325a7f..c23e2fdf918bce 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -13,7 +13,7 @@ impl send_stdin {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index 704329e4aa1692..0f308723198ca3 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -13,7 +13,7 @@ impl send_stdin {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out
index 83d3e1d04f55ea..883810288e18e4 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -13,7 +13,7 @@ impl op_blob_revoke_object_url {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out
index 38602b3c10352b..c38ace9d74abee 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -13,7 +13,7 @@ impl op_print {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out
index 3790ef4fa6a2bf..0dd9d7f3e4dfa8 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -13,7 +13,7 @@ impl op_try_close {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out
index 1655ece7611199..79f2293e853f82 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -13,7 +13,7 @@ impl op_read_sync {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out
index 6ef5963a69a15f..ca2290197b3cd8 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -13,7 +13,7 @@ impl op_string_length {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),
diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out
index 6744e65acb6871..38e8fdae751a41 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -13,7 +13,7 @@ impl op_bench_now {
         use deno_core::v8::MapFnTo;
         Self::v8_func.map_fn_to()
     }
-    pub fn decl<'scope>() -> deno_core::OpDecl {
+    pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
             v8_fn_ptr: Self::v8_fn_ptr(),

From 6fe3e76667708952b7383f7f29d48a66f83cd443 Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Wed, 22 Mar 2023 12:07:25 +0530
Subject: [PATCH 5/8] compiles

---
 core/runtime.rs      |  4 +--
 ext/ffi/turbocall.rs | 38 ++++++----------------
 ext/flash/lib.rs     | 76 ++++++++++++++------------------------------
 ops/fast_call.rs     |  6 ----
 ops/lib.rs           | 11 ++++---
 5 files changed, 41 insertions(+), 94 deletions(-)

diff --git a/core/runtime.rs b/core/runtime.rs
index 787bac972772ed..085e085844a248 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
         },
diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs
index 3d01f00f580b1c..bd7546edc402d4 100644
--- a/ext/ffi/turbocall.rs
+++ b/ext/ffi/turbocall.rs
@@ -40,26 +40,26 @@ pub(crate) fn compile_trampoline(sym: &Symbol) -> Trampoline {
   }
 }
 
-pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> Template {
+pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> fast_api::FastFunction {
   let mut params = once(fast_api::Type::V8Value) // Receiver
     .chain(sym.parameter_types.iter().map(|t| t.into()))
     .collect::<Vec<_>>();
 
   let ret = if needs_unwrap(&sym.result_type) {
     params.push(fast_api::Type::TypedArray(fast_api::CType::Int32));
-    fast_api::Type::Void
+    fast_api::CType::Void
   } else if sym.result_type == NativeType::Buffer {
     // Buffer can be used as a return type and converts differently than in parameters.
-    fast_api::Type::Pointer
+    fast_api::CType::Pointer
   } else {
-    fast_api::Type::from(&sym.result_type)
+    fast_api::CType::from(&fast_api::Type::from(&sym.result_type))
   };
 
-  Template {
-    args: params.into_boxed_slice(),
-    ret: (&ret).into(),
-    symbol_ptr: trampoline.ptr(),
-  }
+  fast_api::FastFunction::new(
+    Box::leak(params.into_boxed_slice()),
+    ret,
+    trampoline.ptr(),
+  )
 }
 
 /// Trampoline for fast-call FFI functions
@@ -73,26 +73,6 @@ impl Trampoline {
   }
 }
 
-pub(crate) struct Template {
-  pub args: Box<[fast_api::Type]>,
-  pub ret: fast_api::CType,
-  pub symbol_ptr: *const c_void,
-}
-
-impl fast_api::FastFunction for Template {
-  fn function(&self) -> *const c_void {
-    self.symbol_ptr
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    Box::leak(self.args.clone())
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    self.ret
-  }
-}
-
 impl From<&NativeType> for fast_api::Type {
   fn from(native_type: &NativeType) -> Self {
     match native_type {
diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs
index 21686379a4f924..647358a4f8afc3 100644
--- a/ext/flash/lib.rs
+++ b/ext/flash/lib.rs
@@ -316,26 +316,16 @@ async fn op_flash_write_resource(
   Ok(())
 }
 
-pub struct RespondFast;
-
-impl fast_api::FastFunction for RespondFast {
-  fn function(&self) -> *const c_void {
-    op_flash_respond_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[
-      fast_api::Type::V8Value,
-      fast_api::Type::Uint32,
-      fast_api::Type::TypedArray(fast_api::CType::Uint8),
-      fast_api::Type::Bool,
-    ]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+pub const RESPOND_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[
+    fast_api::Type::V8Value,
+    fast_api::Type::Uint32,
+    fast_api::Type::TypedArray(fast_api::CType::Uint8),
+    fast_api::Type::Bool,
+  ],
+  fast_api::CType::Uint32,
+  op_flash_respond_fast as *const c_void,
+);
 
 fn flash_respond(
   ctx: &mut ServerContext,
@@ -468,21 +458,11 @@ fn next_request_sync(ctx: &mut ServerContext) -> u32 {
   ctx.next_token - offset
 }
 
-pub struct NextRequestFast;
-
-impl fast_api::FastFunction for NextRequestFast {
-  fn function(&self) -> *const c_void {
-    op_flash_next_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[fast_api::Type::V8Value]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+const NEXT_REQUEST_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[fast_api::Type::V8Value],
+  fast_api::CType::Uint32,
+  op_flash_next_fast as *const c_void,
+);
 
 unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
   let ptr =
@@ -491,21 +471,11 @@ unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
   next_request_sync(ctx)
 }
 
-pub struct GetMethodFast;
-
-impl fast_api::FastFunction for GetMethodFast {
-  fn function(&self) -> *const c_void {
-    op_flash_get_method_fast as *const c_void
-  }
-
-  fn args(&self) -> &'static [fast_api::Type] {
-    &[fast_api::Type::V8Value, fast_api::Type::Uint32]
-  }
-
-  fn return_type(&self) -> fast_api::CType {
-    fast_api::CType::Uint32
-  }
-}
+const GET_METHOD_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
+  &[fast_api::Type::V8Value, fast_api::Type::Uint32],
+  fast_api::CType::Uint32,
+  op_flash_get_method_fast as *const c_void,
+);
 
 unsafe fn op_flash_get_method_fast(
   recv: v8::Local<v8::Object>,
@@ -549,7 +519,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &NextRequestFast, None, None, None);
+    let func = builder.build_fast(scope, &NEXT_REQUEST_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "nextRequest").unwrap();
@@ -572,7 +542,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &GetMethodFast, None, None, None);
+    let func = builder.build_fast(scope, &GET_METHOD_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "getMethod").unwrap();
@@ -610,7 +580,7 @@ fn op_flash_make_request<'scope>(
     )
     .data(v8::External::new(scope, ctx as *mut _).into());
 
-    let func = builder.build_fast(scope, &RespondFast, None, None, None);
+    let func = builder.build_fast(scope, &RESPOND_FAST, None, None, None);
     let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
 
     let key = v8::String::new(scope, "respond").unwrap();
diff --git a/ops/fast_call.rs b/ops/fast_call.rs
index 848cac4d62f716..2485b6083c3e14 100644
--- a/ops/fast_call.rs
+++ b/ops/fast_call.rs
@@ -14,12 +14,6 @@ use syn::GenericParam;
 use syn::Generics;
 use syn::Ident;
 use syn::ItemFn;
-use syn::ItemImpl;
-use syn::Path;
-use syn::PathArguments;
-use syn::PathSegment;
-use syn::Type;
-use syn::TypePath;
 
 use crate::optimizer::FastValue;
 use crate::optimizer::Optimizer;
diff --git a/ops/lib.rs b/ops/lib.rs
index 0c6212f98fd83d..7c29c5febbc107 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -188,15 +188,18 @@ impl Op {
           stringify!(#name)
         }
 
-        pub const fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
-          use #core::v8::MapFnTo;
-          Self::v8_func::<#type_params>.map_fn_to()
+        pub extern "C" fn v8_fn_ptr #generics (info: *const #core::v8::FunctionCallbackInfo) #where_clause {
+          let info = unsafe { &*info };
+          let scope = &mut unsafe { #core::v8::CallbackScope::new(info) };
+          let args = #core::v8::FunctionCallbackArguments::from_function_callback_info(info);
+          let rv = #core::v8::ReturnValue::from_function_callback_info(info);
+          Self::v8_func::<#type_params>(scope, args, rv);
         }
 
         pub const fn decl #generics () -> #core::OpDecl #where_clause {
           #core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<#type_params> as _,
             enabled: true,
             fast_fn: #decl,
             is_async: #is_async,

From d6ec75669d04a1abe4e92867794c1bdb805112f5 Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Wed, 22 Mar 2023 12:08:09 +0530
Subject: [PATCH 6/8] update tests

---
 core/runtime.rs                                 |  2 +-
 ext/ffi/turbocall.rs                            |  5 ++++-
 ops/optimizer_tests/async_nop.out               | 17 ++++++++++++-----
 ops/optimizer_tests/async_result.out            | 17 ++++++++++++-----
 ops/optimizer_tests/callback_options.out        | 17 ++++++++++++-----
 ops/optimizer_tests/cow_str.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/f64_slice.out               | 17 ++++++++++++-----
 ops/optimizer_tests/incompatible_1.out          | 17 ++++++++++++-----
 ops/optimizer_tests/issue16934.out              | 17 ++++++++++++-----
 ops/optimizer_tests/issue16934_fast.out         | 17 ++++++++++++-----
 .../op_blob_revoke_object_url.out               | 17 ++++++++++++-----
 ops/optimizer_tests/op_ffi_ptr_value.out        | 17 ++++++++++++-----
 ops/optimizer_tests/op_print.out                | 17 ++++++++++++-----
 ops/optimizer_tests/op_state.out                | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_basic1.out         | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_generics.out       | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_result.out         | 17 ++++++++++++-----
 ops/optimizer_tests/op_state_warning.out        | 17 ++++++++++++-----
 .../op_state_with_transforms.out                | 17 ++++++++++++-----
 ops/optimizer_tests/opstate_with_arity.out      | 17 ++++++++++++-----
 ops/optimizer_tests/option_arg.out              | 17 ++++++++++++-----
 ops/optimizer_tests/owned_string.out            | 17 ++++++++++++-----
 .../param_mut_binding_warning.out               | 17 ++++++++++++-----
 ops/optimizer_tests/raw_ptr.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/serde_v8_value.out          | 17 ++++++++++++-----
 ops/optimizer_tests/strings.out                 | 17 ++++++++++++-----
 ops/optimizer_tests/strings_result.out          | 17 ++++++++++++-----
 ops/optimizer_tests/u64_result.out              | 17 ++++++++++++-----
 ops/optimizer_tests/uint8array.out              | 17 ++++++++++++-----
 ops/optimizer_tests/unit_result.out             | 17 ++++++++++++-----
 ops/optimizer_tests/unit_result2.out            | 17 ++++++++++++-----
 ops/optimizer_tests/unit_ret.out                | 17 ++++++++++++-----
 ops/optimizer_tests/wasm_op.out                 | 17 ++++++++++++-----
 33 files changed, 377 insertions(+), 157 deletions(-)

diff --git a/core/runtime.rs b/core/runtime.rs
index 085e085844a248..bfb4c45cc3f693 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -794,7 +794,7 @@ impl JsRuntime {
         false => OpDecl {
           v8_fn_ptr: match op.is_async {
             true => op_void_async::v8_fn_ptr as _,
-            false => op_void_sync::v8_fn_ptr as _
+            false => op_void_sync::v8_fn_ptr as _,
           },
           ..op
         },
diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs
index bd7546edc402d4..f25f9274f9f512 100644
--- a/ext/ffi/turbocall.rs
+++ b/ext/ffi/turbocall.rs
@@ -40,7 +40,10 @@ pub(crate) fn compile_trampoline(sym: &Symbol) -> Trampoline {
   }
 }
 
-pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> fast_api::FastFunction {
+pub(crate) fn make_template(
+  sym: &Symbol,
+  trampoline: &Trampoline,
+) -> fast_api::FastFunction {
   let mut params = once(fast_api::Type::V8Value) // Receiver
     .chain(sym.parameter_types.iter().map(|t| t.into()))
     .collect::<Vec<_>>();
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index 014ae3996055e9..c2df1d017670eb 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -6,17 +6,24 @@
 pub struct op_void_async;
 #[doc(hidden)]
 impl op_void_async {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_void_async)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index ea8486085d0337..7daeaa76cc5b53 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -6,17 +6,24 @@
 pub struct op_async_result;
 #[doc(hidden)]
 impl op_async_result {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_async_result)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: {
                 use deno_core::v8::fast_api::Type::*;
diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out
index 87202f50db01c4..fc67ecfd94fcfb 100644
--- a/ops/optimizer_tests/callback_options.out
+++ b/ops/optimizer_tests/callback_options.out
@@ -6,17 +6,24 @@
 pub struct op_fallback;
 #[doc(hidden)]
 impl op_fallback {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_fallback)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_fallback_fast {
diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out
index 89d2f22c48a836..e35d4b4fcad853 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -6,17 +6,24 @@
 pub struct op_cow_str;
 #[doc(hidden)]
 impl op_cow_str {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_cow_str)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_cow_str_fast {
diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out
index 9d1e1c7e3d311c..4a193e43d9f0bd 100644
--- a/ops/optimizer_tests/f64_slice.out
+++ b/ops/optimizer_tests/f64_slice.out
@@ -6,17 +6,24 @@
 pub struct op_f64_buf;
 #[doc(hidden)]
 impl op_f64_buf {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_f64_buf)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_f64_buf_fast {
diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out
index f2a95d95fdae60..2ca88522e14ca7 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -6,17 +6,24 @@
 pub struct op_sync_serialize_object_with_numbers_as_keys;
 #[doc(hidden)]
 impl op_sync_serialize_object_with_numbers_as_keys {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_sync_serialize_object_with_numbers_as_keys)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index c23e2fdf918bce..3761cf07d51953 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -6,17 +6,24 @@
 pub struct send_stdin;
 #[doc(hidden)]
 impl send_stdin {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: true,
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index 0f308723198ca3..dd32f910a0e8fb 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -6,17 +6,24 @@
 pub struct send_stdin;
 #[doc(hidden)]
 impl send_stdin {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: true,
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out
index 883810288e18e4..9b96e297fcc6d5 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -6,17 +6,24 @@
 pub struct op_blob_revoke_object_url;
 #[doc(hidden)]
 impl op_blob_revoke_object_url {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_blob_revoke_object_url)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out
index d81518e6efca18..0485e45df84db5 100644
--- a/ops/optimizer_tests/op_ffi_ptr_value.out
+++ b/ops/optimizer_tests/op_ffi_ptr_value.out
@@ -6,17 +6,24 @@
 pub struct op_ffi_ptr_value;
 #[doc(hidden)]
 impl op_ffi_ptr_value {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_value)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_ffi_ptr_value_fast {
diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out
index c38ace9d74abee..30ea198cf24988 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -6,17 +6,24 @@
 pub struct op_print;
 #[doc(hidden)]
 impl op_print {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_print)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out
index 98b524d0d8626f..2532b467504939 100644
--- a/ops/optimizer_tests/op_state.out
+++ b/ops/optimizer_tests/op_state.out
@@ -6,17 +6,24 @@
 pub struct op_set_exit_code;
 #[doc(hidden)]
 impl op_set_exit_code {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_set_exit_code)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_set_exit_code_fast {
diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out
index ff5fa2a179c837..1473e907e183ea 100644
--- a/ops/optimizer_tests/op_state_basic1.out
+++ b/ops/optimizer_tests/op_state_basic1.out
@@ -6,17 +6,24 @@
 pub struct foo;
 #[doc(hidden)]
 impl foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(foo)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(foo_fast {
diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out
index 7c9998af575874..be582ccbc879de 100644
--- a/ops/optimizer_tests/op_state_generics.out
+++ b/ops/optimizer_tests/op_state_generics.out
@@ -6,15 +6,22 @@
 pub struct op_foo;
 #[doc(hidden)]
 impl op_foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_foo)
     }
-    pub fn v8_fn_ptr<'scope, SP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, SP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         SP: SomePermission + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<SP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<SP>(scope, args, rv);
     }
     pub fn decl<'scope, SP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_foo {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<SP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<SP> as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_foo_fast::<SP> {
diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out
index 30ddf6ff921425..35e1d3cb3745de 100644
--- a/ops/optimizer_tests/op_state_result.out
+++ b/ops/optimizer_tests/op_state_result.out
@@ -6,17 +6,24 @@
 pub struct foo;
 #[doc(hidden)]
 impl foo {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(foo)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(foo_fast {
diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out
index d1148db19cf07f..e835b8d0e0c459 100644
--- a/ops/optimizer_tests/op_state_warning.out
+++ b/ops/optimizer_tests/op_state_warning.out
@@ -6,17 +6,24 @@
 pub struct op_listen;
 #[doc(hidden)]
 impl op_listen {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_listen)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_listen_fast {
diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out
index a49e3cd0d97044..caf19831451493 100644
--- a/ops/optimizer_tests/op_state_with_transforms.out
+++ b/ops/optimizer_tests/op_state_with_transforms.out
@@ -6,15 +6,22 @@
 pub struct op_now;
 #[doc(hidden)]
 impl op_now {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_now)
     }
-    pub fn v8_fn_ptr<'scope, TP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, TP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         TP: TimersPermission + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<TP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<TP>(scope, args, rv);
     }
     pub fn decl<'scope, TP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_now {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<TP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<TP> as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_now_fast::<TP> {
diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out
index 7e7595c79abef7..868aac45b8660b 100644
--- a/ops/optimizer_tests/opstate_with_arity.out
+++ b/ops/optimizer_tests/opstate_with_arity.out
@@ -6,17 +6,24 @@
 pub struct op_add_4;
 #[doc(hidden)]
 impl op_add_4 {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_add_4)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_add_4_fast {
diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out
index 0dd9d7f3e4dfa8..b4a28cfc4436d9 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -6,17 +6,24 @@
 pub struct op_try_close;
 #[doc(hidden)]
 impl op_try_close {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_try_close)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out
index 58a952cd76d9ca..141ce162b0debf 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_string_length_fast {
diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out
index 79f2293e853f82..cd414a75b44024 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -6,17 +6,24 @@
 pub struct op_read_sync;
 #[doc(hidden)]
 impl op_read_sync {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_read_sync)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out
index a1c4ab9875be54..6fdb391b0ecbfb 100644
--- a/ops/optimizer_tests/raw_ptr.out
+++ b/ops/optimizer_tests/raw_ptr.out
@@ -6,15 +6,22 @@
 pub struct op_ffi_ptr_of;
 #[doc(hidden)]
 impl op_ffi_ptr_of {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_of)
     }
-    pub fn v8_fn_ptr<'scope, FP>() -> deno_core::v8::FunctionCallback
+    pub extern "C" fn v8_fn_ptr<'scope, FP>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    )
     where
         FP: FfiPermissions + 'static,
     {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func::<FP>.map_fn_to()
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func::<FP>(scope, args, rv);
     }
     pub fn decl<'scope, FP>() -> deno_core::OpDecl
     where
@@ -22,7 +29,7 @@ impl op_ffi_ptr_of {
     {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr::<FP>(),
+            v8_fn_ptr: Self::v8_fn_ptr::<FP> as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_ffi_ptr_of_fast::<FP> {
diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out
index 2a10c00d4524b1..5bda3dd435e62e 100644
--- a/ops/optimizer_tests/serde_v8_value.out
+++ b/ops/optimizer_tests/serde_v8_value.out
@@ -6,17 +6,24 @@
 pub struct op_is_proxy;
 #[doc(hidden)]
 impl op_is_proxy {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_is_proxy)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_is_proxy_fast {
diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out
index 6d5fca0a5f639d..abc1c96e3da068 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_string_length_fast {
diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out
index ca2290197b3cd8..18f6123d74bf24 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -6,17 +6,24 @@
 pub struct op_string_length;
 #[doc(hidden)]
 impl op_string_length {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out
index 38e8fdae751a41..a4fff7490428fb 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -6,17 +6,24 @@
 pub struct op_bench_now;
 #[doc(hidden)]
 impl op_bench_now {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_bench_now)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub const fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: None,
             is_async: false,
diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out
index 96980cc040d28d..a875d0bfd9c078 100644
--- a/ops/optimizer_tests/uint8array.out
+++ b/ops/optimizer_tests/uint8array.out
@@ -6,17 +6,24 @@
 pub struct op_import_spki_x25519;
 #[doc(hidden)]
 impl op_import_spki_x25519 {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_import_spki_x25519)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_import_spki_x25519_fast {
diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out
index 11a862fa5d8541..37c07d8ea7c1ff 100644
--- a/ops/optimizer_tests/unit_result.out
+++ b/ops/optimizer_tests/unit_result.out
@@ -6,17 +6,24 @@
 pub struct op_unit_result;
 #[doc(hidden)]
 impl op_unit_result {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_unit_result)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_unit_result_fast {
diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out
index cadbfdd7247f7a..8a46642b2cf162 100644
--- a/ops/optimizer_tests/unit_result2.out
+++ b/ops/optimizer_tests/unit_result2.out
@@ -6,17 +6,24 @@
 pub struct op_set_nodelay;
 #[doc(hidden)]
 impl op_set_nodelay {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_set_nodelay)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_set_nodelay_fast {
diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out
index a1ff75682c4ae8..212de6df987734 100644
--- a/ops/optimizer_tests/unit_ret.out
+++ b/ops/optimizer_tests/unit_ret.out
@@ -6,17 +6,24 @@
 pub struct op_unit;
 #[doc(hidden)]
 impl op_unit {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_unit)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_unit_fast {
diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out
index dcf38d9c7e54b1..091fcc28aa83e3 100644
--- a/ops/optimizer_tests/wasm_op.out
+++ b/ops/optimizer_tests/wasm_op.out
@@ -6,17 +6,24 @@
 pub struct op_wasm;
 #[doc(hidden)]
 impl op_wasm {
-    pub fn name() -> &'static str {
+    pub const fn name() -> &'static str {
         stringify!(op_wasm)
     }
-    pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
-        use deno_core::v8::MapFnTo;
-        Self::v8_func.map_fn_to()
+    pub extern "C" fn v8_fn_ptr<'scope>(
+        info: *const deno_core::v8::FunctionCallbackInfo,
+    ) {
+        let info = unsafe { &*info };
+        let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) };
+        let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(
+            info,
+        );
+        let rv = deno_core::v8::ReturnValue::from_function_callback_info(info);
+        Self::v8_func(scope, args, rv);
     }
     pub fn decl<'scope>() -> deno_core::OpDecl {
         deno_core::OpDecl {
             name: Self::name(),
-            v8_fn_ptr: Self::v8_fn_ptr(),
+            v8_fn_ptr: Self::v8_fn_ptr as _,
             enabled: true,
             fast_fn: Some(
                 Box::new(op_wasm_fast {

From 6aa4b1e5a0d59bbbf8ed79c41773fbe1654640fd Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Fri, 31 Mar 2023 15:59:54 +0530
Subject: [PATCH 7/8] Fixes

---
 core/ops.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/ops.rs b/core/ops.rs
index 3a276082f941c4..cceeb565472268 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);
     }

From be2b8e8f4bfc1e51cbccc8c6e7f65ff674e9fa6a Mon Sep 17 00:00:00 2001
From: Divy Srivastava <dj.srivastava23@gmail.com>
Date: Fri, 31 Mar 2023 16:05:25 +0530
Subject: [PATCH 8/8] lint

---
 ops/lib.rs                                    |  1 +
 ops/optimizer_tests/async_nop.out             |  2 ++
 ops/optimizer_tests/async_result.out          |  3 +++
 ops/optimizer_tests/callback_options.out      | 20 +---------------
 ops/optimizer_tests/cow_str.out               | 20 +---------------
 ops/optimizer_tests/f64_slice.out             | 20 +---------------
 ops/optimizer_tests/incompatible_1.out        |  1 +
 ops/optimizer_tests/issue16934.out            |  1 +
 ops/optimizer_tests/issue16934_fast.out       |  1 +
 .../op_blob_revoke_object_url.out             |  1 +
 ops/optimizer_tests/op_ffi_ptr_value.out      | 20 +---------------
 ops/optimizer_tests/op_print.out              |  1 +
 ops/optimizer_tests/op_state.out              | 20 +---------------
 ops/optimizer_tests/op_state_basic1.out       | 20 +---------------
 ops/optimizer_tests/op_state_generics.out     | 23 +------------------
 ops/optimizer_tests/op_state_result.out       | 20 +---------------
 ops/optimizer_tests/op_state_warning.out      | 20 +---------------
 .../op_state_with_transforms.out              | 23 +------------------
 ops/optimizer_tests/opstate_with_arity.out    | 20 +---------------
 ops/optimizer_tests/option_arg.out            |  1 +
 ops/optimizer_tests/owned_string.out          | 20 +---------------
 .../param_mut_binding_warning.out             |  1 +
 ops/optimizer_tests/raw_ptr.out               | 23 +------------------
 ops/optimizer_tests/serde_v8_value.out        | 20 +---------------
 ops/optimizer_tests/strings.out               | 20 +---------------
 ops/optimizer_tests/strings_result.out        |  1 +
 ops/optimizer_tests/u64_result.out            |  1 +
 ops/optimizer_tests/uint8array.out            | 20 +---------------
 ops/optimizer_tests/unit_result.out           | 20 +---------------
 ops/optimizer_tests/unit_result2.out          | 20 +---------------
 ops/optimizer_tests/unit_ret.out              | 20 +---------------
 ops/optimizer_tests/wasm_op.out               | 20 +---------------
 32 files changed, 35 insertions(+), 389 deletions(-)

diff --git a/ops/lib.rs b/ops/lib.rs
index 7c29c5febbc107..aee6c8c0349cc5 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -188,6 +188,7 @@ impl Op {
           stringify!(#name)
         }
 
+        #[allow(clippy::not_unsafe_ptr_arg_deref)]
         pub extern "C" fn v8_fn_ptr #generics (info: *const #core::v8::FunctionCallbackInfo) #where_clause {
           let info = unsafe { &*info };
           let scope = &mut unsafe { #core::v8::CallbackScope::new(info) };
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index c2df1d017670eb..5d73f234314664 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -9,6 +9,7 @@ impl op_void_async {
     pub const fn name() -> &'static str {
         stringify!(op_void_async)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -95,6 +96,7 @@ impl op_void_async {
         );
     }
 }
+#[allow(clippy::too_many_arguments)]
 fn op_void_async_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index 7daeaa76cc5b53..f820687cdb238b 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -9,6 +9,7 @@ impl op_async_result {
     pub const fn name() -> &'static str {
         stringify!(op_async_result)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -39,6 +40,7 @@ impl op_async_result {
             is_async: true,
             is_unstable: false,
             is_v8: false,
+            force_registration: false,
         }
     }
     #[inline]
@@ -104,6 +106,7 @@ impl op_async_result {
         );
     }
 }
+#[allow(clippy::too_many_arguments)]
 fn op_async_result_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
     __promise_id: i32,
diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out
index e961d02ee6437a..e892e01189b620 100644
--- a/ops/optimizer_tests/callback_options.out
+++ b/ops/optimizer_tests/callback_options.out
@@ -9,6 +9,7 @@ impl op_fallback {
     pub const fn name() -> &'static str {
         stringify!(op_fallback)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -64,25 +65,6 @@ impl op_fallback {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_fallback_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_fallback_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_fallback_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_fallback_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out
index ae0cb942f9ac34..8ee82078b1db81 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -9,6 +9,7 @@ impl op_cow_str {
     pub const fn name() -> &'static str {
         stringify!(op_cow_str)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -72,25 +73,6 @@ impl op_cow_str {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_cow_str_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_cow_str_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_cow_str_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_cow_str_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out
index 1994fc62df141c..3e8ef07d855a70 100644
--- a/ops/optimizer_tests/f64_slice.out
+++ b/ops/optimizer_tests/f64_slice.out
@@ -9,6 +9,7 @@ impl op_f64_buf {
     pub const fn name() -> &'static str {
         stringify!(op_f64_buf)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -90,25 +91,6 @@ impl op_f64_buf {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_f64_buf_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_f64_buf_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_f64_buf_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Float64), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_f64_buf_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out
index 2ca88522e14ca7..5104fb5e46c3f9 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -9,6 +9,7 @@ impl op_sync_serialize_object_with_numbers_as_keys {
     pub const fn name() -> &'static str {
         stringify!(op_sync_serialize_object_with_numbers_as_keys)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out
index 3761cf07d51953..f8acf5712a91c1 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -9,6 +9,7 @@ impl send_stdin {
     pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out
index dd32f910a0e8fb..0cdc3eb2553e25 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -9,6 +9,7 @@ impl send_stdin {
     pub const fn name() -> &'static str {
         stringify!(send_stdin)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out
index 9b96e297fcc6d5..4eda692240b4c5 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -9,6 +9,7 @@ impl op_blob_revoke_object_url {
     pub const fn name() -> &'static str {
         stringify!(op_blob_revoke_object_url)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out
index 9af6c2eefee253..3fee00cff8e3da 100644
--- a/ops/optimizer_tests/op_ffi_ptr_value.out
+++ b/ops/optimizer_tests/op_ffi_ptr_value.out
@@ -9,6 +9,7 @@ impl op_ffi_ptr_value {
     pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_value)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -104,25 +105,6 @@ impl op_ffi_ptr_value {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_ffi_ptr_value_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_value_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_ffi_ptr_value_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out
index 30ea198cf24988..7bf5457d788832 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -9,6 +9,7 @@ impl op_print {
     pub const fn name() -> &'static str {
         stringify!(op_print)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out
index 4c7fa72c6dfc53..cebb1e25c7de6f 100644
--- a/ops/optimizer_tests/op_state.out
+++ b/ops/optimizer_tests/op_state.out
@@ -9,6 +9,7 @@ impl op_set_exit_code {
     pub const fn name() -> &'static str {
         stringify!(op_set_exit_code)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -72,25 +73,6 @@ impl op_set_exit_code {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_set_exit_code_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_exit_code_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_set_exit_code_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Int32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_set_exit_code_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out
index 17e94cf8274e57..d8278daca61cb0 100644
--- a/ops/optimizer_tests/op_state_basic1.out
+++ b/ops/optimizer_tests/op_state_basic1.out
@@ -9,6 +9,7 @@ impl foo {
     pub const fn name() -> &'static str {
         stringify!(foo)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -99,25 +100,6 @@ impl foo {
         };
     }
 }
-struct foo_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        foo_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn foo_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out
index 6ddf7f93815caf..631a2142f78d22 100644
--- a/ops/optimizer_tests/op_state_generics.out
+++ b/ops/optimizer_tests/op_state_generics.out
@@ -9,6 +9,7 @@ impl op_foo {
     pub const fn name() -> &'static str {
         stringify!(op_foo)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope, SP>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     )
@@ -71,28 +72,6 @@ impl op_foo {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_foo_fast<SP> {
-    _phantom: ::std::marker::PhantomData<SP>,
-}
-impl<'scope, SP> deno_core::v8::fast_api::FastFunction for op_foo_fast<SP>
-where
-    SP: SomePermission + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_foo_fast_fn::<SP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_foo_fast_fn<'scope, SP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out
index 3288d41dc2fd3d..d03ffd5a6153c7 100644
--- a/ops/optimizer_tests/op_state_result.out
+++ b/ops/optimizer_tests/op_state_result.out
@@ -9,6 +9,7 @@ impl foo {
     pub const fn name() -> &'static str {
         stringify!(foo)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -112,25 +113,6 @@ impl foo {
         };
     }
 }
-struct foo_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        foo_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn foo_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out
index be47d4125fb85c..5548dc134eb1b7 100644
--- a/ops/optimizer_tests/op_state_warning.out
+++ b/ops/optimizer_tests/op_state_warning.out
@@ -9,6 +9,7 @@ impl op_listen {
     pub const fn name() -> &'static str {
         stringify!(op_listen)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -103,25 +104,6 @@ impl op_listen {
         };
     }
 }
-struct op_listen_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_listen_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_listen_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_listen_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out
index 3a0f3b83cea0ed..ad4e5335a8b631 100644
--- a/ops/optimizer_tests/op_state_with_transforms.out
+++ b/ops/optimizer_tests/op_state_with_transforms.out
@@ -9,6 +9,7 @@ impl op_now {
     pub const fn name() -> &'static str {
         stringify!(op_now)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope, TP>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     )
@@ -118,28 +119,6 @@ impl op_now {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_now_fast<TP> {
-    _phantom: ::std::marker::PhantomData<TP>,
-}
-impl<'scope, TP> deno_core::v8::fast_api::FastFunction for op_now_fast<TP>
-where
-    TP: TimersPermission + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_now_fast_fn::<TP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_now_fast_fn<'scope, TP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out
index 54e8df61bc83a9..037774c255e7cb 100644
--- a/ops/optimizer_tests/opstate_with_arity.out
+++ b/ops/optimizer_tests/opstate_with_arity.out
@@ -9,6 +9,7 @@ impl op_add_4 {
     pub const fn name() -> &'static str {
         stringify!(op_add_4)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -130,25 +131,6 @@ impl op_add_4 {
         };
     }
 }
-struct op_add_4_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_add_4_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_add_4_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_add_4_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out
index b4a28cfc4436d9..39d47562b8b818 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -9,6 +9,7 @@ impl op_try_close {
     pub const fn name() -> &'static str {
         stringify!(op_try_close)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out
index 8a9d8ab34373b6..5b516ac5c2f122 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -9,6 +9,7 @@ impl op_string_length {
     pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -84,25 +85,6 @@ impl op_string_length {
         };
     }
 }
-struct op_string_length_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_string_length_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_string_length_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out
index cd414a75b44024..98dc6b2b913639 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -9,6 +9,7 @@ impl op_read_sync {
     pub const fn name() -> &'static str {
         stringify!(op_read_sync)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out
index f86c36c67095a4..678ce50152c869 100644
--- a/ops/optimizer_tests/raw_ptr.out
+++ b/ops/optimizer_tests/raw_ptr.out
@@ -9,6 +9,7 @@ impl op_ffi_ptr_of {
     pub const fn name() -> &'static str {
         stringify!(op_ffi_ptr_of)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope, FP>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     )
@@ -149,28 +150,6 @@ impl op_ffi_ptr_of {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_ffi_ptr_of_fast<FP> {
-    _phantom: ::std::marker::PhantomData<FP>,
-}
-impl<'scope, FP> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_of_fast<FP>
-where
-    FP: FfiPermissions + 'static,
-{
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_ffi_ptr_of_fast_fn::<FP> as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint32), CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_ffi_ptr_of_fast_fn<'scope, FP>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out
index adc5081f72cc7a..d0f8dacdfc4db7 100644
--- a/ops/optimizer_tests/serde_v8_value.out
+++ b/ops/optimizer_tests/serde_v8_value.out
@@ -9,6 +9,7 @@ impl op_is_proxy {
     pub const fn name() -> &'static str {
         stringify!(op_is_proxy)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -84,25 +85,6 @@ impl op_is_proxy {
         };
     }
 }
-struct op_is_proxy_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_is_proxy_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_is_proxy_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, V8Value]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Bool
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_is_proxy_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out
index 1982a2fb2f271e..8a72c8cab65bb9 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -9,6 +9,7 @@ impl op_string_length {
     pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -85,25 +86,6 @@ impl op_string_length {
         };
     }
 }
-struct op_string_length_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_string_length_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, SeqOneByteString]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Uint32
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_string_length_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out
index 18f6123d74bf24..8b2e2acef2026d 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -9,6 +9,7 @@ impl op_string_length {
     pub const fn name() -> &'static str {
         stringify!(op_string_length)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out
index a4fff7490428fb..02d25686a8b814 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -9,6 +9,7 @@ impl op_bench_now {
     pub const fn name() -> &'static str {
         stringify!(op_bench_now)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out
index 2b68f000831827..93fa40e1f2f965 100644
--- a/ops/optimizer_tests/uint8array.out
+++ b/ops/optimizer_tests/uint8array.out
@@ -9,6 +9,7 @@ impl op_import_spki_x25519 {
     pub const fn name() -> &'static str {
         stringify!(op_import_spki_x25519)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -161,25 +162,6 @@ impl op_import_spki_x25519 {
         };
     }
 }
-struct op_import_spki_x25519_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_import_spki_x25519_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Bool
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_import_spki_x25519_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out
index ca095b4559f95e..354a2e3b949b21 100644
--- a/ops/optimizer_tests/unit_result.out
+++ b/ops/optimizer_tests/unit_result.out
@@ -9,6 +9,7 @@ impl op_unit_result {
     pub const fn name() -> &'static str {
         stringify!(op_unit_result)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -84,25 +85,6 @@ impl op_unit_result {
         };
     }
 }
-struct op_unit_result_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_result_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_unit_result_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_unit_result_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out
index dc85aafe949193..721229121b9cc3 100644
--- a/ops/optimizer_tests/unit_result2.out
+++ b/ops/optimizer_tests/unit_result2.out
@@ -9,6 +9,7 @@ impl op_set_nodelay {
     pub const fn name() -> &'static str {
         stringify!(op_set_nodelay)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -117,25 +118,6 @@ impl op_set_nodelay {
         };
     }
 }
-struct op_set_nodelay_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_nodelay_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_set_nodelay_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, Uint32, Bool, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_set_nodelay_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,
diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out
index caeadd5f1c0080..7d0f63dc889b71 100644
--- a/ops/optimizer_tests/unit_ret.out
+++ b/ops/optimizer_tests/unit_ret.out
@@ -9,6 +9,7 @@ impl op_unit {
     pub const fn name() -> &'static str {
         stringify!(op_unit)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -73,25 +74,6 @@ impl op_unit {
         };
     }
 }
-struct op_unit_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_unit_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_unit_fast_fn<'scope>(_: deno_core::v8::Local<deno_core::v8::Object>) -> () {
     use deno_core::v8;
diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out
index edfd173df3a55a..0196f454811278 100644
--- a/ops/optimizer_tests/wasm_op.out
+++ b/ops/optimizer_tests/wasm_op.out
@@ -9,6 +9,7 @@ impl op_wasm {
     pub const fn name() -> &'static str {
         stringify!(op_wasm)
     }
+    #[allow(clippy::not_unsafe_ptr_arg_deref)]
     pub extern "C" fn v8_fn_ptr<'scope>(
         info: *const deno_core::v8::FunctionCallbackInfo,
     ) {
@@ -60,25 +61,6 @@ impl op_wasm {
         op_state.tracker.track_sync(ctx.id);
     }
 }
-struct op_wasm_fast {
-    _phantom: ::std::marker::PhantomData<()>,
-}
-impl<'scope> deno_core::v8::fast_api::FastFunction for op_wasm_fast {
-    #[inline(always)]
-    fn function(&self) -> *const ::std::ffi::c_void {
-        op_wasm_fast_fn as *const ::std::ffi::c_void
-    }
-    #[inline(always)]
-    fn args(&self) -> &'static [deno_core::v8::fast_api::Type] {
-        use deno_core::v8::fast_api::Type::*;
-        use deno_core::v8::fast_api::CType;
-        &[V8Value, CallbackOptions]
-    }
-    #[inline(always)]
-    fn return_type(&self) -> deno_core::v8::fast_api::CType {
-        deno_core::v8::fast_api::CType::Void
-    }
-}
 #[allow(clippy::too_many_arguments)]
 fn op_wasm_fast_fn<'scope>(
     _: deno_core::v8::Local<deno_core::v8::Object>,