Commit Graph

3 Commits

Author SHA1 Message Date
Jason
ce73e887a3
src: remove unnecessary temporary creation
PR-URL: https://github.com/nodejs/node/pull/48734
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-07-20 09:20:15 +00:00
Joyee Cheung
8790cfc610
src: make BaseObject iteration order deterministic
Previously we just rely on the unordered_set order to iterate over
the BaseObjects, which is not deterministic.

The iteration is only used in printing, verification, and snapshot
generation. In the first two cases the performance overhead of
sorting does not matter because they are only used for debugging.
In the last case the determinism is more important than the trivial
overhead of sorting. So this patch makes the iteration deterministic
by sorting the set first, as what is already being done when we
drain the queue.

PR-URL: https://github.com/nodejs/node/pull/48702
Refs: https://github.com/nodejs/build/issues/3043
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-07-12 15:18:43 +00:00
legendecas
0b5b5edd86
src: consolidate environment cleanup queue
Each Realm tracks its own cleanup hooks and drains the hooks when it is
going to be destroyed.

Moves the implementations of the cleanup queue to its own class so that
it can be used in `node::Realm` too.

PR-URL: https://github.com/nodejs/node/pull/44379
Refs: https://github.com/nodejs/node/pull/44348
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-09-08 00:06:47 +08:00