| 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 |
_(ExecutionTracerGlobalLock, 100) \ |
| 20 |
_(TestMutex, 100) \ |
| 21 |
_(ShellContextWatchdog, 100) \ |
| 22 |
_(ShellWorkerThreads, 100) \ |
| 23 |
_(ShellObjectMailbox, 100) \ |
| 24 |
_(WellKnownParserAtomsInit, 100) \ |
| 25 |
\ |
| 26 |
_(ExecutionTracerInstanceLock, 250) \ |
| 27 |
\ |
| 28 |
_(StoreBuffer, 275) \ |
| 29 |
\ |
| 30 |
_(GCLock, 300) \ |
| 31 |
\ |
| 32 |
_(GlobalHelperThreadState, 400) \ |
| 33 |
\ |
| 34 |
_(WasmCodeProtected, 450) \ |
| 35 |
\ |
| 36 |
_(WasmInitBuiltinThunks, 451) \ |
| 37 |
_(StringsCache, 500) \ |
| 38 |
_(FutexThread, 500) \ |
| 39 |
_(GeckoProfilerStrings, 500) \ |
| 40 |
_(ProtectedRegionTree, 500) \ |
| 41 |
_(ShellOffThreadState, 500) \ |
| 42 |
_(ShellStreamCacheEntryState, 500) \ |
| 43 |
_(SimulatorCacheLock, 500) \ |
| 44 |
_(Arm64SimulatorLock, 500) \ |
| 45 |
_(IonSpewer, 500) \ |
| 46 |
_(PerfSpewer, 500) \ |
| 47 |
_(CacheIRSpewer, 500) \ |
| 48 |
_(DateTimeInfoMutex, 500) \ |
| 49 |
_(ProcessExecutableRegion, 500) \ |
| 50 |
_(BufferStreamState, 500) \ |
| 51 |
_(SharedArrayGrow, 500) \ |
| 52 |
_(SharedImmutableScriptData, 500) \ |
| 53 |
_(WasmTypeIdSet, 500) \ |
| 54 |
_(WasmCodeProfilingLabels, 500) \ |
| 55 |
_(WasmCodeBytesEnd, 500) \ |
| 56 |
_(WasmStreamEnd, 500) \ |
| 57 |
_(WasmStreamStatus, 500) \ |
| 58 |
_(WasmRuntimeInstances, 500) \ |
| 59 |
_(WasmSignalInstallState, 500) \ |
| 60 |
_(MemoryTracker, 500) \ |
| 61 |
_(StencilCache, 500) \ |
| 62 |
_(SourceCompression, 500) \ |
| 63 |
_(GCDelayedMarkingLock, 500) \ |
| 64 |
_(BufferAllocator, 500) \ |
| 65 |
\ |
| 66 |
_(SharedImmutableStringsCache, 600) \ |
| 67 |
_(IrregexpLazyStatic, 600) \ |
| 68 |
_(ThreadId, 600) \ |
| 69 |
_(WasmCodeBlockMap, 600) \ |
| 70 |
_(WasmInliningBudget, 600) \ |
| 71 |
_(VTuneLock, 600) \ |
| 72 |
_(ShellTelemetry, 600) \ |
| 73 |
_(ShellUseCounters, 600) |
| 74 |
|
| 75 |
namespace js { |
| 76 |
namespace mutexid { |
| 77 |
|
| 78 |
#define DEFINE_MUTEX_ID(name, order) static const MutexId name{#name, order}; |
| 79 |
FOR_EACH_MUTEX(DEFINE_MUTEX_ID) |
| 80 |
#undef DEFINE_MUTEX_ID |
| 81 |
|
| 82 |
} // namespace mutexid |
| 83 |
} // namespace js |
| 84 |
|
| 85 |
#endif // vm_MutexIDs_h |