mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
async_hooks: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36168 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
514f464a60
commit
f47d65538a
3 changed files with 20 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayPrototypePop,
|
||||
ArrayPrototypeSlice,
|
||||
ArrayPrototypeUnshift,
|
||||
ErrorCaptureStackTrace,
|
||||
FunctionPrototypeBind,
|
||||
|
@ -132,7 +134,7 @@ function callbackTrampoline(asyncId, resource, cb, ...args) {
|
|||
if (asyncId !== 0 && hasHooks(kAfter))
|
||||
emitAfterNative(asyncId);
|
||||
|
||||
execution_async_resources.pop();
|
||||
ArrayPrototypePop(execution_async_resources);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -270,7 +272,7 @@ function getHookArrays() {
|
|||
|
||||
|
||||
function storeActiveHooks() {
|
||||
active_hooks.tmp_array = active_hooks.array.slice();
|
||||
active_hooks.tmp_array = ArrayPrototypeSlice(active_hooks.array);
|
||||
// Don't want to make the assumption that kInit to kDestroy are indexes 0 to
|
||||
// 4. So do this the long way.
|
||||
active_hooks.tmp_fields = [];
|
||||
|
@ -522,7 +524,7 @@ function popAsyncContext(asyncId) {
|
|||
const offset = stackLength - 1;
|
||||
async_id_fields[kExecutionAsyncId] = async_wrap.async_ids_stack[2 * offset];
|
||||
async_id_fields[kTriggerAsyncId] = async_wrap.async_ids_stack[2 * offset + 1];
|
||||
execution_async_resources.pop();
|
||||
ArrayPrototypePop(execution_async_resources);
|
||||
async_hook_fields[kStackLength] = offset;
|
||||
return offset > 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue