From c3325bfc0d3444a629a052694747d84a9cda11f0 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 6 Feb 2023 16:44:16 +0100 Subject: [PATCH] src: make edge names in BaseObjects more descriptive in heap snapshots Previously these were named "wrapper" and "wrapped", which can be somewhat difficult to understand. This patch renames them to "javascript_to_native" and "native_to_javascript". PR-URL: https://github.com/nodejs/node/pull/46492 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Darshan Sen --- src/memory_tracker-inl.h | 4 ++-- test/pummel/test-heapdump-dns.js | 2 +- test/pummel/test-heapdump-fs-promise.js | 2 +- test/pummel/test-heapdump-http2.js | 12 ++++++------ test/pummel/test-heapdump-inspector.js | 2 +- test/pummel/test-heapdump-tls.js | 2 +- test/pummel/test-heapdump-zlib.js | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/memory_tracker-inl.h b/src/memory_tracker-inl.h index 6d927c72888181..a4970d9392faa7 100644 --- a/src/memory_tracker-inl.h +++ b/src/memory_tracker-inl.h @@ -318,8 +318,8 @@ MemoryRetainerNode* MemoryTracker::AddNode(const MemoryRetainer* retainer, if (CurrentNode() != nullptr) graph_->AddEdge(CurrentNode(), n, edge_name); if (n->JSWrapperNode() != nullptr) { - graph_->AddEdge(n, n->JSWrapperNode(), "wrapped"); - graph_->AddEdge(n->JSWrapperNode(), n, "wrapper"); + graph_->AddEdge(n, n->JSWrapperNode(), "native_to_javascript"); + graph_->AddEdge(n->JSWrapperNode(), n, "javascript_to_native"); } return n; diff --git a/test/pummel/test-heapdump-dns.js b/test/pummel/test-heapdump-dns.js index faadcb6a642900..bbef2b1b1b07c2 100644 --- a/test/pummel/test-heapdump-dns.js +++ b/test/pummel/test-heapdump-dns.js @@ -12,7 +12,7 @@ validateSnapshotNodes('Node / ChannelWrap', [ children: [ { node_name: 'Node / NodeAresTask::List', edge_name: 'task_list' }, // `Node / ChannelWrap` (C++) -> `ChannelWrap` (JS) - { node_name: 'ChannelWrap', edge_name: 'wrapped' }, + { node_name: 'ChannelWrap', edge_name: 'native_to_javascript' }, ], detachedness: 2 }, diff --git a/test/pummel/test-heapdump-fs-promise.js b/test/pummel/test-heapdump-fs-promise.js index 181029dd69c11f..471b131affac91 100644 --- a/test/pummel/test-heapdump-fs-promise.js +++ b/test/pummel/test-heapdump-fs-promise.js @@ -9,7 +9,7 @@ fs.stat(__filename); validateSnapshotNodes('Node / FSReqPromise', [ { children: [ - { node_name: 'FSReqPromise', edge_name: 'wrapped' }, + { node_name: 'FSReqPromise', edge_name: 'native_to_javascript' }, { node_name: 'Float64Array', edge_name: 'stats_field_array' }, ] }, diff --git a/test/pummel/test-heapdump-http2.js b/test/pummel/test-heapdump-http2.js index 2fa854a91f117d..ddbb4e99644c16 100644 --- a/test/pummel/test-heapdump-http2.js +++ b/test/pummel/test-heapdump-http2.js @@ -28,7 +28,7 @@ server.listen(0, () => { { children: [ // current_headers and/or queue could be empty - { node_name: 'Http2Stream', edge_name: 'wrapped' }, + { node_name: 'Http2Stream', edge_name: 'native_to_javascript' }, ] }, ], { loose: true }); @@ -37,7 +37,7 @@ server.listen(0, () => { state.validateSnapshotNodes('Node / FileHandle', [ { children: [ - { node_name: 'FileHandle', edge_name: 'wrapped' }, + { node_name: 'FileHandle', edge_name: 'native_to_javascript' }, // current_headers could be empty ] }, @@ -45,14 +45,14 @@ server.listen(0, () => { state.validateSnapshotNodes('Node / TCPSocketWrap', [ { children: [ - { node_name: 'TCP', edge_name: 'wrapped' }, + { node_name: 'TCP', edge_name: 'native_to_javascript' }, ] }, ], { loose: true }); state.validateSnapshotNodes('Node / TCPServerWrap', [ { children: [ - { node_name: 'TCP', edge_name: 'wrapped' }, + { node_name: 'TCP', edge_name: 'native_to_javascript' }, ] }, ], { loose: true }); @@ -60,7 +60,7 @@ server.listen(0, () => { state.validateSnapshotNodes('Node / StreamPipe', [ { children: [ - { node_name: 'StreamPipe', edge_name: 'wrapped' }, + { node_name: 'StreamPipe', edge_name: 'native_to_javascript' }, ] }, ]); @@ -68,7 +68,7 @@ server.listen(0, () => { state.validateSnapshotNodes('Node / Http2Session', [ { children: [ - { node_name: 'Http2Session', edge_name: 'wrapped' }, + { node_name: 'Http2Session', edge_name: 'native_to_javascript' }, { node_name: 'Node / nghttp2_memory', edge_name: 'nghttp2_memory' }, { node_name: 'Node / streams', edge_name: 'streams' diff --git a/test/pummel/test-heapdump-inspector.js b/test/pummel/test-heapdump-inspector.js index 9b08e33fdb2bce..113602a431f8e0 100644 --- a/test/pummel/test-heapdump-inspector.js +++ b/test/pummel/test-heapdump-inspector.js @@ -30,7 +30,7 @@ const snapshotNode = { { children: [ { node_name: 'Node / InspectorSession', edge_name: 'session' }, - { node_name: 'Connection', edge_name: 'wrapped' }, + { node_name: 'Connection', edge_name: 'native_to_javascript' }, (edge) => edge.name === 'callback' && (edge.to.type === undefined || // embedded graph edge.to.type === 'closure'), // snapshot diff --git a/test/pummel/test-heapdump-tls.js b/test/pummel/test-heapdump-tls.js index a58a543a28d65d..31933c75e1ff6c 100644 --- a/test/pummel/test-heapdump-tls.js +++ b/test/pummel/test-heapdump-tls.js @@ -27,7 +27,7 @@ const server = net.createServer(common.mustCall((c) => { { node_name: 'Node / NodeBIO', edge_name: 'enc_out' }, { node_name: 'Node / NodeBIO', edge_name: 'enc_in' }, // `Node / TLSWrap` (C++) -> `TLSWrap` (JS) - { node_name: 'TLSWrap', edge_name: 'wrapped' }, + { node_name: 'TLSWrap', edge_name: 'native_to_javascript' }, // pending_cleartext_input could be empty ] }, diff --git a/test/pummel/test-heapdump-zlib.js b/test/pummel/test-heapdump-zlib.js index 16e4ede4f916a2..9b9bc1e83698b7 100644 --- a/test/pummel/test-heapdump-zlib.js +++ b/test/pummel/test-heapdump-zlib.js @@ -10,7 +10,7 @@ const gzip = zlib.createGzip(); validateSnapshotNodes('Node / ZlibStream', [ { children: [ - { node_name: 'Zlib', edge_name: 'wrapped' }, + { node_name: 'Zlib', edge_name: 'native_to_javascript' }, // No entry for memory because zlib memory is initialized lazily. ] }, @@ -20,7 +20,7 @@ gzip.write('hello world', common.mustCall(() => { validateSnapshotNodes('Node / ZlibStream', [ { children: [ - { node_name: 'Zlib', edge_name: 'wrapped' }, + { node_name: 'Zlib', edge_name: 'native_to_javascript' }, { node_name: 'Node / zlib_memory', edge_name: 'zlib_memory' }, ] },