1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef vm_MutexIDs_h 8 #define vm_MutexIDs_h 9 10 #include "threading/Mutex.h" 11 12 // Central definition point for mutex ordering. 13 // 14 // Mutexes can only be acquired in increasing order. This prevents the 15 // possibility of deadlock. Mutexes with the same order cannot be held 16 // at the same time. 17 18 #define FOR_EACH_MUTEX(_) \ 19 _(TestMutex, 100) \ 20 _(ShellContextWatchdog, 100) \ 21 _(ShellWorkerThreads, 100) \ 22 _(ShellObjectMailbox, 100) \ 23 \ 24 _(AtomsTable, 200) \ 25 _(WasmInitBuiltinThunks, 250) \ 26 _(WasmLazyStubsTier1, 250) \ 27 _(WasmLazyStubsTier2, 251) \ 28 \ 29 _(StoreBuffer, 275) \ 30 \ 31 _(GCLock, 300) \ 32 \ 33 _(GlobalHelperThreadState, 400) \ 34 \ 35 _(SharedImmutableStringsCache, 500) \ 36 _(FutexThread, 500) \ 37 _(GeckoProfilerStrings, 500) \ 38 _(ProtectedRegionTree, 500) \ 39 _(ShellOffThreadState, 500) \ 40 _(ShellStreamCacheEntryState, 500) \ 41 _(SimulatorCacheLock, 500) \ 42 _(Arm64SimulatorLock, 500) \ 43 _(IonSpewer, 500) \ 44 _(PerfSpewer, 500) \ 45 _(CacheIRSpewer, 500) \ 46 _(TraceLoggerThreadState, 500) \ 47 _(DateTimeInfoMutex, 500) \ 48 _(ProcessExecutableRegion, 500) \ 49 _(BufferStreamState, 500) \ 50 _(SharedArrayGrow, 500) \ 51 _(SharedImmutableScriptData, 500) \ 52 _(WasmFuncTypeIdSet, 500) \ 53 _(WasmCodeProfilingLabels, 500) \ 54 _(WasmCodeBytesEnd, 500) \ 55 _(WasmStreamEnd, 500) \ 56 _(WasmStreamStatus, 500) \ 57 _(WasmRuntimeInstances, 500) \ 58 _(WasmSignalInstallState, 500) \ 59 _(WasmHugeMemoryEnabled, 500) \ 60 _(MemoryTracker, 500) \ 61 \ 62 _(IrregexpLazyStatic, 600) \ 63 _(ThreadId, 600) \ 64 _(WasmCodeSegmentMap, 600) \ 65 _(TraceLoggerGraphState, 600) \ 66 _(VTuneLock, 600) \ 67 _(ShellTelemetry, 600) 68 69 namespace js { 70 namespace mutexid { 71 72 #define DEFINE_MUTEX_ID(name, order) static const MutexId name{#name, order}; 73 FOR_EACH_MUTEX(DEFINE_MUTEX_ID) 74 #undef DEFINE_MUTEX_ID 75 76 } // namespace mutexid 77 } // namespace js 78 79 #endif // vm_MutexIDs_h 80