diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-03-16 18:50:41 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 13:20:41 +0000 |
commit | eb3d79ab1bcdc554acf03034606836443a0971e5 (patch) | |
tree | 1e24e6c0d8888858173f08ced0b6f53e3f06b77a | |
parent | 33b85a2b8e54e38d735233b0f026111d905ea5d2 (diff) |
chore(ops): inline FastFunction trait methods (#18226)
23 files changed, 69 insertions, 0 deletions
diff --git a/ops/fast_call.rs b/ops/fast_call.rs index 0ddf5c878..a6162a019 100644 --- a/ops/fast_call.rs +++ b/ops/fast_call.rs @@ -376,11 +376,13 @@ pub(crate) fn generate( 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; @@ -388,6 +390,7 @@ pub(crate) fn generate( } }, parse_quote! { + #[inline(always)] fn return_type(&self) -> #core::v8::fast_api::CType { #core::v8::fast_api::CType::#output_variant } diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out index 1fed63735..d1e953406 100644 --- a/ops/optimizer_tests/async_nop.out +++ b/ops/optimizer_tests/async_nop.out @@ -85,14 +85,17 @@ 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 } diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out index 7270ca3d5..1d45b11f1 100644 --- a/ops/optimizer_tests/async_result.out +++ b/ops/optimizer_tests/async_result.out @@ -95,14 +95,17 @@ 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 } diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out index be84d686a..3a18be60f 100644 --- a/ops/optimizer_tests/callback_options.out +++ b/ops/optimizer_tests/callback_options.out @@ -54,14 +54,17 @@ 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 } diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out index c1c4917f6..e67605763 100644 --- a/ops/optimizer_tests/cow_str.out +++ b/ops/optimizer_tests/cow_str.out @@ -62,14 +62,17 @@ 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 } diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out index 9526d988a..dd982b193 100644 --- a/ops/optimizer_tests/f64_slice.out +++ b/ops/optimizer_tests/f64_slice.out @@ -80,14 +80,17 @@ 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 } diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out index 5ef91e21f..df38b7227 100644 --- a/ops/optimizer_tests/op_ffi_ptr_value.out +++ b/ops/optimizer_tests/op_ffi_ptr_value.out @@ -94,14 +94,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out index 520d41e1a..619a09748 100644 --- a/ops/optimizer_tests/op_state.out +++ b/ops/optimizer_tests/op_state.out @@ -62,14 +62,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out index 7d803ac39..b2926753e 100644 --- a/ops/optimizer_tests/op_state_basic1.out +++ b/ops/optimizer_tests/op_state_basic1.out @@ -89,14 +89,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out index 28315eb26..88eeefe14 100644 --- a/ops/optimizer_tests/op_state_generics.out +++ b/ops/optimizer_tests/op_state_generics.out @@ -64,14 +64,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out index 0b7301bfc..fb0fdb25f 100644 --- a/ops/optimizer_tests/op_state_result.out +++ b/ops/optimizer_tests/op_state_result.out @@ -102,14 +102,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out index 1942a6376..5a4b481c4 100644 --- a/ops/optimizer_tests/op_state_warning.out +++ b/ops/optimizer_tests/op_state_warning.out @@ -93,14 +93,17 @@ 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 } diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out index ecd56ceeb..07e1fefb9 100644 --- a/ops/optimizer_tests/op_state_with_transforms.out +++ b/ops/optimizer_tests/op_state_with_transforms.out @@ -111,14 +111,17 @@ 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 } diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out index 7c831ccfe..ab4e905d5 100644 --- a/ops/optimizer_tests/opstate_with_arity.out +++ b/ops/optimizer_tests/opstate_with_arity.out @@ -120,14 +120,17 @@ 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 } diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out index 56d3cbfdc..62fb45ed7 100644 --- a/ops/optimizer_tests/owned_string.out +++ b/ops/optimizer_tests/owned_string.out @@ -74,14 +74,17 @@ 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 } diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out index 2b4e8c0b4..12f93f99d 100644 --- a/ops/optimizer_tests/raw_ptr.out +++ b/ops/optimizer_tests/raw_ptr.out @@ -137,14 +137,17 @@ 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 } diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out index 3ea0aacb3..6ee56d460 100644 --- a/ops/optimizer_tests/serde_v8_value.out +++ b/ops/optimizer_tests/serde_v8_value.out @@ -74,14 +74,17 @@ 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 } diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out index 8aa93a37a..623ff1bbb 100644 --- a/ops/optimizer_tests/strings.out +++ b/ops/optimizer_tests/strings.out @@ -75,14 +75,17 @@ 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 } diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out index 06e50ce66..49926c747 100644 --- a/ops/optimizer_tests/uint8array.out +++ b/ops/optimizer_tests/uint8array.out @@ -151,14 +151,17 @@ 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 } diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out index 082d29a45..0a66f4fe6 100644 --- a/ops/optimizer_tests/unit_result.out +++ b/ops/optimizer_tests/unit_result.out @@ -74,14 +74,17 @@ 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 } diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out index 6f5a5915d..045f022fa 100644 --- a/ops/optimizer_tests/unit_result2.out +++ b/ops/optimizer_tests/unit_result2.out @@ -107,14 +107,17 @@ 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 } diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out index 3924beb53..a3a0d5ea9 100644 --- a/ops/optimizer_tests/unit_ret.out +++ b/ops/optimizer_tests/unit_ret.out @@ -63,14 +63,17 @@ 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 } diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out index 219537f60..835926292 100644 --- a/ops/optimizer_tests/wasm_op.out +++ b/ops/optimizer_tests/wasm_op.out @@ -50,14 +50,17 @@ 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 } |