markSettled = record => {
  if (!record || record.settled) {
    return new Set();
  }

  const { deferreds } = record;
  Object.assign(record, {
    deferreds: undefined,
    settled: true,
  });
  Object.freeze(record);
  return deferreds;
}
@param {PromiseMemoRecord | undefined} record
@returns {Set<Deferred>}