MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseEdges

Method parseEdges

valdi/src/valdi/runtime/JavaScript/JavaScriptHeapDumpBuilder.cpp:373–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void JavaScriptHeapDumpParser::parseEdges(JSONReader& reader, int32_t edgeCount) {
374 if (!reader.parseBeginArray()) {
375 return;
376 }
377
378 auto fieldsCountPerEdge = _fieldsIndexes.fieldsCountPerEdge;
379 std::vector<uint32_t> components;
380 if (!parseComponents(reader, components, fieldsCountPerEdge * edgeCount)) {
381 return;
382 }
383 auto* componentsPtr = components.data();
384 auto edgeTypeMaxSize = static_cast<uint32_t>(_fieldsIndexes.edgeTypeByIndex.size());
385
386 for (int32_t i = 0; i < edgeCount; i++) {
387 auto edgeTypeIndex = componentsPtr[_fieldsIndexes.edges.type];
388 auto edgeNameOrIndex = componentsPtr[_fieldsIndexes.edges.nameOrIndex];
389 auto edgeToNode = componentsPtr[_fieldsIndexes.edges.toNode];
390
391 if (edgeTypeIndex >= edgeTypeMaxSize) {
392 reader.setErrorAtCurrentPosition("Out of bounds edgeType");
393 return;
394 }
395
396 _edges.emplace_back(this,
397 _fieldsIndexes.edgeTypeByIndex[edgeTypeIndex],
398 edgeNameOrIndex,
399 edgeToNode / _fieldsIndexes.fieldsCountPerNode);
400
401 componentsPtr += fieldsCountPerEdge;
402 }
403
404 reader.parseEndArray();
405}
406
407void JavaScriptHeapDumpParser::parseStrings(JSONReader& reader) {
408 if (!reader.parseBeginArray()) {

Callers

nothing calls this directly

Calls 6

parseComponentsFunction · 0.85
parseBeginArrayMethod · 0.80
parseEndArrayMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected