perf(ext/ffi): Fast UnsafePointerView read functions (#16351)

This PR makes pointer read methods of `Deno.UnsafePointerView` Fast API
compliant, with the exception of `getCString` which cannot be made fast
with current V8 Fast API.
This commit is contained in:
Aapo Alasuutari 2022-10-20 07:05:56 +03:00 committed by GitHub
parent 973069b341
commit 722ea20e86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 330 additions and 127 deletions

View file

@ -774,6 +774,35 @@ fn is_fast_scalar(
match tokens(&ty).as_str() {
"u32" => Some(quote! { #core::v8::fast_api::#cty::Uint32 }),
"i32" => Some(quote! { #core::v8::fast_api::#cty::Int32 }),
"u64" => {
if is_ret {
None
} else {
Some(quote! { #core::v8::fast_api::#cty::Uint64 })
}
}
"i64" => {
if is_ret {
None
} else {
Some(quote! { #core::v8::fast_api::#cty::Int64 })
}
}
// TODO(@aapoalas): Support 32 bit machines
"usize" => {
if is_ret {
None
} else {
Some(quote! { #core::v8::fast_api::#cty::Uint64 })
}
}
"isize" => {
if is_ret {
None
} else {
Some(quote! { #core::v8::fast_api::#cty::Int64 })
}
}
"f32" => Some(quote! { #core::v8::fast_api::#cty::Float32 }),
"f64" => Some(quote! { #core::v8::fast_api::#cty::Float64 }),
"bool" => Some(quote! { #core::v8::fast_api::#cty::Bool }),