diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-06-25 16:36:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-25 16:36:09 +0200 |
commit | 8fe9b8a4cc381f9b94ce2caf10c61ddff864bdb4 (patch) | |
tree | 9ae0797ef865f0f0a023052f7dbe433d238561d4 /ops/op2/test_cases/sync/add.out | |
parent | 3fe44a50c37b3f045c95a2085b58cfe3f71e8f6a (diff) |
refactor(ops): ops2 supports result in fast path (#19603)
Implements `Result` in fast-calls. Note that the approach here is
slightly different. Rather than store the last result in the `OpState`,
we put it into the `OpCtx` which saves us a lookup and lock in the error
case. We do not have to lock this field as it's guaranteed only one
runtime and thread can ever access it.
The fastcall path for many ops can avoid doing a great deal of work,
even for `Result` return values. In the previous iteration of `ops`, all
`Result`-returning functions would fetch and lock the `OpState`,
regardless of whether it was used or not.
Diffstat (limited to 'ops/op2/test_cases/sync/add.out')
-rw-r--r-- | ops/op2/test_cases/sync/add.out | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ops/op2/test_cases/sync/add.out b/ops/op2/test_cases/sync/add.out index a7269c5cf..7d97a7161 100644 --- a/ops/op2/test_cases/sync/add.out +++ b/ops/op2/test_cases/sync/add.out @@ -13,7 +13,7 @@ impl op_add { use deno_core::v8::fast_api::Type; use deno_core::v8::fast_api::CType; deno_core::v8::fast_api::FastFunction::new( - &[Type::Uint32, Type::Uint32], + &[Type::V8Value, Type::Uint32, Type::Uint32], CType::Uint32, Self::fast_function as *const ::std::ffi::c_void, ) @@ -43,9 +43,8 @@ impl op_add { arg0: u32, arg1: u32, ) -> u32 { - let arg0 = arg0 as _; - let arg1 = arg1 as _; - Self::call(arg0, arg1) + let result = Self::call(arg0 as _, arg1 as _); + result } #[inline(always)] fn call(a: u32, b: u32) -> u32 { |