(table: InternWrite, value: unknown)
| 3672 | } |
| 3673 | |
| 3674 | function internAdd(table: InternWrite, value: unknown) { |
| 3675 | const values = table.values |
| 3676 | if (table.refs !== undefined) { |
| 3677 | if (table.hits === 0 && values.length >= INTERN_DISABLE_AT) { |
| 3678 | table.disabled = true |
| 3679 | table.refs = undefined |
| 3680 | return |
| 3681 | } |
| 3682 | table.refs.set(value, values.length) |
| 3683 | } else if (values.length >= INTERN_MAP_AT) { |
| 3684 | const refs = table.refs = new Map() |
| 3685 | for (let i = 0; i < values.length; i++) refs.set(values[i], i) |
| 3686 | refs.set(value, values.length) |
| 3687 | } |
| 3688 | values.push(value) |
| 3689 | } |
| 3690 | |
| 3691 | // A connection dictionary: string tables that outlive a single frame. The |
| 3692 | // writer and the reader build the same tables from the same frames, so a |
no test coverage detected