MCPcopy Create free account
hub / github.com/nodejs/node / find_object_near

Function find_object_near

deps/v8/tools/windbg.js:397–420  ·  view source on GitHub ↗
(aligned_addr, max_distance, step_op)

Source from the content-addressed store, hash-verified

395}
396
397function find_object_near(aligned_addr, max_distance, step_op) {
398 if (!step_op) {
399 const step = tagged_size();
400 const prev =
401 find_object_near(aligned_addr, max_distance, x => x - step);
402 const next =
403 find_object_near(aligned_addr, max_distance, x => x + step);
404
405 if (!prev) return next;
406 if (!next) return prev;
407 return (addr - prev <= next - addr) ? prev : next;
408 }
409
410 let maybe_map_addr = poim(aligned_addr);
411 let iters = 0;
412 while (maybe_map_addr && iters < max_distance) {
413 if (is_map(maybe_map_addr)) {
414 return aligned_addr;
415 }
416 aligned_addr = step_op(aligned_addr);
417 maybe_map_addr = poim(aligned_addr);
418 iters++;
419 }
420}
421
422function find_object_prev(addr, max_distance) {
423 if (!Number.isSafeInteger(int(addr))) return;

Callers 2

find_object_prevFunction · 0.85
find_object_nextFunction · 0.85

Calls 3

tagged_sizeFunction · 0.85
poimFunction · 0.85
is_mapFunction · 0.85

Tested by

no test coverage detected