static intptr_t GetSerialNumber(void* aPtr, bool aCreate) { PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, HashNumber(aPtr), aPtr); if (hep && *hep) { return static_cast<SerialNumberRecord*>((*hep)->value)->serialNumber; } else if (aCreate) { SerialNumberRecord* record = new SerialNumberRecord(); WalkTheStackSavingLocations(record->allocationStack); PL_HashTableRawAdd(gSerialNumbers, hep, HashNumber(aPtr), aPtr, static_cast<void*>(record)); return gNextSerialNumber; } return 0; }
static intptr_t GetSerialNumber(void* aPtr, bool aCreate) { PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, HashNumber(aPtr), aPtr); if (hep && *hep) { MOZ_RELEASE_ASSERT(!aCreate, "If an object already has a serial number, we should be destroying it."); return static_cast<SerialNumberRecord*>((*hep)->value)->serialNumber; } if (!aCreate) { return 0; } SerialNumberRecord* record = new SerialNumberRecord(); WalkTheStackSavingLocations(record->allocationStack); PL_HashTableRawAdd(gSerialNumbers, hep, HashNumber(aPtr), aPtr, static_cast<void*>(record)); return gNextSerialNumber; }