(addr)
| 372 | Exploring objects |
| 373 | -----------------------------------------------------------------------------*/ |
| 374 | function is_map(addr) { |
| 375 | let address = int(addr); |
| 376 | if (!Number.isSafeInteger(address) || address % 2 == 0) return false; |
| 377 | |
| 378 | // the first field in all objects, including maps, is a map pointer, but for |
| 379 | // maps the pointer is always the same - the meta map that points to itself. |
| 380 | const map_addr = int(poim(address - 1)); |
| 381 | if (!Number.isSafeInteger(map_addr)) return false; |
| 382 | |
| 383 | const map_map_addr = int(poim(map_addr - 1)); |
| 384 | if (!Number.isSafeInteger(map_map_addr)) return false; |
| 385 | |
| 386 | return (map_addr === map_map_addr); |
| 387 | } |
| 388 | |
| 389 | function is_likely_object(addr) { |
| 390 | let address = int(addr); |
no test coverage detected