1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore(ops): inline FastFunction trait methods (#18226)

This commit is contained in:
Divy Srivastava 2023-03-16 18:50:41 +05:30 committed by GitHub
parent 33b85a2b8e
commit eb3d79ab1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 69 additions and 0 deletions

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}