/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/ops/op2/test_cases/sync/string_onebyte.out
155 строк
6 KB
Nathan Whitaker
perf(core): reduce native callback snapshot overhead (#35121)
11 июн 2026, 07:21
Не верифицирован
11 июн 2026, 07:21
1eebdde
Код
Авторство
О чём код?
#[allow(non_camel_case_types)] const fn op_string_onebyte() -> ::deno_core::_ops::OpDecl { #[allow(non_camel_case_types)] struct op_string_onebyte { _unconstructable: ::std::marker::PhantomData<()>, } impl ::deno_core::_ops::Op for op_string_onebyte { const NAME: &'static str = stringify!(op_string_onebyte); const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( ::deno_core::__op_name_fast!(op_string_onebyte), false, false, false, 1usize as u8, false, false, Self::v8_fn_ptr as _, Self::slow_function_impl, ::deno_core::AccessorType::None, Some({ use deno_core::v8::fast_api::Type as CType; use deno_core::v8; deno_core::v8::fast_api::CFunction::new( Self::v8_fn_ptr_fast as _, &deno_core::v8::fast_api::CFunctionInfo::new( v8::fast_api::CTypeInfo::new( CType::Uint32, v8::fast_api::Flags::empty(), ), &[CType::V8Value.as_info(), CType::SeqOneByteString.as_info()], deno_core::v8::fast_api::Int64Representation::BigInt, ), ) }), Some({ use deno_core::v8::fast_api::Type as CType; use deno_core::v8; deno_core::v8::fast_api::CFunction::new( Self::v8_fn_ptr_fast_metrics as _, &deno_core::v8::fast_api::CFunctionInfo::new( v8::fast_api::CTypeInfo::new( CType::Uint32, v8::fast_api::Flags::empty(), ), &[ CType::V8Value.as_info(), CType::SeqOneByteString.as_info(), CType::CallbackOptions.as_info(), ], deno_core::v8::fast_api::Int64Representation::BigInt, ), ) }), ::deno_core::OpMetadata { ..::deno_core::OpMetadata::default() }, ); } impl op_string_onebyte { pub const fn name() -> &'static str { <Self as deno_core::_ops::Op>::NAME } #[allow(clippy::too_many_arguments)] extern "C" fn v8_fn_ptr_fast_metrics<'s>( this: deno_core::v8::Local<deno_core::v8::Object>, arg0: *mut deno_core::v8::fast_api::FastApiOneByteString, fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions< 's, >, ) -> u32 { let fast_api_callback_options: &'s mut _ = unsafe { &mut *fast_api_callback_options }; let opctx: &'s _ = unsafe { &*(deno_core::v8::Local::< deno_core::v8::External, >::cast_unchecked(unsafe { fast_api_callback_options.data }) .value() as *const deno_core::_ops::OpCtx) }; deno_core::_ops::dispatch_metrics_fast( opctx, deno_core::_ops::OpMetricsEvent::Dispatched, ); let res = Self::v8_fn_ptr_fast(this, arg0); deno_core::_ops::dispatch_metrics_fast( opctx, deno_core::_ops::OpMetricsEvent::Completed, ); res } #[allow(clippy::too_many_arguments)] extern "C" fn v8_fn_ptr_fast<'s>( this: deno_core::v8::Local<deno_core::v8::Object>, arg0: *mut deno_core::v8::fast_api::FastApiOneByteString, ) -> u32 { #[cfg(debug_assertions)] let _reentrancy_check_guard = deno_core::_ops::reentrancy_check( &<Self as deno_core::_ops::Op>::DECL, ); let result = { let arg0 = deno_core::_ops::to_cow_byte_ptr(unsafe { &mut *arg0 }); Self::call(arg0) }; result as _ } fn slow_function_impl<'s>( info: *const deno_core::v8::FunctionCallbackInfo, ) -> usize { let info: &'s _ = unsafe { &*info }; #[cfg(debug_assertions)] let _reentrancy_check_guard = deno_core::_ops::reentrancy_check( &<Self as deno_core::_ops::Op>::DECL, ); let parts: deno_core::v8::FunctionCallbackInfoParts<'s> = info.get_parts(); let mut rv = parts.return_value; let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info_parts( info, &parts, ); let opctx: &'s _ = unsafe { &*(deno_core::v8::Local::< deno_core::v8::External, >::cast_unchecked(args.data()) .value() as *const deno_core::_ops::OpCtx) }; let mut scope = unsafe { deno_core::v8::Isolate::from_raw_isolate_ptr(opctx.isolate) }; let mut scope = &mut scope; let result = { let arg0 = args.get(0usize as i32); let arg0 = match deno_core::_ops::to_cow_one_byte(&mut scope, &arg0) { Ok(arg0) => arg0, Err(arg0) => { deno_core::_ops::throw_error_one_byte_info(&info, arg0); return 1; } }; Self::call(arg0) }; deno_core::_ops::RustToV8RetVal::to_v8_rv(result, &mut rv); return 0; } extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { Self::slow_function_impl(info); } } impl op_string_onebyte { #[allow(clippy::too_many_arguments)] fn call(s: Cow<[u8]>) -> u32 { s.len() as _ } } <op_string_onebyte as ::deno_core::_ops::Op>::DECL }