/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/ops/op2/test_cases/sync/string_ref.out
165 строк
7 KB
Nathan Whitaker
fix(core): root slow op string coercions (#36018)
14 июл 2026, 22:06
Не верифицирован
14 июл 2026, 22:06
5154d79
Код
Авторство
О чём код?
#[allow(non_camel_case_types)] const fn op_string_owned() -> ::deno_core::_ops::OpDecl { #[allow(non_camel_case_types)] struct op_string_owned { _unconstructable: ::std::marker::PhantomData<()>, } impl ::deno_core::_ops::Op for op_string_owned { const NAME: &'static str = stringify!(op_string_owned); const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( ::deno_core::__op_name_fast!(op_string_owned), 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_owned { 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 mut arg0_temp: [::std::mem::MaybeUninit< u8, >; deno_core::_ops::STRING_STACK_BUFFER_SIZE] = [::std::mem::MaybeUninit::uninit(); deno_core::_ops::STRING_STACK_BUFFER_SIZE]; let arg0 = &deno_core::_ops::to_str_ptr( unsafe { &mut *arg0 }, &mut arg0_temp, ); 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 scope = ::std::pin::pin!( unsafe { deno_core::v8::CallbackScope::new(info) } ); let mut scope = scope.init(); let mut rv = parts.return_value; let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info_parts( info, &parts, ); let result = { let arg0 = args.get(0usize as i32); let mut arg0_temp: [::std::mem::MaybeUninit< u8, >; deno_core::_ops::STRING_STACK_BUFFER_SIZE] = [::std::mem::MaybeUninit::uninit(); deno_core::_ops::STRING_STACK_BUFFER_SIZE]; let arg0 = if !arg0.is_string() { let tc = ::std::pin::pin!(deno_core::v8::TryCatch::new(& mut scope)); let mut tc = tc.init(); match arg0.to_string(&mut tc) { Some(v) => v.into(), None => { tc.rethrow(); return 1; } } } else { arg0 }; let arg0 = &deno_core::_ops::to_str(&mut scope, &arg0, &mut arg0_temp); 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_owned { #[allow(clippy::too_many_arguments)] fn call(s: &str) -> u32 { s.len() as _ } } <op_string_owned as ::deno_core::_ops::Op>::DECL }