mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
perf: const
op declaration (#18288)
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
0cd0a9d5ed
commit
3b65d297c7
41 changed files with 763 additions and 921 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -5270,9 +5270,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "v8"
|
name = "v8"
|
||||||
version = "0.66.0"
|
version = "0.67.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c8ab8597b885c17b3761f6ffc29b7a62758612c409285a9271c6dacd17bb745"
|
checksum = "c7bf30312144d97d3fb61a0c8893eec02f4fa53ec2b691a8d05da9605ab26024"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fslock",
|
"fslock",
|
||||||
|
|
|
@ -43,7 +43,7 @@ license = "MIT"
|
||||||
repository = "https://github.com/denoland/deno"
|
repository = "https://github.com/denoland/deno"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
v8 = { version = "0.66.0", default-features = false }
|
v8 = { version = "0.67.0", default-features = false }
|
||||||
deno_ast = { version = "0.25.0", features = ["transpiling"] }
|
deno_ast = { version = "0.25.0", features = ["transpiling"] }
|
||||||
|
|
||||||
deno_core = { version = "0.177.0", path = "./core" }
|
deno_core = { version = "0.177.0", path = "./core" }
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub(crate) fn external_references(ops: &[OpCtx]) -> v8::ExternalReferences {
|
||||||
});
|
});
|
||||||
if let Some(fast_fn) = &ctx.decl.fast_fn {
|
if let Some(fast_fn) = &ctx.decl.fast_fn {
|
||||||
references.push(v8::ExternalReference {
|
references.push(v8::ExternalReference {
|
||||||
pointer: fast_fn.function() as _,
|
pointer: fast_fn.function as _,
|
||||||
});
|
});
|
||||||
references.push(v8::ExternalReference {
|
references.push(v8::ExternalReference {
|
||||||
pointer: ctx.fast_fn_c_info.unwrap().as_ptr() as _,
|
pointer: ctx.fast_fn_c_info.unwrap().as_ptr() as _,
|
||||||
|
@ -218,7 +218,7 @@ fn add_op_to_deno_core_ops(
|
||||||
let templ = if let Some(fast_function) = &op_ctx.decl.fast_fn {
|
let templ = if let Some(fast_function) = &op_ctx.decl.fast_fn {
|
||||||
builder.build_fast(
|
builder.build_fast(
|
||||||
scope,
|
scope,
|
||||||
&**fast_function,
|
fast_function,
|
||||||
Some(op_ctx.fast_fn_c_info.unwrap().as_ptr()),
|
Some(op_ctx.fast_fn_c_info.unwrap().as_ptr()),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -72,8 +72,8 @@ pub struct OpDecl {
|
||||||
pub is_async: bool,
|
pub is_async: bool,
|
||||||
pub is_unstable: bool,
|
pub is_unstable: bool,
|
||||||
pub is_v8: bool,
|
pub is_v8: bool,
|
||||||
pub fast_fn: Option<Box<dyn FastFunction>>,
|
|
||||||
pub force_registration: bool,
|
pub force_registration: bool,
|
||||||
|
pub fast_fn: Option<FastFunction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OpDecl {
|
impl OpDecl {
|
||||||
|
|
|
@ -175,13 +175,13 @@ impl OpCtx {
|
||||||
let mut fast_fn_c_info = None;
|
let mut fast_fn_c_info = None;
|
||||||
|
|
||||||
if let Some(fast_fn) = &decl.fast_fn {
|
if let Some(fast_fn) = &decl.fast_fn {
|
||||||
let args = CTypeInfo::new_from_slice(fast_fn.args());
|
let args = CTypeInfo::new_from_slice(fast_fn.args);
|
||||||
let ret = CTypeInfo::new(fast_fn.return_type());
|
let ret = CTypeInfo::new(fast_fn.return_type);
|
||||||
|
|
||||||
// SAFETY: all arguments are coming from the trait and they have
|
// SAFETY: all arguments are coming from the trait and they have
|
||||||
// static lifetime
|
// static lifetime
|
||||||
let c_fn = unsafe {
|
let c_fn = unsafe {
|
||||||
CFunctionInfo::new(args.as_ptr(), fast_fn.args().len(), ret.as_ptr())
|
CFunctionInfo::new(args.as_ptr(), fast_fn.args.len(), ret.as_ptr())
|
||||||
};
|
};
|
||||||
fast_fn_c_info = Some(c_fn);
|
fast_fn_c_info = Some(c_fn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,8 +793,8 @@ impl JsRuntime {
|
||||||
true => op,
|
true => op,
|
||||||
false => OpDecl {
|
false => OpDecl {
|
||||||
v8_fn_ptr: match op.is_async {
|
v8_fn_ptr: match op.is_async {
|
||||||
true => op_void_async::v8_fn_ptr(),
|
true => op_void_async::v8_fn_ptr as _,
|
||||||
false => op_void_sync::v8_fn_ptr(),
|
false => op_void_sync::v8_fn_ptr as _,
|
||||||
},
|
},
|
||||||
..op
|
..op
|
||||||
},
|
},
|
||||||
|
|
|
@ -40,26 +40,29 @@ pub(crate) fn compile_trampoline(sym: &Symbol) -> Trampoline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn make_template(sym: &Symbol, trampoline: &Trampoline) -> Template {
|
pub(crate) fn make_template(
|
||||||
|
sym: &Symbol,
|
||||||
|
trampoline: &Trampoline,
|
||||||
|
) -> fast_api::FastFunction {
|
||||||
let mut params = once(fast_api::Type::V8Value) // Receiver
|
let mut params = once(fast_api::Type::V8Value) // Receiver
|
||||||
.chain(sym.parameter_types.iter().map(|t| t.into()))
|
.chain(sym.parameter_types.iter().map(|t| t.into()))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let ret = if needs_unwrap(&sym.result_type) {
|
let ret = if needs_unwrap(&sym.result_type) {
|
||||||
params.push(fast_api::Type::TypedArray(fast_api::CType::Int32));
|
params.push(fast_api::Type::TypedArray(fast_api::CType::Int32));
|
||||||
fast_api::Type::Void
|
fast_api::CType::Void
|
||||||
} else if sym.result_type == NativeType::Buffer {
|
} else if sym.result_type == NativeType::Buffer {
|
||||||
// Buffer can be used as a return type and converts differently than in parameters.
|
// Buffer can be used as a return type and converts differently than in parameters.
|
||||||
fast_api::Type::Pointer
|
fast_api::CType::Pointer
|
||||||
} else {
|
} else {
|
||||||
fast_api::Type::from(&sym.result_type)
|
fast_api::CType::from(&fast_api::Type::from(&sym.result_type))
|
||||||
};
|
};
|
||||||
|
|
||||||
Template {
|
fast_api::FastFunction::new(
|
||||||
args: params.into_boxed_slice(),
|
Box::leak(params.into_boxed_slice()),
|
||||||
ret: (&ret).into(),
|
ret,
|
||||||
symbol_ptr: trampoline.ptr(),
|
trampoline.ptr(),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trampoline for fast-call FFI functions
|
/// Trampoline for fast-call FFI functions
|
||||||
|
@ -73,26 +76,6 @@ impl Trampoline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct Template {
|
|
||||||
pub args: Box<[fast_api::Type]>,
|
|
||||||
pub ret: fast_api::CType,
|
|
||||||
pub symbol_ptr: *const c_void,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fast_api::FastFunction for Template {
|
|
||||||
fn function(&self) -> *const c_void {
|
|
||||||
self.symbol_ptr
|
|
||||||
}
|
|
||||||
|
|
||||||
fn args(&self) -> &'static [fast_api::Type] {
|
|
||||||
Box::leak(self.args.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn return_type(&self) -> fast_api::CType {
|
|
||||||
self.ret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&NativeType> for fast_api::Type {
|
impl From<&NativeType> for fast_api::Type {
|
||||||
fn from(native_type: &NativeType) -> Self {
|
fn from(native_type: &NativeType) -> Self {
|
||||||
match native_type {
|
match native_type {
|
||||||
|
|
|
@ -316,26 +316,16 @@ async fn op_flash_write_resource(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RespondFast;
|
pub const RESPOND_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
|
||||||
|
&[
|
||||||
impl fast_api::FastFunction for RespondFast {
|
fast_api::Type::V8Value,
|
||||||
fn function(&self) -> *const c_void {
|
fast_api::Type::Uint32,
|
||||||
op_flash_respond_fast as *const c_void
|
fast_api::Type::TypedArray(fast_api::CType::Uint8),
|
||||||
}
|
fast_api::Type::Bool,
|
||||||
|
],
|
||||||
fn args(&self) -> &'static [fast_api::Type] {
|
fast_api::CType::Uint32,
|
||||||
&[
|
op_flash_respond_fast as *const c_void,
|
||||||
fast_api::Type::V8Value,
|
);
|
||||||
fast_api::Type::Uint32,
|
|
||||||
fast_api::Type::TypedArray(fast_api::CType::Uint8),
|
|
||||||
fast_api::Type::Bool,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn return_type(&self) -> fast_api::CType {
|
|
||||||
fast_api::CType::Uint32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flash_respond(
|
fn flash_respond(
|
||||||
ctx: &mut ServerContext,
|
ctx: &mut ServerContext,
|
||||||
|
@ -468,21 +458,11 @@ fn next_request_sync(ctx: &mut ServerContext) -> u32 {
|
||||||
ctx.next_token - offset
|
ctx.next_token - offset
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct NextRequestFast;
|
const NEXT_REQUEST_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
|
||||||
|
&[fast_api::Type::V8Value],
|
||||||
impl fast_api::FastFunction for NextRequestFast {
|
fast_api::CType::Uint32,
|
||||||
fn function(&self) -> *const c_void {
|
op_flash_next_fast as *const c_void,
|
||||||
op_flash_next_fast as *const c_void
|
);
|
||||||
}
|
|
||||||
|
|
||||||
fn args(&self) -> &'static [fast_api::Type] {
|
|
||||||
&[fast_api::Type::V8Value]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn return_type(&self) -> fast_api::CType {
|
|
||||||
fast_api::CType::Uint32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
|
unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
|
||||||
let ptr =
|
let ptr =
|
||||||
|
@ -491,21 +471,11 @@ unsafe fn op_flash_next_fast(recv: v8::Local<v8::Object>) -> u32 {
|
||||||
next_request_sync(ctx)
|
next_request_sync(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct GetMethodFast;
|
const GET_METHOD_FAST: fast_api::FastFunction = fast_api::FastFunction::new(
|
||||||
|
&[fast_api::Type::V8Value, fast_api::Type::Uint32],
|
||||||
impl fast_api::FastFunction for GetMethodFast {
|
fast_api::CType::Uint32,
|
||||||
fn function(&self) -> *const c_void {
|
op_flash_get_method_fast as *const c_void,
|
||||||
op_flash_get_method_fast as *const c_void
|
);
|
||||||
}
|
|
||||||
|
|
||||||
fn args(&self) -> &'static [fast_api::Type] {
|
|
||||||
&[fast_api::Type::V8Value, fast_api::Type::Uint32]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn return_type(&self) -> fast_api::CType {
|
|
||||||
fast_api::CType::Uint32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn op_flash_get_method_fast(
|
unsafe fn op_flash_get_method_fast(
|
||||||
recv: v8::Local<v8::Object>,
|
recv: v8::Local<v8::Object>,
|
||||||
|
@ -549,7 +519,7 @@ fn op_flash_make_request<'scope>(
|
||||||
)
|
)
|
||||||
.data(v8::External::new(scope, ctx as *mut _).into());
|
.data(v8::External::new(scope, ctx as *mut _).into());
|
||||||
|
|
||||||
let func = builder.build_fast(scope, &NextRequestFast, None, None, None);
|
let func = builder.build_fast(scope, &NEXT_REQUEST_FAST, None, None, None);
|
||||||
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
||||||
|
|
||||||
let key = v8::String::new(scope, "nextRequest").unwrap();
|
let key = v8::String::new(scope, "nextRequest").unwrap();
|
||||||
|
@ -572,7 +542,7 @@ fn op_flash_make_request<'scope>(
|
||||||
)
|
)
|
||||||
.data(v8::External::new(scope, ctx as *mut _).into());
|
.data(v8::External::new(scope, ctx as *mut _).into());
|
||||||
|
|
||||||
let func = builder.build_fast(scope, &GetMethodFast, None, None, None);
|
let func = builder.build_fast(scope, &GET_METHOD_FAST, None, None, None);
|
||||||
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
||||||
|
|
||||||
let key = v8::String::new(scope, "getMethod").unwrap();
|
let key = v8::String::new(scope, "getMethod").unwrap();
|
||||||
|
@ -610,7 +580,7 @@ fn op_flash_make_request<'scope>(
|
||||||
)
|
)
|
||||||
.data(v8::External::new(scope, ctx as *mut _).into());
|
.data(v8::External::new(scope, ctx as *mut _).into());
|
||||||
|
|
||||||
let func = builder.build_fast(scope, &RespondFast, None, None, None);
|
let func = builder.build_fast(scope, &RESPOND_FAST, None, None, None);
|
||||||
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
let func: v8::Local<v8::Value> = func.get_function(scope).unwrap().into();
|
||||||
|
|
||||||
let key = v8::String::new(scope, "respond").unwrap();
|
let key = v8::String::new(scope, "respond").unwrap();
|
||||||
|
|
125
ops/fast_call.rs
125
ops/fast_call.rs
|
@ -14,12 +14,6 @@ use syn::GenericParam;
|
||||||
use syn::Generics;
|
use syn::Generics;
|
||||||
use syn::Ident;
|
use syn::Ident;
|
||||||
use syn::ItemFn;
|
use syn::ItemFn;
|
||||||
use syn::ItemImpl;
|
|
||||||
use syn::Path;
|
|
||||||
use syn::PathArguments;
|
|
||||||
use syn::PathSegment;
|
|
||||||
use syn::Type;
|
|
||||||
use syn::TypePath;
|
|
||||||
|
|
||||||
use crate::optimizer::FastValue;
|
use crate::optimizer::FastValue;
|
||||||
use crate::optimizer::Optimizer;
|
use crate::optimizer::Optimizer;
|
||||||
|
@ -62,13 +56,11 @@ pub(crate) fn generate(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// We've got 3 idents.
|
// We've got 2 idents.
|
||||||
//
|
//
|
||||||
// - op_foo, the public op declaration contains the user function.
|
// - op_foo, the public op declaration contains the user function.
|
||||||
// - op_foo_fast, the fast call type.
|
|
||||||
// - op_foo_fast_fn, the fast call function.
|
// - op_foo_fast_fn, the fast call function.
|
||||||
let ident = item_fn.sig.ident.clone();
|
let ident = item_fn.sig.ident.clone();
|
||||||
let fast_ident = Ident::new(&format!("{ident}_fast"), Span::call_site());
|
|
||||||
let fast_fn_ident =
|
let fast_fn_ident =
|
||||||
Ident::new(&format!("{ident}_fast_fn"), Span::call_site());
|
Ident::new(&format!("{ident}_fast_fn"), Span::call_site());
|
||||||
|
|
||||||
|
@ -78,11 +70,6 @@ pub(crate) fn generate(
|
||||||
|
|
||||||
// struct op_foo_fast <T, U> { ... }
|
// struct op_foo_fast <T, U> { ... }
|
||||||
let struct_generics = exclude_lifetime_params(&generics.params);
|
let struct_generics = exclude_lifetime_params(&generics.params);
|
||||||
// std::marker::PhantomData <A>
|
|
||||||
let phantom_generics: Quote = match struct_generics {
|
|
||||||
Some(ref params) => q!(Vars { params }, { params }),
|
|
||||||
None => q!({ <()> }),
|
|
||||||
};
|
|
||||||
// op_foo_fast_fn :: <T>
|
// op_foo_fast_fn :: <T>
|
||||||
let caller_generics: Quote = match struct_generics {
|
let caller_generics: Quote = match struct_generics {
|
||||||
Some(ref params) => q!(Vars { params }, { ::params }),
|
Some(ref params) => q!(Vars { params }, { ::params }),
|
||||||
|
@ -90,28 +77,19 @@ pub(crate) fn generate(
|
||||||
};
|
};
|
||||||
|
|
||||||
// This goes in the FastFunction impl block.
|
// This goes in the FastFunction impl block.
|
||||||
let mut segments = Punctuated::new();
|
// let mut segments = Punctuated::new();
|
||||||
{
|
// {
|
||||||
let mut arguments = PathArguments::None;
|
// let mut arguments = PathArguments::None;
|
||||||
if let Some(ref struct_generics) = struct_generics {
|
// if let Some(ref struct_generics) = struct_generics {
|
||||||
arguments = PathArguments::AngleBracketed(parse_quote! {
|
// arguments = PathArguments::AngleBracketed(parse_quote! {
|
||||||
#struct_generics
|
// #struct_generics
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
segments.push_value(PathSegment {
|
// segments.push_value(PathSegment {
|
||||||
ident: fast_ident.clone(),
|
// ident: fast_ident.clone(),
|
||||||
arguments,
|
// arguments,
|
||||||
});
|
// });
|
||||||
}
|
|
||||||
|
|
||||||
// struct T <A> {
|
|
||||||
// _phantom: ::std::marker::PhantomData<A>,
|
|
||||||
// }
|
// }
|
||||||
let fast_ty: Quote = q!(Vars { Type: &fast_ident, generics: &struct_generics, phantom_generics }, {
|
|
||||||
struct Type generics {
|
|
||||||
_phantom: ::std::marker::PhantomData phantom_generics,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Original inputs.
|
// Original inputs.
|
||||||
let mut inputs = item_fn.sig.inputs.clone();
|
let mut inputs = item_fn.sig.inputs.clone();
|
||||||
|
@ -345,73 +323,22 @@ pub(crate) fn generate(
|
||||||
let mut generics: Generics = parse_quote! { #impl_generics };
|
let mut generics: Generics = parse_quote! { #impl_generics };
|
||||||
generics.where_clause = where_clause.cloned();
|
generics.where_clause = where_clause.cloned();
|
||||||
|
|
||||||
// impl <A> fast_api::FastFunction for T <A> where A: B {
|
// fast_api::FastFunction::new(&[ CType::T, CType::U ], CType::T, f::<P> as *const ::std::ffi::c_void)
|
||||||
// fn function(&self) -> *const ::std::ffi::c_void {
|
|
||||||
// f as *const ::std::ffi::c_void
|
|
||||||
// }
|
|
||||||
// fn args(&self) -> &'static [fast_api::Type] {
|
|
||||||
// &[ CType::T, CType::U ]
|
|
||||||
// }
|
|
||||||
// fn return_type(&self) -> fast_api::CType {
|
|
||||||
// CType::T
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
let item: ItemImpl = ItemImpl {
|
|
||||||
attrs: vec![],
|
|
||||||
defaultness: None,
|
|
||||||
unsafety: None,
|
|
||||||
impl_token: Default::default(),
|
|
||||||
generics,
|
|
||||||
trait_: Some((
|
|
||||||
None,
|
|
||||||
parse_quote!(#core::v8::fast_api::FastFunction),
|
|
||||||
Default::default(),
|
|
||||||
)),
|
|
||||||
self_ty: Box::new(Type::Path(TypePath {
|
|
||||||
qself: None,
|
|
||||||
path: Path {
|
|
||||||
leading_colon: None,
|
|
||||||
segments,
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
brace_token: Default::default(),
|
|
||||||
items: vec![
|
|
||||||
parse_quote! {
|
|
||||||
#[inline(always)]
|
|
||||||
fn function(&self) -> *const ::std::ffi::c_void {
|
|
||||||
#fast_fn_ident #caller_generics as *const ::std::ffi::c_void
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parse_quote! {
|
|
||||||
#[inline(always)]
|
|
||||||
fn args(&self) -> &'static [#core::v8::fast_api::Type] {
|
|
||||||
use #core::v8::fast_api::Type::*;
|
|
||||||
use #core::v8::fast_api::CType;
|
|
||||||
&[ #input_variants ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parse_quote! {
|
|
||||||
#[inline(always)]
|
|
||||||
fn return_type(&self) -> #core::v8::fast_api::CType {
|
|
||||||
#core::v8::fast_api::CType::#output_variant
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut tts = q!({});
|
|
||||||
tts.push_tokens(&fast_ty);
|
|
||||||
tts.push_tokens(&item);
|
|
||||||
tts.push_tokens(&fast_fn);
|
|
||||||
|
|
||||||
let impl_and_fn = tts.dump();
|
|
||||||
let decl = q!(
|
let decl = q!(
|
||||||
Vars { fast_ident, caller_generics },
|
Vars { core: core, fast_fn_ident: fast_fn_ident, generics: caller_generics, inputs: input_variants, output: output_variant },
|
||||||
{
|
{{
|
||||||
Some(Box::new(fast_ident caller_generics { _phantom: ::std::marker::PhantomData }))
|
use core::v8::fast_api::Type::*;
|
||||||
}
|
use core::v8::fast_api::CType;
|
||||||
|
Some(core::v8::fast_api::FastFunction::new(
|
||||||
|
&[ inputs ],
|
||||||
|
CType :: output,
|
||||||
|
fast_fn_ident generics as *const ::std::ffi::c_void
|
||||||
|
))
|
||||||
|
}}
|
||||||
).dump();
|
).dump();
|
||||||
|
|
||||||
|
let impl_and_fn = fast_fn.dump();
|
||||||
|
|
||||||
FastImplItems {
|
FastImplItems {
|
||||||
impl_and_fn,
|
impl_and_fn,
|
||||||
decl,
|
decl,
|
||||||
|
|
16
ops/lib.rs
16
ops/lib.rs
|
@ -184,19 +184,23 @@ impl Op {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl #name {
|
impl #name {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(#name)
|
stringify!(#name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use #core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr #generics (info: *const #core::v8::FunctionCallbackInfo) #where_clause {
|
||||||
Self::v8_func::<#type_params>.map_fn_to()
|
let info = unsafe { &*info };
|
||||||
|
let scope = &mut unsafe { #core::v8::CallbackScope::new(info) };
|
||||||
|
let args = #core::v8::FunctionCallbackArguments::from_function_callback_info(info);
|
||||||
|
let rv = #core::v8::ReturnValue::from_function_callback_info(info);
|
||||||
|
Self::v8_func::<#type_params>(scope, args, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decl #generics () -> #core::OpDecl #where_clause {
|
pub const fn decl #generics () -> #core::OpDecl #where_clause {
|
||||||
#core::OpDecl {
|
#core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
|
v8_fn_ptr: Self::v8_fn_ptr::<#type_params> as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: #decl,
|
fast_fn: #decl,
|
||||||
is_async: #is_async,
|
is_async: #is_async,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_void_async;
|
pub struct op_void_async;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_void_async {
|
impl op_void_async {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_void_async)
|
stringify!(op_void_async)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_void_async_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: true,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_void_async_fast_fn<'scope>(
|
fn op_void_async_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_async_result;
|
pub struct op_async_result;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_async_result {
|
impl op_async_result {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_async_result)
|
stringify!(op_async_result)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_async_result_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: true,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_async_result_fast_fn<'scope>(
|
fn op_async_result_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_fallback;
|
pub struct op_fallback;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_fallback {
|
impl op_fallback {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_fallback)
|
stringify!(op_fallback)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_fallback_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -51,25 +65,6 @@ impl op_fallback {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_fallback_fast_fn<'scope>(
|
fn op_fallback_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_cow_str;
|
pub struct op_cow_str;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_cow_str {
|
impl op_cow_str {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_cow_str)
|
stringify!(op_cow_str)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_cow_str_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -59,25 +73,6 @@ impl op_cow_str {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_cow_str_fast_fn<'scope>(
|
fn op_cow_str_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_f64_buf;
|
pub struct op_f64_buf;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_f64_buf {
|
impl op_f64_buf {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_f64_buf)
|
stringify!(op_f64_buf)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_f64_buf_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -77,25 +91,6 @@ impl op_f64_buf {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_f64_buf_fast_fn<'scope>(
|
fn op_f64_buf_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_sync_serialize_object_with_numbers_as_keys;
|
pub struct op_sync_serialize_object_with_numbers_as_keys;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_sync_serialize_object_with_numbers_as_keys {
|
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)
|
stringify!(op_sync_serialize_object_with_numbers_as_keys)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct send_stdin;
|
pub struct send_stdin;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl send_stdin {
|
impl send_stdin {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(send_stdin)
|
stringify!(send_stdin)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: true,
|
is_async: true,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct send_stdin;
|
pub struct send_stdin;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl send_stdin {
|
impl send_stdin {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(send_stdin)
|
stringify!(send_stdin)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: true,
|
is_async: true,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_blob_revoke_object_url;
|
pub struct op_blob_revoke_object_url;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_blob_revoke_object_url {
|
impl op_blob_revoke_object_url {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_blob_revoke_object_url)
|
stringify!(op_blob_revoke_object_url)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_ffi_ptr_value;
|
pub struct op_ffi_ptr_value;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_ffi_ptr_value {
|
impl op_ffi_ptr_value {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_ffi_ptr_value)
|
stringify!(op_ffi_ptr_value)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_ffi_ptr_value_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -91,25 +105,6 @@ impl op_ffi_ptr_value {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_ffi_ptr_value_fast_fn<'scope>(
|
fn op_ffi_ptr_value_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_print;
|
pub struct op_print;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_print {
|
impl op_print {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_print)
|
stringify!(op_print)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_set_exit_code;
|
pub struct op_set_exit_code;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_set_exit_code {
|
impl op_set_exit_code {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_set_exit_code)
|
stringify!(op_set_exit_code)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_set_exit_code_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -59,25 +73,6 @@ impl op_set_exit_code {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_set_exit_code_fast_fn<'scope>(
|
fn op_set_exit_code_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct foo;
|
pub struct foo;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl foo {
|
impl foo {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(foo)
|
stringify!(foo)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(foo_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn foo_fast_fn<'scope>(
|
fn foo_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,29 +6,43 @@
|
||||||
pub struct op_foo;
|
pub struct op_foo;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_foo {
|
impl op_foo {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_foo)
|
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
|
where
|
||||||
SP: SomePermission + 'static,
|
SP: SomePermission + 'static,
|
||||||
{
|
{
|
||||||
use deno_core::v8::MapFnTo;
|
let info = unsafe { &*info };
|
||||||
Self::v8_func::<SP>.map_fn_to()
|
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
|
where
|
||||||
SP: SomePermission + 'static,
|
SP: SomePermission + 'static,
|
||||||
{
|
{
|
||||||
deno_core::OpDecl {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr::<SP>(),
|
v8_fn_ptr: Self::v8_fn_ptr::<SP> as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_foo_fast::<SP> {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -58,28 +72,6 @@ impl op_foo {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_foo_fast_fn<'scope, SP>(
|
fn op_foo_fast_fn<'scope, SP>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct foo;
|
pub struct foo;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl foo {
|
impl foo {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(foo)
|
stringify!(foo)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(foo_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn foo_fast_fn<'scope>(
|
fn foo_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_listen;
|
pub struct op_listen;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_listen {
|
impl op_listen {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_listen)
|
stringify!(op_listen)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_listen_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_listen_fast_fn<'scope>(
|
fn op_listen_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,29 +6,43 @@
|
||||||
pub struct op_now;
|
pub struct op_now;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_now {
|
impl op_now {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_now)
|
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
|
where
|
||||||
TP: TimersPermission + 'static,
|
TP: TimersPermission + 'static,
|
||||||
{
|
{
|
||||||
use deno_core::v8::MapFnTo;
|
let info = unsafe { &*info };
|
||||||
Self::v8_func::<TP>.map_fn_to()
|
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
|
where
|
||||||
TP: TimersPermission + 'static,
|
TP: TimersPermission + 'static,
|
||||||
{
|
{
|
||||||
deno_core::OpDecl {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr::<TP>(),
|
v8_fn_ptr: Self::v8_fn_ptr::<TP> as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_now_fast::<TP> {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -105,28 +119,6 @@ impl op_now {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_now_fast_fn<'scope, TP>(
|
fn op_now_fast_fn<'scope, TP>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_add_4;
|
pub struct op_add_4;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_add_4 {
|
impl op_add_4 {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_add_4)
|
stringify!(op_add_4)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_add_4_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_add_4_fast_fn<'scope>(
|
fn op_add_4_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_try_close;
|
pub struct op_try_close;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_try_close {
|
impl op_try_close {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_try_close)
|
stringify!(op_try_close)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_string_length;
|
pub struct op_string_length;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_string_length {
|
impl op_string_length {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_string_length)
|
stringify!(op_string_length)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_string_length_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_string_length_fast_fn<'scope>(
|
fn op_string_length_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_read_sync;
|
pub struct op_read_sync;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_read_sync {
|
impl op_read_sync {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_read_sync)
|
stringify!(op_read_sync)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,29 +6,48 @@
|
||||||
pub struct op_ffi_ptr_of;
|
pub struct op_ffi_ptr_of;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_ffi_ptr_of {
|
impl op_ffi_ptr_of {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_ffi_ptr_of)
|
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
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
use deno_core::v8::MapFnTo;
|
let info = unsafe { &*info };
|
||||||
Self::v8_func::<FP>.map_fn_to()
|
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
|
where
|
||||||
FP: FfiPermissions + 'static,
|
FP: FfiPermissions + 'static,
|
||||||
{
|
{
|
||||||
deno_core::OpDecl {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr::<FP>(),
|
v8_fn_ptr: Self::v8_fn_ptr::<FP> as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_ffi_ptr_of_fast::<FP> {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -131,28 +150,6 @@ impl op_ffi_ptr_of {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_ffi_ptr_of_fast_fn<'scope, FP>(
|
fn op_ffi_ptr_of_fast_fn<'scope, FP>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_is_proxy;
|
pub struct op_is_proxy;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_is_proxy {
|
impl op_is_proxy {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_is_proxy)
|
stringify!(op_is_proxy)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_is_proxy_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_is_proxy_fast_fn<'scope>(
|
fn op_is_proxy_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_string_length;
|
pub struct op_string_length;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_string_length {
|
impl op_string_length {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_string_length)
|
stringify!(op_string_length)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_string_length_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_string_length_fast_fn<'scope>(
|
fn op_string_length_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_string_length;
|
pub struct op_string_length;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_string_length {
|
impl op_string_length {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_string_length)
|
stringify!(op_string_length)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
pub struct op_bench_now;
|
pub struct op_bench_now;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_bench_now {
|
impl op_bench_now {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_bench_now)
|
stringify!(op_bench_now)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: None,
|
fast_fn: None,
|
||||||
is_async: false,
|
is_async: false,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_import_spki_x25519;
|
pub struct op_import_spki_x25519;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_import_spki_x25519 {
|
impl op_import_spki_x25519 {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_import_spki_x25519)
|
stringify!(op_import_spki_x25519)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_import_spki_x25519_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_import_spki_x25519_fast_fn<'scope>(
|
fn op_import_spki_x25519_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_unit_result;
|
pub struct op_unit_result;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_unit_result {
|
impl op_unit_result {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_unit_result)
|
stringify!(op_unit_result)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_unit_result_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_unit_result_fast_fn<'scope>(
|
fn op_unit_result_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_set_nodelay;
|
pub struct op_set_nodelay;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_set_nodelay {
|
impl op_set_nodelay {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_set_nodelay)
|
stringify!(op_set_nodelay)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_set_nodelay_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_set_nodelay_fast_fn<'scope>(
|
fn op_set_nodelay_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_unit;
|
pub struct op_unit;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_unit {
|
impl op_unit {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_unit)
|
stringify!(op_unit)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_unit_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: 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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_unit_fast_fn<'scope>(_: deno_core::v8::Local<deno_core::v8::Object>) -> () {
|
fn op_unit_fast_fn<'scope>(_: deno_core::v8::Local<deno_core::v8::Object>) -> () {
|
||||||
use deno_core::v8;
|
use deno_core::v8;
|
||||||
|
|
|
@ -6,23 +6,37 @@
|
||||||
pub struct op_wasm;
|
pub struct op_wasm;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl op_wasm {
|
impl op_wasm {
|
||||||
pub fn name() -> &'static str {
|
pub const fn name() -> &'static str {
|
||||||
stringify!(op_wasm)
|
stringify!(op_wasm)
|
||||||
}
|
}
|
||||||
pub fn v8_fn_ptr<'scope>() -> deno_core::v8::FunctionCallback {
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
use deno_core::v8::MapFnTo;
|
pub extern "C" fn v8_fn_ptr<'scope>(
|
||||||
Self::v8_func.map_fn_to()
|
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 {
|
deno_core::OpDecl {
|
||||||
name: Self::name(),
|
name: Self::name(),
|
||||||
v8_fn_ptr: Self::v8_fn_ptr(),
|
v8_fn_ptr: Self::v8_fn_ptr as _,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
fast_fn: Some(
|
fast_fn: {
|
||||||
Box::new(op_wasm_fast {
|
use deno_core::v8::fast_api::Type::*;
|
||||||
_phantom: ::std::marker::PhantomData,
|
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_async: false,
|
||||||
is_unstable: false,
|
is_unstable: false,
|
||||||
is_v8: false,
|
is_v8: false,
|
||||||
|
@ -47,25 +61,6 @@ impl op_wasm {
|
||||||
op_state.tracker.track_sync(ctx.id);
|
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)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn op_wasm_fast_fn<'scope>(
|
fn op_wasm_fast_fn<'scope>(
|
||||||
_: deno_core::v8::Local<deno_core::v8::Object>,
|
_: deno_core::v8::Local<deno_core::v8::Object>,
|
||||||
|
|
Loading…
Add table
Reference in a new issue