Add funcitonality to take heap snapshots#1545
Add funcitonality to take heap snapshots#1545kulcsaradam wants to merge 1 commit intoSamsung:masterfrom
Conversation
src/debugger/Debugger.cpp
Outdated
|
|
||
| // [["hidden","array","string","object","code","closure","regexp","number","native","synthetic","concatenated string","sliced string","symbol","bigint","object shape"]," | ||
| // "edge_types":[["context","element","property","internal","hidden","shortcut","weak"] | ||
| uint64_t stateIdx = addNode(info, snapshotNode::hidden, "state", &id, sizeof(*state), false); |
There was a problem hiding this comment.
Introduce a local lambda that takes the node type, name, size, and parent index, calls addNode, and immediately adds an edge of type snapshotEdge::element. This reduces the repeated pattern of addNode(...); addEdge(...); and makes the intent clearer. The lambda can be defined near the top of the case block and used for each node addition. This keeps the code concise and easier to maintain.
Signed-off-by: Ádám László Kulcsár <kuladam@inf.u-szeged.hu>
5425dbd to
a9d842f
Compare
|
@ksh8281 could you give some pointers about what types of Escargot internals should the snapshot 100% contain? Currently, I've implemented tracking for simple constructs, such as the state, lexical environments and some of their members, but is very rudimentary so far. Should each member of an object be tracked or would that be unnecesarry? For example for some simple javascript like this: The produced snapshot when viewed in chrome devtools looks like this: (I also included the snapshot as json. The file extension needs to be changed into .heapsnapshot to work with chrome dev tools though, but github does not allow such files to be uploaded) This basic example contains 99 objects (most of which are strings that are properties of the global object) and every object can be reached from the "root" which is the |
|
The first result is excellent. |

No description provided.