summaryrefslogtreecommitdiff
path: root/ops/optimizer_tests
diff options
context:
space:
mode:
Diffstat (limited to 'ops/optimizer_tests')
-rw-r--r--ops/optimizer_tests/async_nop.out55
-rw-r--r--ops/optimizer_tests/async_result.out55
-rw-r--r--ops/optimizer_tests/callback_options.out55
-rw-r--r--ops/optimizer_tests/cow_str.out55
-rw-r--r--ops/optimizer_tests/f64_slice.out55
-rw-r--r--ops/optimizer_tests/incompatible_1.out20
-rw-r--r--ops/optimizer_tests/issue16934.out20
-rw-r--r--ops/optimizer_tests/issue16934_fast.out20
-rw-r--r--ops/optimizer_tests/op_blob_revoke_object_url.out20
-rw-r--r--ops/optimizer_tests/op_ffi_ptr_value.out55
-rw-r--r--ops/optimizer_tests/op_print.out20
-rw-r--r--ops/optimizer_tests/op_state.out55
-rw-r--r--ops/optimizer_tests/op_state_basic1.out55
-rw-r--r--ops/optimizer_tests/op_state_generics.out58
-rw-r--r--ops/optimizer_tests/op_state_result.out55
-rw-r--r--ops/optimizer_tests/op_state_warning.out55
-rw-r--r--ops/optimizer_tests/op_state_with_transforms.out58
-rw-r--r--ops/optimizer_tests/opstate_with_arity.out55
-rw-r--r--ops/optimizer_tests/option_arg.out20
-rw-r--r--ops/optimizer_tests/owned_string.out55
-rw-r--r--ops/optimizer_tests/param_mut_binding_warning.out20
-rw-r--r--ops/optimizer_tests/raw_ptr.out63
-rw-r--r--ops/optimizer_tests/serde_v8_value.out55
-rw-r--r--ops/optimizer_tests/strings.out55
-rw-r--r--ops/optimizer_tests/strings_result.out20
-rw-r--r--ops/optimizer_tests/u64_result.out20
-rw-r--r--ops/optimizer_tests/uint8array.out55
-rw-r--r--ops/optimizer_tests/unit_result.out55
-rw-r--r--ops/optimizer_tests/unit_result2.out55
-rw-r--r--ops/optimizer_tests/unit_ret.out55
-rw-r--r--ops/optimizer_tests/wasm_op.out55
31 files changed, 681 insertions, 723 deletions
diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out
index 83ffed142..5d73f2343 100644
--- a/ops/optimizer_tests/async_nop.out
+++ b/ops/optimizer_tests/async_nop.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,25 +96,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>,
diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out
index 111430b77..f820687cd 100644
--- a/ops/optimizer_tests/async_result.out
+++ b/ops/optimizer_tests/async_result.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -92,25 +106,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>,
diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out
index 87202f50d..e892e0118 100644
--- a/ops/optimizer_tests/callback_options.out
+++ b/ops/optimizer_tests/callback_options.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -51,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 89d2f22c4..8ee82078b 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -59,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 9d1e1c7e3..3e8ef07d8 100644
--- a/ops/optimizer_tests/f64_slice.out
+++ b/ops/optimizer_tests/f64_slice.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -77,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 4bd26eccc..5104fb5e4 100644
--- a/ops/optimizer_tests/incompatible_1.out
+++ b/ops/optimizer_tests/incompatible_1.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 5b0b208f3..f8acf5712 100644
--- a/ops/optimizer_tests/issue16934.out
+++ b/ops/optimizer_tests/issue16934.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 704329e4a..0cdc3eb25 100644
--- a/ops/optimizer_tests/issue16934_fast.out
+++ b/ops/optimizer_tests/issue16934_fast.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 83d3e1d04..4eda69224 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.out
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 d81518e6e..3fee00cff 100644
--- a/ops/optimizer_tests/op_ffi_ptr_value.out
+++ b/ops/optimizer_tests/op_ffi_ptr_value.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -91,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 38602b3c1..7bf5457d7 100644
--- a/ops/optimizer_tests/op_print.out
+++ b/ops/optimizer_tests/op_print.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 98b524d0d..cebb1e25c 100644
--- a/ops/optimizer_tests/op_state.out
+++ b/ops/optimizer_tests/op_state.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -59,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 ff5fa2a17..d8278daca 100644
--- a/ops/optimizer_tests/op_state_basic1.out
+++ b/ops/optimizer_tests/op_state_basic1.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -86,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 7c9998af5..631a2142f 100644
--- a/ops/optimizer_tests/op_state_generics.out
+++ b/ops/optimizer_tests/op_state_generics.out
@@ -6,29 +6,43 @@
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
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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
+ pub const fn decl<'scope, SP>() -> deno_core::OpDecl
where
SP: SomePermission + 'static,
{
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> {
- _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,
@@ -58,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 30ddf6ff9..d03ffd5a6 100644
--- a/ops/optimizer_tests/op_state_result.out
+++ b/ops/optimizer_tests/op_state_result.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -99,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 d1148db19..5548dc134 100644
--- a/ops/optimizer_tests/op_state_warning.out
+++ b/ops/optimizer_tests/op_state_warning.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -90,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 a49e3cd0d..ad4e5335a 100644
--- a/ops/optimizer_tests/op_state_with_transforms.out
+++ b/ops/optimizer_tests/op_state_with_transforms.out
@@ -6,29 +6,43 @@
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
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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
+ pub const fn decl<'scope, TP>() -> deno_core::OpDecl
where
TP: TimersPermission + 'static,
{
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> {
- _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,
@@ -105,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 7e7595c79..037774c25 100644
--- a/ops/optimizer_tests/opstate_with_arity.out
+++ b/ops/optimizer_tests/opstate_with_arity.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -117,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 3790ef4fa..39d47562b 100644
--- a/ops/optimizer_tests/option_arg.out
+++ b/ops/optimizer_tests/option_arg.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 58a952cd7..5b516ac5c 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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 +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 1655ece76..98dc6b2b9 100644
--- a/ops/optimizer_tests/param_mut_binding_warning.out
+++ b/ops/optimizer_tests/param_mut_binding_warning.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 a1c4ab987..678ce5015 100644
--- a/ops/optimizer_tests/raw_ptr.out
+++ b/ops/optimizer_tests/raw_ptr.out
@@ -6,29 +6,48 @@
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
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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
+ pub const fn decl<'scope, FP>() -> deno_core::OpDecl
where
FP: FfiPermissions + 'static,
{
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> {
- _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,
@@ -131,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 2a10c00d4..d0f8dacdf 100644
--- a/ops/optimizer_tests/serde_v8_value.out
+++ b/ops/optimizer_tests/serde_v8_value.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -71,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 6d5fca0a5..8a72c8cab 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -72,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 6ef5963a6..8b2e2acef 100644
--- a/ops/optimizer_tests/strings_result.out
+++ b/ops/optimizer_tests/strings_result.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 6744e65ac..02d25686a 100644
--- a/ops/optimizer_tests/u64_result.out
+++ b/ops/optimizer_tests/u64_result.out
@@ -6,17 +6,25 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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 96980cc04..93fa40e1f 100644
--- a/ops/optimizer_tests/uint8array.out
+++ b/ops/optimizer_tests/uint8array.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -148,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 11a862fa5..354a2e3b9 100644
--- a/ops/optimizer_tests/unit_result.out
+++ b/ops/optimizer_tests/unit_result.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -71,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 cadbfdd72..721229121 100644
--- a/ops/optimizer_tests/unit_result2.out
+++ b/ops/optimizer_tests/unit_result2.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -104,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 a1ff75682..7d0f63dc8 100644
--- a/ops/optimizer_tests/unit_ret.out
+++ b/ops/optimizer_tests/unit_ret.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -60,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 dcf38d9c7..0196f4548 100644
--- a/ops/optimizer_tests/wasm_op.out
+++ b/ops/optimizer_tests/wasm_op.out
@@ -6,23 +6,37 @@
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()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ 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 {
+ 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: 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,
@@ -47,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>,