mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
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:
parent
973069b341
commit
722ea20e86
15 changed files with 330 additions and 127 deletions
29
ops/lib.rs
29
ops/lib.rs
|
@ -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 }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue