コード例 #1
0
ファイル: ZoneGroup.cpp プロジェクト: yrliou/gecko-dev
ZoneGroup::IonBuilderList&
ZoneGroup::ionLazyLinkList()
{
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime),
               "Should only be mutated by the active thread.");
    return ionLazyLinkList_.ref();
}
コード例 #2
0
ファイル: ProtectedData.cpp プロジェクト: luke-chang/gecko-1
void
CheckZoneGroup<Helper>::check() const
{
    if (OnHelperThread<Helper>())
        return;

    JSContext* cx = TlsContext.get();
    if (group) {
        if (group->usedByHelperThread()) {
            MOZ_ASSERT(group->ownedByCurrentThread());
        } else {
            // This check is disabled on windows for the same reason as in
            // CheckActiveThread.
#ifndef XP_WIN
            // In a cooperatively scheduled runtime the active thread is
            // permitted access to all zone groups --- even those it has not
            // entered --- for GC and similar purposes. Since all other
            // cooperative threads are suspended, these accesses are threadsafe
            // if the zone group is not in use by a helper thread.
            //
            // A corollary to this is that suspended cooperative threads may
            // not access anything in a zone group, even zone groups they own,
            // because they're not allowed to interact with the JS API.
            MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
#endif
        }
    } else {
        // |group| will be null for data in the atoms zone. This is protected
        // by the exclusive access lock.
        MOZ_ASSERT(cx->runtime()->currentThreadHasExclusiveAccess());
    }
}
コード例 #3
0
ファイル: ZoneGroup.cpp プロジェクト: yrliou/gecko-dev
void
ZoneGroup::ionLazyLinkListAdd(jit::IonBuilder* builder)
{
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime),
               "Should only be mutated by the active thread.");
    MOZ_ASSERT(this == builder->script()->zone()->group());
    ionLazyLinkList().insertFront(builder);
    ionLazyLinkListSize_++;
}
コード例 #4
0
ファイル: ZoneGroup.cpp プロジェクト: yrliou/gecko-dev
void
ZoneGroup::ionLazyLinkListRemove(jit::IonBuilder* builder)
{
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime),
               "Should only be mutated by the active thread.");
    MOZ_ASSERT(this == builder->script()->zone()->group());
    MOZ_ASSERT(ionLazyLinkListSize_ > 0);

    builder->removeFrom(ionLazyLinkList());
    ionLazyLinkListSize_--;

    MOZ_ASSERT(ionLazyLinkList().isEmpty() == (ionLazyLinkListSize_ == 0));
}
コード例 #5
0
ファイル: ProtectedData.cpp プロジェクト: luke-chang/gecko-1
void
CheckThreadLocal::check() const
{
    JSContext* cx = TlsContext.get();
    MOZ_ASSERT(cx);

    // As for CheckZoneGroup, in a cooperatively scheduled runtime the active
    // thread is permitted access to thread local state for other suspended
    // threads in the same runtime.
    if (cx->isCooperativelyScheduled())
        MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
    else
        MOZ_ASSERT(id == ThisThread::GetId());
}
コード例 #6
0
ファイル: ZoneGroup.cpp プロジェクト: yrliou/gecko-dev
void
ZoneGroup::deleteEmptyZone(Zone* zone)
{
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime));
    MOZ_ASSERT(zone->group() == this);
    MOZ_ASSERT(zone->compartments().empty());
    for (auto& i : zones()) {
        if (i == zone) {
            zones().erase(&i);
            zone->destroy(runtime->defaultFreeOp());
            return;
        }
    }
    MOZ_CRASH("Zone not found");
}
コード例 #7
0
ファイル: ProtectedData.cpp プロジェクト: luke-chang/gecko-1
void
CheckActiveThread<Helper>::check() const
{
    // When interrupting a thread on Windows, changes are made to the runtime
    // and active thread's state from another thread while the active thread is
    // suspended. We need a way to mark these accesses as being tantamount to
    // accesses by the active thread. See bug 1323066.
#ifndef XP_WIN
    if (OnHelperThread<Helper>())
        return;

    JSContext* cx = TlsContext.get();
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
#endif // XP_WIN
}
コード例 #8
0
ファイル: Barrier.cpp プロジェクト: luke-chang/gecko-1
bool
RuntimeFromActiveCooperatingThreadIsHeapMajorCollecting(JS::shadow::Zone* shadowZone)
{
    MOZ_ASSERT(CurrentThreadCanAccessRuntime(shadowZone->runtimeFromActiveCooperatingThread()));
    return JS::CurrentThreadIsHeapMajorCollecting();
}