diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-04-26 20:02:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 20:02:27 +0200 |
commit | 77e25a656eca0cb1639ae39c515ac6c5f86d2ac9 (patch) | |
tree | 7a72f0ba696c3ac5171593034b765eecdb9b5f20 /ops/fast_call.rs | |
parent | 14aaa73c0200d7fac4aa224d623e28b5955daab9 (diff) |
refactor(core): simplify op types and codegeneration (#18843)
About 2% improvement on WS/HTTP benchmarks, possibly unlocking more
optimizations in the future.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'ops/fast_call.rs')
-rw-r--r-- | ops/fast_call.rs | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/ops/fast_call.rs b/ops/fast_call.rs index 2485b6083..ebbb1927b 100644 --- a/ops/fast_call.rs +++ b/ops/fast_call.rs @@ -245,41 +245,16 @@ pub(crate) fn generate( } if optimizer.is_async { - // Referenced variables are declared in parent block. - let track_async = q!({ - let __op_id = __ctx.id; - let __state = ::std::cell::RefCell::borrow(&__ctx.state); - __state.tracker.track_async(__op_id); - }); - - output_transforms.push_tokens(&track_async); - let queue_future = if optimizer.returns_result { q!({ - let realm_idx = __ctx.realm_idx; - let __get_class = __state.get_error_class_fn; - let result = _ops::queue_fast_async_op(__ctx, async move { - let result = result.await; - ( - realm_idx, - __promise_id, - __op_id, - _ops::to_op_result(__get_class, result), - ) - }); + let result = _ops::queue_fast_async_op(__ctx, __promise_id, result); }) } else { q!({ - let realm_idx = __ctx.realm_idx; - let result = _ops::queue_fast_async_op(__ctx, async move { - let result = result.await; - ( - realm_idx, - __promise_id, - __op_id, - _ops::OpResult::Ok(result.into()), - ) - }); + let result = + _ops::queue_fast_async_op(__ctx, __promise_id, async move { + Ok(result.await) + }); }) }; |