コード例 #1
0
static void
getString(CacheAndIndex* cacheAndIndex)
{
    for (int i = 0; i < NUM_ITERATIONS; i++) {
        auto str = STRINGS[cacheAndIndex->index % NUM_STRINGS];

        auto dupe = js::DuplicateString(str);
        MOZ_RELEASE_ASSERT(dupe);

        auto deduped = cacheAndIndex->cache->getOrCreate(mozilla::Move(dupe), js_strlen(str));
        MOZ_RELEASE_ASSERT(deduped.isSome());
        MOZ_RELEASE_ASSERT(js_strcmp(str, deduped->chars()) == 0);

        {
            auto cloned = deduped->clone();
            // We should be de-duplicating and giving back the same string.
            MOZ_RELEASE_ASSERT(deduped->chars() == cloned.chars());
        }
    }

    js_delete(cacheAndIndex);
}
コード例 #2
0
void
setBitAndCheck(CounterAndBit* counterAndBit)
{
    while (true) {
        {
            // Set our bit. Repeatedly setting it is idempotent.
            auto guard = counterAndBit->counter.lock();
            printDiagnosticMessage(guard);
            guard |= (uint64_t(1) << counterAndBit->bit);
        }

        {
            // Check to see if we have observed all the other threads setting
            // their bit as well.
            auto guard = counterAndBit->counter.lock();
            printDiagnosticMessage(guard);
            if (guard == UINT64_MAX) {
                js_delete(counterAndBit);
                return;
            }
        }
    }
}
コード例 #3
0
void PR_DestroyCondVar(PRCondVar* cvar) {
    js_delete(cvar);
}
コード例 #4
0
void PR_DestroyLock(PRLock* lock) {
    js_delete(lock);
}
コード例 #5
0
void
PR_DestroyCondVar(PRCondVar *cvar)
{
    pthread_cond_destroy(&cvar->cond());
    js_delete(cvar);
}
コード例 #6
0
void
PR_DestroyLock(PRLock *lock)
{
    pthread_mutex_destroy(&lock->mutex());
    js_delete(lock);
}
コード例 #7
0
ファイル: pm_linux.cpp プロジェクト: servo/mozjs
PerfMeasurement::~PerfMeasurement() { js_delete(static_cast<Impl*>(impl)); }