summaryrefslogtreecommitdiff
path: root/lib/async_hooks.js
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2018-03-07 19:59:23 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2018-03-11 16:33:43 +0100
commitddcc00bc1e8cc5815c942e1c4713ce92e7a27d40 (patch)
treeee738888e99a01c1208d91082a1e79020a63023f /lib/async_hooks.js
parente16a2be8d8ec70866d3eed7dddbe7f11b4f20aa7 (diff)
downloadandroid-node-v8-ddcc00bc1e8cc5815c942e1c4713ce92e7a27d40.tar.gz
android-node-v8-ddcc00bc1e8cc5815c942e1c4713ce92e7a27d40.tar.bz2
android-node-v8-ddcc00bc1e8cc5815c942e1c4713ce92e7a27d40.zip
async_hooks: don't set hook_fields[kTotals] to 0
This commit removes the setting of hook_field[kTotals] to szero in AsyncHook's enable function. As far as I can tell this would not be required if the setting of this field is done with the assignment operator instead of using the addition assignment operator. PR-URL: https://github.com/nodejs/node/pull/19219 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/async_hooks.js')
-rw-r--r--lib/async_hooks.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/async_hooks.js b/lib/async_hooks.js
index 0c425e6945..f32c913185 100644
--- a/lib/async_hooks.js
+++ b/lib/async_hooks.js
@@ -74,12 +74,11 @@ class AsyncHook {
return this;
const prev_kTotals = hook_fields[kTotals];
- hook_fields[kTotals] = 0;
// createHook() has already enforced that the callbacks are all functions,
// so here simply increment the count of whether each callbacks exists or
// not.
- hook_fields[kTotals] += hook_fields[kInit] += +!!this[init_symbol];
+ hook_fields[kTotals] = hook_fields[kInit] += +!!this[init_symbol];
hook_fields[kTotals] += hook_fields[kBefore] += +!!this[before_symbol];
hook_fields[kTotals] += hook_fields[kAfter] += +!!this[after_symbol];
hook_fields[kTotals] += hook_fields[kDestroy] += +!!this[destroy_symbol];
@@ -102,9 +101,8 @@ class AsyncHook {
return this;
const prev_kTotals = hook_fields[kTotals];
- hook_fields[kTotals] = 0;
- hook_fields[kTotals] += hook_fields[kInit] -= +!!this[init_symbol];
+ hook_fields[kTotals] = hook_fields[kInit] -= +!!this[init_symbol];
hook_fields[kTotals] += hook_fields[kBefore] -= +!!this[before_symbol];
hook_fields[kTotals] += hook_fields[kAfter] -= +!!this[after_symbol];
hook_fields[kTotals] += hook_fields[kDestroy] -= +!!this[destroy_symbol];