diff --git a/js/ipc/JavaScriptBase.h b/js/ipc/JavaScriptBase.h index 7cc5ec451a76..2566dbb25da5 100644 --- a/js/ipc/JavaScriptBase.h +++ b/js/ipc/JavaScriptBase.h @@ -18,7 +18,7 @@ namespace jsipc { template class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base { - typedef WrapperAnswer Answer; + using Answer = WrapperAnswer; public: virtual ~JavaScriptBase() {} diff --git a/js/ipc/JavaScriptShared.h b/js/ipc/JavaScriptShared.h index dddf9215feab..2fb5191b1e62 100644 --- a/js/ipc/JavaScriptShared.h +++ b/js/ipc/JavaScriptShared.h @@ -80,7 +80,7 @@ class JavaScriptShared; // ObjectId do that, but doing so would weaken our type invariants, so we just // reimplement it manually. struct ObjectIdHasher { - typedef ObjectId Lookup; + using Lookup = ObjectId; static js::HashNumber hash(const Lookup& l) { return mozilla::HashGeneric(l.serialize()); } diff --git a/js/ipc/WrapperOwner.h b/js/ipc/WrapperOwner.h index d47eb054150d..b6d3b777cb79 100644 --- a/js/ipc/WrapperOwner.h +++ b/js/ipc/WrapperOwner.h @@ -19,7 +19,7 @@ namespace jsipc { class WrapperOwner : public virtual JavaScriptShared { public: - typedef mozilla::ipc::IProtocol::ActorDestroyReason ActorDestroyReason; + using ActorDestroyReason = mozilla::ipc::IProtocol::ActorDestroyReason; WrapperOwner(); diff --git a/js/src/builtin/Array.cpp b/js/src/builtin/Array.cpp index 5a29f099c839..02cfc28f0e68 100644 --- a/js/src/builtin/Array.cpp +++ b/js/src/builtin/Array.cpp @@ -1906,8 +1906,8 @@ static bool ComparatorNumericRightMinusLeft(const NumericElement& a, return true; } -typedef bool (*ComparatorNumeric)(const NumericElement& a, - const NumericElement& b, bool* lessOrEqualp); +using ComparatorNumeric = bool (*)(const NumericElement&, const NumericElement&, + bool*); static const ComparatorNumeric SortComparatorNumerics[] = { nullptr, nullptr, ComparatorNumericLeftMinusRight, @@ -1925,8 +1925,7 @@ static bool ComparatorInt32RightMinusLeft(const Value& a, const Value& b, return true; } -typedef bool (*ComparatorInt32)(const Value& a, const Value& b, - bool* lessOrEqualp); +using ComparatorInt32 = bool (*)(const Value&, const Value&, bool*); static const ComparatorInt32 SortComparatorInt32s[] = { nullptr, nullptr, ComparatorInt32LeftMinusRight, diff --git a/js/src/builtin/DataViewObject.cpp b/js/src/builtin/DataViewObject.cpp index 9b2125429820..d12015983dac 100644 --- a/js/src/builtin/DataViewObject.cpp +++ b/js/src/builtin/DataViewObject.cpp @@ -292,47 +292,47 @@ static inline uint64_t swapBytes(uint64_t x) { template struct DataToRepType { - typedef DataType result; + using result = DataType; }; template <> struct DataToRepType { - typedef uint8_t result; + using result = uint8_t; }; template <> struct DataToRepType { - typedef uint8_t result; + using result = uint8_t; }; template <> struct DataToRepType { - typedef uint16_t result; + using result = uint16_t; }; template <> struct DataToRepType { - typedef uint16_t result; + using result = uint16_t; }; template <> struct DataToRepType { - typedef uint32_t result; + using result = uint32_t; }; template <> struct DataToRepType { - typedef uint32_t result; + using result = uint32_t; }; template <> struct DataToRepType { - typedef uint64_t result; + using result = uint64_t; }; template <> struct DataToRepType { - typedef uint64_t result; + using result = uint64_t; }; template <> struct DataToRepType { - typedef uint32_t result; + using result = uint32_t; }; template <> struct DataToRepType { - typedef uint64_t result; + using result = uint64_t; }; static inline void Memcpy(uint8_t* dest, uint8_t* src, size_t nbytes) { @@ -351,7 +351,7 @@ static inline void Memcpy(SharedMem dest, uint8_t* src, template struct DataViewIO { - typedef typename DataToRepType::result ReadWriteType; + using ReadWriteType = typename DataToRepType::result; static constexpr auto alignMask = std::min(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1; diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index e8e7f21c92cf..821b0751c44b 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -461,7 +461,7 @@ void MapObject::trace(JSTracer* trc, JSObject* obj) { } struct js::UnbarrieredHashPolicy { - typedef Value Lookup; + using Lookup = Value; static HashNumber hash(const Lookup& v, const mozilla::HashCodeScrambler& hcs) { return HashValue(v, hcs); diff --git a/js/src/builtin/MapObject.h b/js/src/builtin/MapObject.h index 0892ba6ed930..968c6d907dd5 100644 --- a/js/src/builtin/MapObject.h +++ b/js/src/builtin/MapObject.h @@ -31,7 +31,7 @@ class HashableValue { public: struct Hasher { - typedef HashableValue Lookup; + using Lookup = HashableValue; static HashNumber hash(const Lookup& v, const mozilla::HashCodeScrambler& hcs) { return v.hash(hcs); diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h index 8ba182d638dd..4732e1fe8b57 100644 --- a/js/src/builtin/ModuleObject.h +++ b/js/src/builtin/ModuleObject.h @@ -25,10 +25,10 @@ namespace js { class ModuleEnvironmentObject; class ModuleObject; -typedef Rooted RootedModuleObject; -typedef Handle HandleModuleObject; -typedef Rooted RootedModuleEnvironmentObject; -typedef Handle HandleModuleEnvironmentObject; +using RootedModuleObject = Rooted; +using HandleModuleObject = Handle; +using RootedModuleEnvironmentObject = Rooted; +using HandleModuleEnvironmentObject = Handle; class ImportEntryObject : public NativeObject { public: @@ -53,10 +53,10 @@ class ImportEntryObject : public NativeObject { uint32_t columnNumber() const; }; -typedef Rooted RootedImportEntryObject; -typedef Handle HandleImportEntryObject; -typedef Rooted> RootedImportEntryVector; -typedef MutableHandle MutableHandleImportEntryObject; +using RootedImportEntryObject = Rooted; +using HandleImportEntryObject = Handle; +using RootedImportEntryVector = Rooted >; +using MutableHandleImportEntryObject = MutableHandle; template XDRResult XDRImportEntryObject(XDRState* xdr, @@ -92,8 +92,8 @@ class ExportEntryObject : public NativeObject { template XDRResult XDRExportEntries(XDRState* xdr, MutableHandleArrayObject vec); -typedef Rooted RootedExportEntryObject; -typedef Handle HandleExportEntryObject; +using RootedExportEntryObject = Rooted; +using HandleExportEntryObject = Handle; class RequestedModuleObject : public NativeObject { public: @@ -110,11 +110,11 @@ class RequestedModuleObject : public NativeObject { uint32_t columnNumber() const; }; -typedef Rooted RootedRequestedModuleObject; -typedef Handle HandleRequestedModuleObject; -typedef Rooted> RootedRequestedModuleVector; -typedef MutableHandle - MutableHandleRequestedModuleObject; +using RootedRequestedModuleObject = Rooted; +using HandleRequestedModuleObject = Handle; +using RootedRequestedModuleVector = Rooted >; +using MutableHandleRequestedModuleObject = + MutableHandle; template XDRResult XDRRequestedModuleObject(XDRState* xdr, @@ -221,8 +221,8 @@ class ModuleNamespaceObject : public ProxyObject { static const ProxyHandler proxyHandler; }; -typedef Rooted RootedModuleNamespaceObject; -typedef Handle HandleModuleNamespaceObject; +using RootedModuleNamespaceObject = Rooted; +using HandleModuleNamespaceObject = Handle; struct FunctionDeclaration { FunctionDeclaration(HandleAtom name, uint32_t funIndex); diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp index ebe4b42de6dd..1959a8d2e8f9 100644 --- a/js/src/builtin/ReflectParse.cpp +++ b/js/src/builtin/ReflectParse.cpp @@ -207,7 +207,7 @@ static const char* const callbackNames[] = { enum YieldKind { Delegating, NotDelegating }; -typedef RootedValueVector NodeVector; +using NodeVector = RootedValueVector; /* * ParseNode is a somewhat intricate data structure, and its invariants have @@ -260,7 +260,7 @@ enum class GeneratorStyle { None, ES6 }; * Bug 569487: generalize builder interface */ class NodeBuilder { - typedef AutoValueArray CallbackArray; + using CallbackArray = AutoValueArray; JSContext* cx; frontend::Parser* parser; diff --git a/js/src/builtin/String.cpp b/js/src/builtin/String.cpp index 71044da7ed23..86528d6888e6 100644 --- a/js/src/builtin/String.cpp +++ b/js/src/builtin/String.cpp @@ -1758,7 +1758,7 @@ static int BoyerMooreHorspool(const TextChar* text, uint32_t textLen, template struct MemCmp { - typedef uint32_t Extent; + using Extent = uint32_t; static MOZ_ALWAYS_INLINE Extent computeExtent(const PatChar*, uint32_t patLen) { return (patLen - 1) * sizeof(PatChar); @@ -1772,7 +1772,7 @@ struct MemCmp { template struct ManualCmp { - typedef const PatChar* Extent; + using Extent = const PatChar*; static MOZ_ALWAYS_INLINE Extent computeExtent(const PatChar* pat, uint32_t patLen) { return pat + patLen; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 96a7abfc2662..bb15ec19fc77 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -3840,7 +3840,7 @@ static bool ReportLargeAllocationFailure(JSContext* cx, unsigned argc, namespace heaptools { -typedef UniqueTwoByteChars EdgeName; +using EdgeName = UniqueTwoByteChars; // An edge to a node from its predecessor in a path through the graph. class BackEdge { @@ -3875,8 +3875,8 @@ class BackEdge { // A path-finding handler class for use with JS::ubi::BreadthFirst. struct FindPathHandler { - typedef BackEdge NodeData; - typedef JS::ubi::BreadthFirst Traversal; + using NodeData = BackEdge; + using Traversal = JS::ubi::BreadthFirst; FindPathHandler(JSContext* cx, JS::ubi::Node start, JS::ubi::Node target, MutableHandle> nodes, Vector& edges) diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index f837718ee759..6a2f6229441e 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -204,7 +204,7 @@ class TypeDescr : public NativeObject { static void finalize(JSFreeOp* fop, JSObject* obj); }; -typedef Handle HandleTypeDescr; +using HandleTypeDescr = Handle; class SimpleTypeDescr : public TypeDescr {}; @@ -214,7 +214,7 @@ class SimpleTypeDescr : public TypeDescr {}; // an opaque reference type.) class ScalarTypeDescr : public SimpleTypeDescr { public: - typedef Scalar::Type Type; + using Type = Scalar::Type; static const type::Kind Kind = type::Scalar; static const bool Opaque = false; @@ -310,7 +310,7 @@ enum class ReferenceType { class ReferenceTypeDescr : public SimpleTypeDescr { public: // Must match order of JS_FOR_EACH_REFERENCE_TYPE_REPR below - typedef ReferenceType Type; + using Type = ReferenceType; static const char* typeName(Type type); static const int32_t TYPE_MAX = int32_t(ReferenceType::TYPE_STRING) + 1; @@ -511,7 +511,7 @@ class StructTypeDescr : public ComplexTypeDescr { } }; -typedef Handle HandleStructTypeDescr; +using HandleStructTypeDescr = Handle; /* * This object exists in order to encapsulate the typed object types @@ -638,7 +638,7 @@ class TypedObject : public JSObject { } }; -typedef Handle HandleTypedObject; +using HandleTypedObject = Handle; class OutlineTypedObject : public TypedObject { // The object which owns the data this object points to. Because this diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 267444eef1f8..c105f8e6aae5 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -7716,8 +7716,8 @@ bool CData::GetRuntime(JSContext* cx, unsigned argc, Value* vp) { return true; } -typedef JS::TwoByteCharsZ (*InflateUTF8Method)(JSContext*, const JS::UTF8Chars, - size_t*, arena_id_t); +using InflateUTF8Method = JS::TwoByteCharsZ (*)(JSContext*, const JS::UTF8Chars, + size_t*, arena_id_t); static bool ReadStringCommon(JSContext* cx, InflateUTF8Method inflateUTF8, unsigned argc, Value* vp, const char* funName, diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 499e7af4ce82..73f58a487b82 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -521,7 +521,7 @@ JSObject* CreateInternal(JSContext* cx, HandleObject baseType); JSObject* GetBaseType(JSObject* obj); } // namespace PointerType -typedef UniquePtr UniquePtrFFIType; +using UniquePtrFFIType = UniquePtr; namespace ArrayType { JSObject* CreateInternal(JSContext* cx, HandleObject baseType, size_t length, diff --git a/js/src/debugger/DebugAPI.h b/js/src/debugger/DebugAPI.h index 3337a291a8cb..4cb9eff19778 100644 --- a/js/src/debugger/DebugAPI.h +++ b/js/src/debugger/DebugAPI.h @@ -164,7 +164,7 @@ class DebugAPI { // change due to debugger activity. class ExecutionObservableSet { public: - typedef HashSet::Range ZoneRange; + using ZoneRange = HashSet::Range; virtual Zone* singleZone() const { return nullptr; } virtual JSScript* singleScriptForZoneInvalidation() const { diff --git a/js/src/debugger/Debugger.cpp b/js/src/debugger/Debugger.cpp index ee441187e129..56832a9da2b9 100644 --- a/js/src/debugger/Debugger.cpp +++ b/js/src/debugger/Debugger.cpp @@ -3197,7 +3197,7 @@ bool Debugger::updateExecutionObservabilityOfScripts( observing); } - typedef DebugAPI::ExecutionObservableSet::ZoneRange ZoneRange; + using ZoneRange = DebugAPI::ExecutionObservableSet::ZoneRange; for (ZoneRange r = obs.zones()->all(); !r.empty(); r.popFront()) { if (!UpdateExecutionObservabilityOfScriptsInZone(cx, r.front(), obs, observing)) { @@ -5632,7 +5632,7 @@ class MOZ_STACK_CLASS Debugger::ObjectQuery { * |ubi::Node::BreadthFirst| interface. */ class NodeData {}; - typedef JS::ubi::BreadthFirst Traversal; + using Traversal = JS::ubi::BreadthFirst; bool operator()(Traversal& traversal, JS::ubi::Node origin, const JS::ubi::Edge& edge, NodeData*, bool first) { if (!first) { diff --git a/js/src/debugger/Debugger.h b/js/src/debugger/Debugger.h index d8ded1c37e29..304caf3e92ef 100644 --- a/js/src/debugger/Debugger.h +++ b/js/src/debugger/Debugger.h @@ -341,8 +341,8 @@ extern void CheckDebuggeeThing(JSObject* obj, bool invisibleOk); template class DebuggerWeakMap : private WeakMap, HeapPtr> { private: - typedef HeapPtr Key; - typedef HeapPtr Value; + using Key = HeapPtr; + using Value = HeapPtr; JS::Compartment* compartment; @@ -438,7 +438,7 @@ class MOZ_RAII EvalOptions { * CallObject, LexicalEnvironmentObject, and WithEnvironmentObject, among * others--but environments and objects are really two different concepts. */ -typedef JSObject Env; +using Env = JSObject; // The referent of a Debugger.Script. // diff --git a/js/src/ds/OrderedHashTable.h b/js/src/ds/OrderedHashTable.h index b00ecc437877..4044ee4d773f 100644 --- a/js/src/ds/OrderedHashTable.h +++ b/js/src/ds/OrderedHashTable.h @@ -55,8 +55,8 @@ namespace detail { template class OrderedHashTable { public: - typedef typename Ops::KeyType Key; - typedef typename Ops::Lookup Lookup; + using Key = typename Ops::KeyType; + using Lookup = typename Ops::Lookup; struct Data { T element; @@ -781,7 +781,7 @@ class OrderedHashMap { private: struct MapOps : OrderedHashPolicy { - typedef Key KeyType; + using KeyType = Key; static void makeEmpty(Entry* e) { OrderedHashPolicy::makeEmpty(const_cast(&e->key)); @@ -797,7 +797,7 @@ class OrderedHashMap { Impl impl; public: - typedef typename Impl::Range Range; + using Range = typename Impl::Range; OrderedHashMap(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(std::move(ap), hcs) {} @@ -844,7 +844,7 @@ template class OrderedHashSet { private: struct SetOps : OrderedHashPolicy { - typedef const T KeyType; + using KeyType = const T; static const T& getKey(const T& v) { return v; } static void setKey(const T& e, const T& v) { const_cast(e) = v; } }; @@ -853,7 +853,7 @@ class OrderedHashSet { Impl impl; public: - typedef typename Impl::Range Range; + using Range = typename Impl::Range; explicit OrderedHashSet(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(std::move(ap), hcs) {} diff --git a/js/src/frontend/BinASTRuntimeSupport.h b/js/src/frontend/BinASTRuntimeSupport.h index 6dffb9c922bd..567555ddfb82 100644 --- a/js/src/frontend/BinASTRuntimeSupport.h +++ b/js/src/frontend/BinASTRuntimeSupport.h @@ -59,7 +59,7 @@ struct BinaryASTSupport { } #endif // DEBUG - typedef const CharSlice Lookup; + using Lookup = const CharSlice; static js::HashNumber hash(Lookup l) { return mozilla::HashString(l.start_, l.byteLen_); } diff --git a/js/src/frontend/FunctionTree.h b/js/src/frontend/FunctionTree.h index 0565b590318b..18509a85565c 100644 --- a/js/src/frontend/FunctionTree.h +++ b/js/src/frontend/FunctionTree.h @@ -47,7 +47,7 @@ class FunctionTree { FunctionBox* funbox() { return funbox_; } void setFunctionBox(FunctionBox* node) { funbox_ = node; } - typedef bool (*FunctionTreeVisitorFunction)(ParserBase*, FunctionTree*); + using FunctionTreeVisitorFunction = bool (*)(ParserBase*, FunctionTree*); bool visitRecursively(JSContext* cx, ParserBase* parser, FunctionTreeVisitorFunction func) { if (!CheckRecursionLimit(cx)) { diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h index 651405d1cf41..d55c5061fa07 100644 --- a/js/src/frontend/SourceNotes.h +++ b/js/src/frontend/SourceNotes.h @@ -12,7 +12,7 @@ #include "jstypes.h" -typedef uint8_t jssrcnote; +using jssrcnote = uint8_t; namespace js { diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index f935381fd3b0..b6dbb3dd9d24 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -984,8 +984,8 @@ struct MovableCellHasher> { /* Useful for hashtables with a HeapPtr as key. */ template struct HeapPtrHasher { - typedef HeapPtr Key; - typedef T Lookup; + using Key = HeapPtr; + using Lookup = T; static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } static bool match(const Key& k, Lookup l) { return k.get() == l; } @@ -994,8 +994,8 @@ struct HeapPtrHasher { template struct PreBarrieredHasher { - typedef PreBarriered Key; - typedef T Lookup; + using Key = PreBarriered; + using Lookup = T; static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } static bool match(const Key& k, Lookup l) { return k.get() == l; } @@ -1005,8 +1005,8 @@ struct PreBarrieredHasher { /* Useful for hashtables with a WeakHeapPtr as key. */ template struct WeakHeapPtrHasher { - typedef WeakHeapPtr Key; - typedef T Lookup; + using Key = WeakHeapPtr; + using Lookup = T; static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } static bool match(const Key& k, Lookup l) { return k.unbarrieredGet() == l; } diff --git a/js/src/gc/GC.h b/js/src/gc/GC.h index d561fc459265..92eb3d0fe734 100644 --- a/js/src/gc/GC.h +++ b/js/src/gc/GC.h @@ -73,14 +73,11 @@ extern unsigned NotifyGCPreSwap(JSObject* a, JSObject* b); extern void NotifyGCPostSwap(JSObject* a, JSObject* b, unsigned preResult); -typedef void (*IterateChunkCallback)(JSRuntime* rt, void* data, - gc::Chunk* chunk); -typedef void (*IterateZoneCallback)(JSRuntime* rt, void* data, JS::Zone* zone); -typedef void (*IterateArenaCallback)(JSRuntime* rt, void* data, - gc::Arena* arena, JS::TraceKind traceKind, - size_t thingSize); -typedef void (*IterateCellCallback)(JSRuntime* rt, void* data, - JS::GCCellPtr cellptr, size_t thingSize); +using IterateChunkCallback = void (*)(JSRuntime*, void*, gc::Chunk*); +using IterateZoneCallback = void (*)(JSRuntime*, void*, JS::Zone*); +using IterateArenaCallback = void (*)(JSRuntime*, void*, gc::Arena*, + JS::TraceKind, size_t); +using IterateCellCallback = void (*)(JSRuntime*, void*, JS::GCCellPtr, size_t); /* * This function calls |zoneCallback| on every zone, |realmCallback| on @@ -110,12 +107,10 @@ extern void IterateHeapUnbarrieredForZone( extern void IterateChunks(JSContext* cx, void* data, IterateChunkCallback chunkCallback); -typedef void (*IterateScriptCallback)(JSRuntime* rt, void* data, - JSScript* script, - const JS::AutoRequireNoGC& nogc); -typedef void (*IterateLazyScriptCallback)(JSRuntime* rt, void* data, - LazyScript* lazyScript, - const JS::AutoRequireNoGC& nogc); +using IterateScriptCallback = void (*)(JSRuntime*, void*, JSScript*, + const JS::AutoRequireNoGC&); +using IterateLazyScriptCallback = void (*)(JSRuntime*, void*, LazyScript*, + const JS::AutoRequireNoGC&); /* * Invoke scriptCallback on every in-use script for the given realm or for all diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index 65c77a06a800..dcd4ca781b7b 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -720,7 +720,7 @@ static_assert(ArenaBitmapBytes * ArenasPerChunk == sizeof(ChunkBitmap), static_assert(js::gc::ChunkMarkBitmapBits == ArenaBitmapBits * ArenasPerChunk, "Ensure that the mark bitmap has the right number of bits."); -typedef BitArray PerArenaBitmap; +using PerArenaBitmap = BitArray; const size_t ChunkPadSize = ChunkSize - (sizeof(Arena) * ArenasPerChunk) - sizeof(ChunkBitmap) - sizeof(PerArenaBitmap) - diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index ad237d48d5ea..5725f1cc2647 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -736,11 +736,11 @@ void js::gc::TraceRangeInternal(JSTracer* trc, size_t len, T* vec, namespace js { -typedef bool HasNoImplicitEdgesType; +using HasNoImplicitEdgesType = bool; template struct ImplicitEdgeHolderType { - typedef HasNoImplicitEdgesType Type; + using Type = HasNoImplicitEdgesType; }; // For now, we only handle JSObject* and BaseScript* keys, but the linear time @@ -748,12 +748,12 @@ struct ImplicitEdgeHolderType { // GCMarker::traverse call markImplicitEdges. template <> struct ImplicitEdgeHolderType { - typedef JSObject* Type; + using Type = JSObject*; }; template <> struct ImplicitEdgeHolderType { - typedef BaseScript* Type; + using Type = BaseScript*; }; void GCMarker::markEphemeronValues(gc::Cell* markedCell, diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 8fa499e38d39..79eefddd45a9 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -30,9 +30,9 @@ using namespace js::gc; using JS::AutoGCRooter; -typedef RootedValueMap::Range RootRange; -typedef RootedValueMap::Entry RootEntry; -typedef RootedValueMap::Enum RootEnum; +using RootRange = RootedValueMap::Range; +using RootEntry = RootedValueMap::Entry; +using RootEnum = RootedValueMap::Enum; template using TraceFunction = void (*)(JSTracer* trc, T* ref, const char* name); diff --git a/js/src/gc/Rooting.h b/js/src/gc/Rooting.h index 3bc040e07111..f0f8c4f4c5be 100644 --- a/js/src/gc/Rooting.h +++ b/js/src/gc/Rooting.h @@ -37,65 +37,65 @@ class ModuleObject; // These are internal counterparts to the public types such as HandleObject. -typedef JS::Handle HandleNativeObject; -typedef JS::Handle HandleShape; -typedef JS::Handle HandleObjectGroup; -typedef JS::Handle HandleAtom; -typedef JS::Handle HandleLinearString; -typedef JS::Handle HandlePropertyName; -typedef JS::Handle HandleArrayObject; -typedef JS::Handle HandlePlainObject; -typedef JS::Handle HandleSavedFrame; -typedef JS::Handle HandleScriptSourceObject; -typedef JS::Handle HandleDebuggerArguments; -typedef JS::Handle HandleDebuggerEnvironment; -typedef JS::Handle HandleDebuggerFrame; -typedef JS::Handle HandleDebuggerObject; -typedef JS::Handle HandleDebuggerScript; -typedef JS::Handle HandleDebuggerSource; -typedef JS::Handle HandleScope; -typedef JS::Handle HandleModuleObject; +using HandleNativeObject = JS::Handle; +using HandleShape = JS::Handle; +using HandleObjectGroup = JS::Handle; +using HandleAtom = JS::Handle; +using HandleLinearString = JS::Handle; +using HandlePropertyName = JS::Handle; +using HandleArrayObject = JS::Handle; +using HandlePlainObject = JS::Handle; +using HandleSavedFrame = JS::Handle; +using HandleScriptSourceObject = JS::Handle; +using HandleDebuggerArguments = JS::Handle; +using HandleDebuggerEnvironment = JS::Handle; +using HandleDebuggerFrame = JS::Handle; +using HandleDebuggerObject = JS::Handle; +using HandleDebuggerScript = JS::Handle; +using HandleDebuggerSource = JS::Handle; +using HandleScope = JS::Handle; +using HandleModuleObject = JS::Handle; -typedef JS::MutableHandle MutableHandleShape; -typedef JS::MutableHandle MutableHandleAtom; -typedef JS::MutableHandle MutableHandleNativeObject; -typedef JS::MutableHandle MutableHandlePlainObject; -typedef JS::MutableHandle MutableHandleSavedFrame; -typedef JS::MutableHandle MutableHandleDebuggerArguments; -typedef JS::MutableHandle - MutableHandleDebuggerEnvironment; -typedef JS::MutableHandle MutableHandleDebuggerFrame; -typedef JS::MutableHandle MutableHandleDebuggerObject; -typedef JS::MutableHandle MutableHandleDebuggerScript; -typedef JS::MutableHandle MutableHandleDebuggerSource; -typedef JS::MutableHandle MutableHandleScope; -typedef JS::MutableHandle MutableHandleModuleObject; -typedef JS::MutableHandle MutableHandleArrayObject; +using MutableHandleShape = JS::MutableHandle; +using MutableHandleAtom = JS::MutableHandle; +using MutableHandleNativeObject = JS::MutableHandle; +using MutableHandlePlainObject = JS::MutableHandle; +using MutableHandleSavedFrame = JS::MutableHandle; +using MutableHandleDebuggerArguments = JS::MutableHandle; +using MutableHandleDebuggerEnvironment = + JS::MutableHandle; +using MutableHandleDebuggerFrame = JS::MutableHandle; +using MutableHandleDebuggerObject = JS::MutableHandle; +using MutableHandleDebuggerScript = JS::MutableHandle; +using MutableHandleDebuggerSource = JS::MutableHandle; +using MutableHandleScope = JS::MutableHandle; +using MutableHandleModuleObject = JS::MutableHandle; +using MutableHandleArrayObject = JS::MutableHandle; -typedef JS::Rooted RootedNativeObject; -typedef JS::Rooted RootedShape; -typedef JS::Rooted RootedObjectGroup; -typedef JS::Rooted RootedAtom; -typedef JS::Rooted RootedLinearString; -typedef JS::Rooted RootedPropertyName; -typedef JS::Rooted RootedArrayObject; -typedef JS::Rooted RootedGlobalObject; -typedef JS::Rooted RootedPlainObject; -typedef JS::Rooted RootedSavedFrame; -typedef JS::Rooted RootedScriptSourceObject; -typedef JS::Rooted RootedDebuggerArguments; -typedef JS::Rooted RootedDebuggerEnvironment; -typedef JS::Rooted RootedDebuggerFrame; -typedef JS::Rooted RootedDebuggerObject; -typedef JS::Rooted RootedDebuggerScript; -typedef JS::Rooted RootedDebuggerSource; -typedef JS::Rooted RootedScope; -typedef JS::Rooted RootedModuleObject; +using RootedNativeObject = JS::Rooted; +using RootedShape = JS::Rooted; +using RootedObjectGroup = JS::Rooted; +using RootedAtom = JS::Rooted; +using RootedLinearString = JS::Rooted; +using RootedPropertyName = JS::Rooted; +using RootedArrayObject = JS::Rooted; +using RootedGlobalObject = JS::Rooted; +using RootedPlainObject = JS::Rooted; +using RootedSavedFrame = JS::Rooted; +using RootedScriptSourceObject = JS::Rooted; +using RootedDebuggerArguments = JS::Rooted; +using RootedDebuggerEnvironment = JS::Rooted; +using RootedDebuggerFrame = JS::Rooted; +using RootedDebuggerObject = JS::Rooted; +using RootedDebuggerScript = JS::Rooted; +using RootedDebuggerSource = JS::Rooted; +using RootedScope = JS::Rooted; +using RootedModuleObject = JS::Rooted; -typedef JS::GCVector FunctionVector; -typedef JS::GCVector PropertyNameVector; -typedef JS::GCVector ShapeVector; -typedef JS::GCVector StringVector; +using FunctionVector = JS::GCVector; +using PropertyNameVector = JS::GCVector; +using ShapeVector = JS::GCVector; +using StringVector = JS::GCVector; /** * Interface substitute for Rooted which does not root the variable's @@ -168,9 +168,9 @@ class MaybeRooted {}; template class MaybeRooted { public: - typedef JS::Handle HandleType; - typedef JS::Rooted RootType; - typedef JS::MutableHandle MutableHandleType; + using HandleType = JS::Handle; + using RootType = JS::Rooted; + using MutableHandleType = JS::MutableHandle; static inline JS::Handle toHandle(HandleType v) { return v; } @@ -187,9 +187,9 @@ class MaybeRooted { template class MaybeRooted { public: - typedef const T& HandleType; - typedef FakeRooted RootType; - typedef FakeMutableHandle MutableHandleType; + using HandleType = const T&; + using RootType = FakeRooted; + using MutableHandleType = FakeMutableHandle; static JS::Handle toHandle(HandleType v) { MOZ_CRASH("Bad conversion"); } diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index 086336a121a4..97899c7175fd 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -236,7 +236,7 @@ class StoreBuffer { template struct PointerEdgeHasher { - typedef Edge Lookup; + using Lookup = Edge; static HashNumber hash(const Lookup& l) { return mozilla::HashGeneric(l.edge); } @@ -294,7 +294,7 @@ class StoreBuffer { explicit operator bool() const { return edge != nullptr; } - typedef PointerEdgeHasher Hasher; + using Hasher = PointerEdgeHasher; }; struct SlotsEdge { @@ -370,7 +370,7 @@ class StoreBuffer { explicit operator bool() const { return objectAndKind_ != 0; } typedef struct Hasher { - typedef SlotsEdge Lookup; + using Lookup = SlotsEdge; static HashNumber hash(const Lookup& l) { return mozilla::HashGeneric(l.objectAndKind_, l.start_, l.count_); } diff --git a/js/src/gc/WeakMapPtr.cpp b/js/src/gc/WeakMapPtr.cpp index b56c82fac0fe..89eab42a9d5a 100644 --- a/js/src/gc/WeakMapPtr.cpp +++ b/js/src/gc/WeakMapPtr.cpp @@ -35,10 +35,10 @@ struct DataType { template struct Utils { - typedef typename DataType::BarrieredType KeyType; - typedef typename DataType::BarrieredType ValueType; + using KeyType = typename DataType::BarrieredType; + using ValueType = typename DataType::BarrieredType; typedef WeakMap Type; - typedef Type* PtrType; + using PtrType = Type*; static PtrType cast(void* ptr) { return static_cast(ptr); } }; @@ -89,7 +89,7 @@ bool JS::WeakMapPtr::put(JSContext* cx, const K& key, const V& value) { template V JS::WeakMapPtr::removeValue(const K& key) { typedef typename WeakMapDetails::Utils::Type Map; - typedef typename Map::Ptr Ptr; + using Ptr = typename Map::Ptr; MOZ_ASSERT(initialized()); diff --git a/js/src/jit/BacktrackingAllocator.h b/js/src/jit/BacktrackingAllocator.h index bcc9da759cc8..440151432aa4 100644 --- a/js/src/jit/BacktrackingAllocator.h +++ b/js/src/jit/BacktrackingAllocator.h @@ -152,7 +152,7 @@ struct UsePosition : public TempObject, } }; -typedef InlineForwardListIterator UsePositionIterator; +using UsePositionIterator = InlineForwardListIterator; // Backtracking allocator data structures overview. // @@ -186,8 +186,8 @@ class LiveRange : public TempObject { class BundleLink : public InlineForwardListNode {}; class RegisterLink : public InlineForwardListNode {}; - typedef InlineForwardListIterator BundleLinkIterator; - typedef InlineForwardListIterator RegisterLinkIterator; + using BundleLinkIterator = InlineForwardListIterator; + using RegisterLinkIterator = InlineForwardListIterator; // Links in the lists in LiveBundle and VirtualRegister. BundleLink bundleLink; @@ -573,7 +573,7 @@ class BacktrackingAllocator : protected RegisterAllocator { }; // Ranges where all registers must be spilled due to call instructions. - typedef InlineList CallRangeList; + using CallRangeList = InlineList; CallRangeList callRangesList; SplayTree callRanges; @@ -586,7 +586,7 @@ class BacktrackingAllocator : protected RegisterAllocator { SpillSlot(uint32_t slot, LifoAlloc* alloc) : alloc(slot), allocated(alloc) {} }; - typedef InlineForwardList SpillSlotList; + using SpillSlotList = InlineForwardList; // All allocated slots of each width. SpillSlotList normalSlots, doubleSlots, quadSlots; diff --git a/js/src/jit/BaselineDebugModeOSR.cpp b/js/src/jit/BaselineDebugModeOSR.cpp index 67136b0a2728..5d2189e508e3 100644 --- a/js/src/jit/BaselineDebugModeOSR.cpp +++ b/js/src/jit/BaselineDebugModeOSR.cpp @@ -53,7 +53,7 @@ struct DebugModeOSREntry { } }; -typedef Vector DebugModeOSREntryVector; +using DebugModeOSREntryVector = Vector; class UniqueScriptOSREntryIter { const DebugModeOSREntryVector& entries_; @@ -519,7 +519,7 @@ bool jit::RecompileOnStackBaselineScriptsForDebugMode( return false; } } else { - typedef DebugAPI::ExecutionObservableSet::ZoneRange ZoneRange; + using ZoneRange = DebugAPI::ExecutionObservableSet::ZoneRange; for (ZoneRange r = obs.zones()->all(); !r.empty(); r.popFront()) { if (!InvalidateScriptsInZone(cx, r.front(), entries)) { return false; diff --git a/js/src/jit/InlineList.h b/js/src/jit/InlineList.h index 7d8aa02e7e74..cfb7dae3ded9 100644 --- a/js/src/jit/InlineList.h +++ b/js/src/jit/InlineList.h @@ -35,7 +35,7 @@ template class InlineForwardList : protected InlineForwardListNode { friend class InlineForwardListIterator; - typedef InlineForwardListNode Node; + using Node = InlineForwardListNode; Node* tail_; #ifdef DEBUG @@ -52,7 +52,7 @@ class InlineForwardList : protected InlineForwardListNode { } public: - typedef InlineForwardListIterator iterator; + using iterator = InlineForwardListIterator; public: iterator begin() const { return iterator(this); } @@ -144,7 +144,7 @@ class InlineForwardListIterator { private: friend class InlineForwardList; - typedef InlineForwardListNode Node; + using Node = InlineForwardListNode; explicit InlineForwardListIterator(const InlineForwardList* owner) : prev(const_cast(static_cast(owner))), @@ -252,14 +252,14 @@ class InlineListNode : public InlineForwardListNode { template class InlineList : protected InlineListNode { - typedef InlineListNode Node; + using Node = InlineListNode; public: InlineList() : InlineListNode(this, this) {} public: - typedef InlineListIterator iterator; - typedef InlineListReverseIterator reverse_iterator; + using iterator = InlineListIterator; + using reverse_iterator = InlineListReverseIterator; public: iterator begin() const { return iterator(static_cast(this->next)); } @@ -351,7 +351,7 @@ class InlineListIterator { private: friend class InlineList; - typedef InlineListNode Node; + using Node = InlineListNode; explicit InlineListIterator(const Node* iter) : iter(const_cast(iter)) {} @@ -393,7 +393,7 @@ class InlineListReverseIterator { private: friend class InlineList; - typedef InlineListNode Node; + using Node = InlineListNode; explicit InlineListReverseIterator(const Node* iter) : iter(const_cast(iter)) {} @@ -438,14 +438,14 @@ class InlineConcatListIterator; template class InlineConcatList { private: - typedef InlineConcatList Node; + using Node = InlineConcatList; InlineConcatList* thisFromConstructor() { return this; } public: InlineConcatList() : next(nullptr), tail(thisFromConstructor()) {} - typedef InlineConcatListIterator iterator; + using iterator = InlineConcatListIterator; iterator begin() const { return iterator(this); } @@ -473,7 +473,7 @@ class InlineConcatListIterator { private: friend class InlineConcatList; - typedef InlineConcatList Node; + using Node = InlineConcatList; explicit InlineConcatListIterator(const Node* iter) : iter(const_cast(iter)) {} @@ -510,7 +510,7 @@ class InlineSpaghettiStackIterator; template class InlineSpaghettiStackNode : public InlineForwardListNode { - typedef InlineForwardListNode Parent; + using Parent = InlineForwardListNode; public: InlineSpaghettiStackNode() : Parent() {} @@ -529,13 +529,13 @@ template class InlineSpaghettiStack : protected InlineSpaghettiStackNode { friend class InlineSpaghettiStackIterator; - typedef InlineSpaghettiStackNode Node; + using Node = InlineSpaghettiStackNode; public: InlineSpaghettiStack() {} public: - typedef InlineSpaghettiStackIterator iterator; + using iterator = InlineSpaghettiStackIterator; public: iterator begin() const { return iterator(this); } @@ -557,7 +557,7 @@ class InlineSpaghettiStackIterator { private: friend class InlineSpaghettiStack; - typedef InlineSpaghettiStackNode Node; + using Node = InlineSpaghettiStackNode; explicit InlineSpaghettiStackIterator(const InlineSpaghettiStack* owner) : iter(owner ? static_cast(owner->next) : nullptr) {} diff --git a/js/src/jit/IonTypes.h b/js/src/jit/IonTypes.h index ebda5bd201f1..f5003c669a11 100644 --- a/js/src/jit/IonTypes.h +++ b/js/src/jit/IonTypes.h @@ -42,9 +42,9 @@ class IonCompilationId { namespace jit { -typedef uint32_t RecoverOffset; -typedef uint32_t SnapshotOffset; -typedef uint32_t BailoutId; +using RecoverOffset = uint32_t; +using SnapshotOffset = uint32_t; +using BailoutId = uint32_t; // The maximum size of any buffer associated with an assembler or code object. // This is chosen to not overflow a signed integer, leaving room for an extra @@ -414,7 +414,7 @@ class SimdConstant { bool operator!=(const SimdConstant& rhs) const { return !operator==(rhs); } // SimdConstant is a HashPolicy - typedef SimdConstant Lookup; + using Lookup = SimdConstant; static HashNumber hash(const SimdConstant& val) { uint32_t hash = mozilla::HashBytes(&val.u, sizeof(val.u)); return mozilla::AddToHash(hash, val.type_); @@ -923,7 +923,7 @@ enum class RoundingMode { Down, Up, NearestTiesToEven, TowardsZero }; static const uint32_t MAX_UNCHECKED_LEAF_FRAME_SIZE = 64; // Truncating conversion modifiers. -typedef uint32_t TruncFlags; +using TruncFlags = uint32_t; static const TruncFlags TRUNC_UNSIGNED = TruncFlags(1) << 0; static const TruncFlags TRUNC_SATURATING = TruncFlags(1) << 1; diff --git a/js/src/jit/JSJitFrameIter.h b/js/src/jit/JSJitFrameIter.h index 57e7de586c03..2dcebfbda73a 100644 --- a/js/src/jit/JSJitFrameIter.h +++ b/js/src/jit/JSJitFrameIter.h @@ -23,7 +23,7 @@ class ArgumentsObject; namespace jit { -typedef void* CalleeToken; +using CalleeToken = void*; enum class FrameType { // A JS frame is analogous to a js::InterpreterFrame, representing one diff --git a/js/src/jit/JitRealm.h b/js/src/jit/JitRealm.h index 146f87c13bbe..ecc35ffbc744 100644 --- a/js/src/jit/JitRealm.h +++ b/js/src/jit/JitRealm.h @@ -120,10 +120,8 @@ class BaselineICFallbackCode { enum class DebugTrapHandlerKind { Interpreter, Compiler, Count }; -typedef void (*EnterJitCode)(void* code, unsigned argc, Value* argv, - InterpreterFrame* fp, CalleeToken calleeToken, - JSObject* envChain, size_t numStackValues, - Value* vp); +using EnterJitCode = void (*)(void*, unsigned int, Value*, InterpreterFrame*, + CalleeToken, JSObject*, size_t, Value*); class JitcodeGlobalTable; diff --git a/js/src/jit/JitcodeMap.cpp b/js/src/jit/JitcodeMap.cpp index 26b7bc635ce6..d24406d4026f 100644 --- a/js/src/jit/JitcodeMap.cpp +++ b/js/src/jit/JitcodeMap.cpp @@ -1119,7 +1119,7 @@ uint32_t JitcodeRegionEntry::findPcOffset(uint32_t queryNativeOffset, bool JitcodeIonTable::makeIonEntry(JSContext* cx, JitCode* code, uint32_t numScripts, JSScript** scripts, JitcodeGlobalEntry::IonEntry& out) { - typedef JitcodeGlobalEntry::IonEntry::SizedScriptList SizedScriptList; + using SizedScriptList = JitcodeGlobalEntry::IonEntry::SizedScriptList; MOZ_ASSERT(numScripts > 0); diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index 03237e9b5010..33b06e08d5aa 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -819,8 +819,8 @@ class LElementVisitor { : ins_(nullptr), lastPC_(nullptr), lastNotInlinedPC_(nullptr) {} }; -typedef InlineList::iterator LInstructionIterator; -typedef InlineList::reverse_iterator LInstructionReverseIterator; +using LInstructionIterator = InlineList::iterator; +using LInstructionReverseIterator = InlineList::reverse_iterator; class MPhi; @@ -1291,8 +1291,8 @@ struct SafepointNunboxEntry { }; class LSafepoint : public TempObject { - typedef SafepointSlotEntry SlotEntry; - typedef SafepointNunboxEntry NunboxEntry; + using SlotEntry = SafepointSlotEntry; + using NunboxEntry = SafepointNunboxEntry; public: typedef Vector SlotList; @@ -1707,7 +1707,7 @@ class LInstruction::InputIterator { class LIRGraph { struct ValueHasher { - typedef Value Lookup; + using Lookup = Value; static HashNumber hash(const Value& v) { return HashNumber(v.asRawBits()); } static bool match(const Value& lhs, const Value& rhs) { return lhs == rhs; } }; diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 123403307ca7..310ec7e60e91 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -251,7 +251,7 @@ class MUse : public TempObject, public InlineListNode { #endif }; -typedef InlineList::iterator MUseIterator; +using MUseIterator = InlineList::iterator; // A node is an entry in the MIR graph. It has two kinds: // MInstruction: an instruction which appears in the IR stream. @@ -975,13 +975,13 @@ class CompilerGCPointer { CompilerGCPointer& operator=(const CompilerGCPointer&) = delete; }; -typedef CompilerGCPointer CompilerObject; -typedef CompilerGCPointer CompilerNativeObject; -typedef CompilerGCPointer CompilerFunction; -typedef CompilerGCPointer CompilerScript; -typedef CompilerGCPointer CompilerPropertyName; -typedef CompilerGCPointer CompilerShape; -typedef CompilerGCPointer CompilerObjectGroup; +using CompilerObject = CompilerGCPointer; +using CompilerNativeObject = CompilerGCPointer; +using CompilerFunction = CompilerGCPointer; +using CompilerScript = CompilerGCPointer; +using CompilerPropertyName = CompilerGCPointer; +using CompilerShape = CompilerGCPointer; +using CompilerObjectGroup = CompilerGCPointer; class MRootList : public TempObject { public: @@ -1321,7 +1321,7 @@ class MVariadicT : public T { } }; -typedef MVariadicT MVariadicInstruction; +using MVariadicInstruction = MVariadicT; // Generates an LSnapshot without further effect. class MStart : public MNullaryInstruction { @@ -10294,7 +10294,7 @@ struct MStoreToRecover : public TempObject, explicit MStoreToRecover(MDefinition* operand) : operand(operand) {} }; -typedef InlineSpaghettiStack MStoresToRecoverList; +using MStoresToRecoverList = InlineSpaghettiStack; // A resume point contains the information needed to reconstruct the Baseline // state from a position in the JIT. See the big comment near resumeAfter() in diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index 74be6745e4dd..26871be60e09 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -24,9 +24,9 @@ class MStart; class MDefinitionIterator; -typedef InlineListIterator MInstructionIterator; -typedef InlineListReverseIterator MInstructionReverseIterator; -typedef InlineListIterator MPhiIterator; +using MInstructionIterator = InlineListIterator; +using MInstructionReverseIterator = InlineListReverseIterator; +using MPhiIterator = InlineListIterator; #ifdef DEBUG typedef InlineForwardListIterator MResumePointIterator; @@ -703,9 +703,9 @@ class MBasicBlock : public TempObject, public InlineListNode { #endif }; -typedef InlineListIterator MBasicBlockIterator; -typedef InlineListIterator ReversePostorderIterator; -typedef InlineListReverseIterator PostorderIterator; +using MBasicBlockIterator = InlineListIterator; +using ReversePostorderIterator = InlineListIterator; +using PostorderIterator = InlineListReverseIterator; typedef Vector MIRGraphReturns; diff --git a/js/src/jit/MoveResolver.h b/js/src/jit/MoveResolver.h index 61436d850697..8f6b10922e5e 100644 --- a/js/src/jit/MoveResolver.h +++ b/js/src/jit/MoveResolver.h @@ -255,7 +255,7 @@ class MoveResolver { } }; - typedef InlineList::iterator PendingMoveIterator; + using PendingMoveIterator = InlineList::iterator; js::Vector orderedMoves_; int numCycles_; diff --git a/js/src/jit/RegisterAllocator.h b/js/src/jit/RegisterAllocator.h index d5160b54a752..00ecdd7bd086 100644 --- a/js/src/jit/RegisterAllocator.h +++ b/js/src/jit/RegisterAllocator.h @@ -93,7 +93,7 @@ struct AllocationIntegrityState { // Order of insertion into seen, for sorting. uint32_t index; - typedef IntegrityItem Lookup; + using Lookup = IntegrityItem; static HashNumber hash(const IntegrityItem& item) { HashNumber hash = item.alloc.hash(); hash = mozilla::RotateLeft(hash, 4) ^ item.vreg; diff --git a/js/src/jit/RegisterSets.h b/js/src/jit/RegisterSets.h index 9d3f82319b0e..9f5975f8d77c 100644 --- a/js/src/jit/RegisterSets.h +++ b/js/src/jit/RegisterSets.h @@ -19,7 +19,7 @@ namespace js { namespace jit { struct AnyRegister { - typedef uint8_t Code; + using Code = uint8_t; static const uint8_t Total = Registers::Total + FloatRegisters::Total; static const uint8_t Invalid = UINT8_MAX; @@ -250,8 +250,8 @@ class ConstantOrRegister { template class TypedRegisterSet { public: - typedef T RegType; - typedef typename T::SetType SetType; + using RegType = T; + using SetType = typename T::SetType; private: SetType bits_; @@ -339,8 +339,8 @@ class TypedRegisterSet { uint32_t getPushSizeInBytes() const { return T::GetPushSizeInBytes(*this); } }; -typedef TypedRegisterSet GeneralRegisterSet; -typedef TypedRegisterSet FloatRegisterSet; +using GeneralRegisterSet = TypedRegisterSet; +using FloatRegisterSet = TypedRegisterSet; class AnyRegisterIterator; @@ -473,9 +473,9 @@ class LiveSet; template class AllocatableSetAccessors { public: - typedef Set RegSet; - typedef typename RegSet::RegType RegType; - typedef typename RegSet::SetType SetType; + using RegSet = Set; + using RegType = typename RegSet::RegType; + using SetType = typename RegSet::SetType; protected: RegSet set_; @@ -506,9 +506,9 @@ class AllocatableSetAccessors { template <> class AllocatableSetAccessors { public: - typedef RegisterSet RegSet; - typedef AnyRegister RegType; - typedef char SetType; + using RegSet = RegisterSet; + using RegType = AnyRegister; + using SetType = char; protected: RegisterSet set_; @@ -555,9 +555,9 @@ class AllocatableSetAccessors { template class LiveSetAccessors { public: - typedef Set RegSet; - typedef typename RegSet::RegType RegType; - typedef typename RegSet::SetType SetType; + using RegSet = Set; + using RegType = typename RegSet::RegType; + using SetType = typename RegSet::SetType; protected: RegSet set_; @@ -583,9 +583,9 @@ class LiveSetAccessors { template <> class LiveSetAccessors { public: - typedef RegisterSet RegSet; - typedef AnyRegister RegType; - typedef char SetType; + using RegSet = RegisterSet; + using RegType = AnyRegister; + using SetType = char; protected: RegisterSet set_; @@ -631,7 +631,7 @@ class LiveSetAccessors { // |takeAny| variants. template class SpecializedRegSet : public Accessors { - typedef Accessors Parent; + using Parent = Accessors; public: DEFINE_ACCESSOR_CONSTRUCTORS_(SpecializedRegSet) @@ -740,7 +740,7 @@ class SpecializedRegSet : public Accessors { // Specialization of the accessors for the RegisterSet aggregate. template class SpecializedRegSet : public Accessors { - typedef Accessors Parent; + using Parent = Accessors; public: DEFINE_ACCESSOR_CONSTRUCTORS_(SpecializedRegSet) @@ -1007,13 +1007,13 @@ class AllocatableSet #undef DEFINE_ACCESSOR_CONSTRUCTORS_FOR_REGISTERSET_ #undef DEFINE_ACCESSOR_CONSTRUCTORS_ -typedef AllocatableSet AllocatableGeneralRegisterSet; -typedef AllocatableSet AllocatableFloatRegisterSet; -typedef AllocatableSet AllocatableRegisterSet; +using AllocatableGeneralRegisterSet = AllocatableSet; +using AllocatableFloatRegisterSet = AllocatableSet; +using AllocatableRegisterSet = AllocatableSet; -typedef LiveSet LiveGeneralRegisterSet; -typedef LiveSet LiveFloatRegisterSet; -typedef LiveSet LiveRegisterSet; +using LiveGeneralRegisterSet = LiveSet; +using LiveFloatRegisterSet = LiveSet; +using LiveRegisterSet = LiveSet; // iterates in whatever order happens to be convenient. // Use TypedRegisterBackwardIterator or TypedRegisterForwardIterator if a @@ -1080,14 +1080,14 @@ class TypedRegisterForwardIterator { T operator*() const { return regset_.template getFirst(); } }; -typedef TypedRegisterIterator GeneralRegisterIterator; -typedef TypedRegisterIterator FloatRegisterIterator; -typedef TypedRegisterBackwardIterator GeneralRegisterBackwardIterator; -typedef TypedRegisterBackwardIterator - FloatRegisterBackwardIterator; -typedef TypedRegisterForwardIterator GeneralRegisterForwardIterator; -typedef TypedRegisterForwardIterator - FloatRegisterForwardIterator; +using GeneralRegisterIterator = TypedRegisterIterator; +using FloatRegisterIterator = TypedRegisterIterator; +using GeneralRegisterBackwardIterator = TypedRegisterBackwardIterator; +using FloatRegisterBackwardIterator = + TypedRegisterBackwardIterator; +using GeneralRegisterForwardIterator = TypedRegisterForwardIterator; +using FloatRegisterForwardIterator = + TypedRegisterForwardIterator; class AnyRegisterIterator { GeneralRegisterIterator geniter_; diff --git a/js/src/jit/Registers.h b/js/src/jit/Registers.h index 17270ee72aae..63d9b3896a19 100644 --- a/js/src/jit/Registers.h +++ b/js/src/jit/Registers.h @@ -30,10 +30,10 @@ namespace js { namespace jit { struct Register { - typedef Registers Codes; - typedef Codes::Encoding Encoding; - typedef Codes::Code Code; - typedef Codes::SetType SetType; + using Codes = Registers; + using Encoding = Codes::Encoding; + using Code = Codes::Code; + using SetType = Codes::SetType; Encoding reg_; explicit constexpr Register(Encoding e) : reg_(e) {} @@ -138,7 +138,7 @@ inline bool operator!=(RegisterOrSP lhs, RegisterOrSP rhs) { // just Register, and return false for IsHiddenSP(r) for any r so that we use // "normal" code for handling the SP. This reduces ifdeffery throughout the // jit. -typedef Register RegisterOrSP; +using RegisterOrSP = Register; static inline bool IsHiddenSP(RegisterOrSP r) { return false; } @@ -300,8 +300,8 @@ struct AutoGenericRegisterScope : public RegisterType { #endif }; -typedef AutoGenericRegisterScope AutoRegisterScope; -typedef AutoGenericRegisterScope AutoFloatRegisterScope; +using AutoRegisterScope = AutoGenericRegisterScope; +using AutoFloatRegisterScope = AutoGenericRegisterScope; } // namespace jit } // namespace js diff --git a/js/src/jit/ScalarReplacement.cpp b/js/src/jit/ScalarReplacement.cpp index ed26399929ba..9a524f1bd110 100644 --- a/js/src/jit/ScalarReplacement.cpp +++ b/js/src/jit/ScalarReplacement.cpp @@ -22,7 +22,7 @@ namespace jit { template class EmulateStateOf { private: - typedef typename MemoryView::BlockState BlockState; + using BlockState = typename MemoryView::BlockState; MIRGenerator* mir_; MIRGraph& graph_; @@ -270,7 +270,7 @@ static bool IsObjectEscaped(MInstruction* ins, JSObject* objDefault) { class ObjectMemoryView : public MDefinitionVisitorDefaultNoop { public: - typedef MObjectState BlockState; + using BlockState = MObjectState; static const char phaseName[]; private: @@ -916,7 +916,7 @@ static bool IsArrayEscaped(MInstruction* ins, MInstruction* newArray) { // replace all reference of the allocation by the MArrayState definition. class ArrayMemoryView : public MDefinitionVisitorDefaultNoop { public: - typedef MArrayState BlockState; + using BlockState = MArrayState; static const char* phaseName; private: diff --git a/js/src/jit/Snapshots.h b/js/src/jit/Snapshots.h index b06803a971aa..b5dc4faca038 100644 --- a/js/src/jit/Snapshots.h +++ b/js/src/jit/Snapshots.h @@ -339,8 +339,8 @@ class RValueAllocation { HashNumber hash() const; struct Hasher { - typedef RValueAllocation Key; - typedef Key Lookup; + using Key = RValueAllocation; + using Lookup = Key; static HashNumber hash(const Lookup& v) { return v.hash(); } static bool match(const Key& k, const Lookup& l) { return k == l; } }; @@ -356,7 +356,7 @@ class SnapshotWriter { // Map RValueAllocations to an offset in the allocWriter_ buffer. This is // useful as value allocations are repeated frequently. - typedef RValueAllocation RVA; + using RVA = RValueAllocation; typedef HashMap RValueAllocMap; RValueAllocMap allocMap_; diff --git a/js/src/jit/StupidAllocator.h b/js/src/jit/StupidAllocator.h index 88d59ec44c5d..0e5e112bc6c4 100644 --- a/js/src/jit/StupidAllocator.h +++ b/js/src/jit/StupidAllocator.h @@ -45,7 +45,7 @@ class StupidAllocator : public RegisterAllocator { uint32_t registerCount; // Type indicating an index into registers. - typedef uint32_t RegisterIndex; + using RegisterIndex = uint32_t; // Information about each virtual register. Vector virtualRegisters; diff --git a/js/src/jit/TypePolicy.h b/js/src/jit/TypePolicy.h index 8f7c2fc00f68..82630a768e7c 100644 --- a/js/src/jit/TypePolicy.h +++ b/js/src/jit/TypePolicy.h @@ -367,7 +367,7 @@ class ObjectPolicy final : public TypePolicy { // Single-object input. If the input is a Value, it is unboxed. If it is // a primitive, we use ValueToNonNullObject. -typedef ObjectPolicy<0> SingleObjectPolicy; +using SingleObjectPolicy = ObjectPolicy<0>; template class BoxPolicy final : public TypePolicy { diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index 5664e3d0d71e..84a5d56106d4 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -773,19 +773,19 @@ struct LastArg; template <> struct LastArg<> { - typedef void Type; + using Type = void; static constexpr size_t nbArgs = 0; }; template struct LastArg { - typedef HeadType Type; + using Type = HeadType; static constexpr size_t nbArgs = 1; }; template struct LastArg { - typedef typename LastArg::Type Type; + using Type = typename LastArg::Type; static constexpr size_t nbArgs = LastArg::nbArgs + 1; }; diff --git a/js/src/jit/ValueNumbering.h b/js/src/jit/ValueNumbering.h index f874a0d57e0a..932a7b676a38 100644 --- a/js/src/jit/ValueNumbering.h +++ b/js/src/jit/ValueNumbering.h @@ -25,8 +25,8 @@ class ValueNumberer { class VisibleValues { // Hash policy for ValueSet. struct ValueHasher { - typedef const MDefinition* Lookup; - typedef MDefinition* Key; + using Lookup = const MDefinition*; + using Key = MDefinition*; static HashNumber hash(Lookup ins); static bool match(Key k, Lookup l); static void rekey(Key& k, Key newKey); @@ -39,8 +39,8 @@ class ValueNumberer { public: explicit VisibleValues(TempAllocator& alloc); - typedef ValueSet::Ptr Ptr; - typedef ValueSet::AddPtr AddPtr; + using Ptr = ValueSet::Ptr; + using AddPtr = ValueSet::AddPtr; Ptr findLeader(const MDefinition* def) const; AddPtr findLeaderForAdd(MDefinition* def); diff --git a/js/src/jit/x64/BaseAssembler-x64.h b/js/src/jit/x64/BaseAssembler-x64.h index 5d2c1c724d65..196efd6d0a3f 100644 --- a/js/src/jit/x64/BaseAssembler-x64.h +++ b/js/src/jit/x64/BaseAssembler-x64.h @@ -983,7 +983,7 @@ class BaseAssemblerX64 : public BaseAssembler { } }; -typedef BaseAssemblerX64 BaseAssemblerSpecific; +using BaseAssemblerSpecific = BaseAssemblerX64; } // namespace X86Encoding diff --git a/js/src/jit/x64/CodeGenerator-x64.h b/js/src/jit/x64/CodeGenerator-x64.h index f66fa57c5499..027d5a6540ad 100644 --- a/js/src/jit/x64/CodeGenerator-x64.h +++ b/js/src/jit/x64/CodeGenerator-x64.h @@ -31,7 +31,7 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared { void emitWasmStore(T* ins); }; -typedef CodeGeneratorX64 CodeGeneratorSpecific; +using CodeGeneratorSpecific = CodeGeneratorX64; } // namespace jit } // namespace js diff --git a/js/src/jit/x64/Lowering-x64.h b/js/src/jit/x64/Lowering-x64.h index 455c529cd836..4093f92459c3 100644 --- a/js/src/jit/x64/Lowering-x64.h +++ b/js/src/jit/x64/Lowering-x64.h @@ -50,7 +50,7 @@ class LIRGeneratorX64 : public LIRGeneratorX86Shared { void lowerUModI64(MMod* mod); }; -typedef LIRGeneratorX64 LIRGeneratorSpecific; +using LIRGeneratorSpecific = LIRGeneratorX64; } // namespace jit } // namespace js diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index c123a79ff720..9bc4806e748c 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -1022,7 +1022,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { void profilerExitFrame(); }; -typedef MacroAssemblerX64 MacroAssemblerSpecific; +using MacroAssemblerSpecific = MacroAssemblerX64; } // namespace jit } // namespace js diff --git a/js/src/jit/x86-shared/Architecture-x86-shared.h b/js/src/jit/x86-shared/Architecture-x86-shared.h index e7b9c9ef2728..1091263d007b 100644 --- a/js/src/jit/x86-shared/Architecture-x86-shared.h +++ b/js/src/jit/x86-shared/Architecture-x86-shared.h @@ -66,8 +66,8 @@ static const uint32_t JumpImmediateRange = INT32_MAX; class Registers { public: - typedef uint8_t Code; - typedef X86Encoding::RegisterID Encoding; + using Code = uint8_t; + using Encoding = X86Encoding::RegisterID; // Content spilled during bailouts. union RegisterContent { @@ -75,7 +75,7 @@ class Registers { }; #if defined(JS_CODEGEN_X86) - typedef uint8_t SetType; + using SetType = uint8_t; static const char* GetName(Code code) { return X86Encoding::GPRegName(Encoding(code)); @@ -86,7 +86,7 @@ class Registers { static const uint32_t Allocatable = 7; #elif defined(JS_CODEGEN_X64) - typedef uint16_t SetType; + using SetType = uint16_t; static const char* GetName(Code code) { static const char* const Names[] = { @@ -180,11 +180,11 @@ class Registers { static const SetType AllocatableMask = AllMask & ~NonAllocatableMask; }; -typedef Registers::SetType PackedRegisterMask; +using PackedRegisterMask = Registers::SetType; class FloatRegisters { public: - typedef X86Encoding::XMMRegisterID Encoding; + using Encoding = X86Encoding::XMMRegisterID; enum ContentType { Single, // 32-bit float. @@ -220,12 +220,12 @@ class FloatRegisters { static const uint32_t Total = 8 * NumTypes; static const uint32_t TotalPhys = 8; static const uint32_t Allocatable = 7; - typedef uint32_t SetType; + using SetType = uint32_t; #elif defined(JS_CODEGEN_X64) static const uint32_t Total = 16 * NumTypes; static const uint32_t TotalPhys = 16; static const uint32_t Allocatable = 15; - typedef uint64_t SetType; + using SetType = uint64_t; #endif static_assert(sizeof(SetType) * 8 >= Total, @@ -279,10 +279,10 @@ template class TypedRegisterSet; struct FloatRegister { - typedef FloatRegisters Codes; - typedef size_t Code; - typedef Codes::Encoding Encoding; - typedef Codes::SetType SetType; + using Codes = FloatRegisters; + using Code = size_t; + using Encoding = Codes::Encoding; + using SetType = Codes::SetType; static uint32_t SetSize(SetType x) { // Count the number of non-aliased registers, for the moment. // diff --git a/js/src/jit/x86-shared/Assembler-x86-shared.h b/js/src/jit/x86-shared/Assembler-x86-shared.h index b155dc7dc376..0aba5cf63170 100644 --- a/js/src/jit/x86-shared/Assembler-x86-shared.h +++ b/js/src/jit/x86-shared/Assembler-x86-shared.h @@ -285,8 +285,8 @@ class AssemblerX86Shared : public AssemblerShared { protected: X86Encoding::BaseAssemblerSpecific masm; - typedef X86Encoding::JmpSrc JmpSrc; - typedef X86Encoding::JmpDst JmpDst; + using JmpSrc = X86Encoding::JmpSrc; + using JmpDst = X86Encoding::JmpDst; public: AssemblerX86Shared() { diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp b/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp index 47992bfcc15d..23ec62ace035 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp @@ -121,7 +121,7 @@ const MacroAssembler& MacroAssemblerX86Shared::asMasm() const { template T* MacroAssemblerX86Shared::getConstant(const typename T::Pod& value, Map& map, Vector& vec) { - typedef typename Map::AddPtr AddPtr; + using AddPtr = typename Map::AddPtr; size_t index; if (AddPtr p = map.lookupForAdd(value)) { index = p->value(); diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h index 01455aac8be7..ac870db49fa8 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h @@ -34,7 +34,7 @@ class MacroAssemblerX86Shared : public Assembler { // knows what to use instead of copying these data structures. template struct Constant { - typedef T Pod; + using Pod = T; T value; UsesVector uses; diff --git a/js/src/jit/x86-shared/MoveEmitter-x86-shared.h b/js/src/jit/x86-shared/MoveEmitter-x86-shared.h index d2a9e6ba0200..1a4e74db432e 100644 --- a/js/src/jit/x86-shared/MoveEmitter-x86-shared.h +++ b/js/src/jit/x86-shared/MoveEmitter-x86-shared.h @@ -67,7 +67,7 @@ class MoveEmitterX86 { size_t i); }; -typedef MoveEmitterX86 MoveEmitter; +using MoveEmitter = MoveEmitterX86; } // namespace jit } // namespace js diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 385951bf7d92..2bdcb23222b5 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -99,7 +99,7 @@ class MOZ_RAII JS_PUBLIC_API CustomAutoRooter : private AutoGCRooter { /************************************************************************/ -typedef bool (*JSInterruptCallback)(JSContext* cx); +using JSInterruptCallback = bool (*)(JSContext*); /** * Callback used to ask the embedding for the cross compartment wrapper handler @@ -110,9 +110,8 @@ typedef bool (*JSInterruptCallback)(JSContext* cx); * wrapper with a lazily-defined prototype and the correct global. It is * guaranteed not to wrap a function. */ -typedef JSObject* (*JSWrapObjectCallback)(JSContext* cx, - JS::HandleObject existing, - JS::HandleObject obj); +using JSWrapObjectCallback = JSObject* (*)(JSContext*, JS::HandleObject, + JS::HandleObject); /** * Callback used by the wrap hook to ask the embedding to prepare an object @@ -121,22 +120,19 @@ typedef JSObject* (*JSWrapObjectCallback)(JSContext* cx, * is non-null, then it is the original object we are going to swap into during * a transplant. */ -typedef void (*JSPreWrapCallback)(JSContext* cx, JS::HandleObject scope, - JS::HandleObject origObj, - JS::HandleObject obj, - JS::HandleObject objectPassedToWrap, - JS::MutableHandleObject retObj); +using JSPreWrapCallback = void (*)(JSContext*, JS::HandleObject, + JS::HandleObject, JS::HandleObject, + JS::HandleObject, JS::MutableHandleObject); struct JSWrapObjectCallbacks { JSWrapObjectCallback wrap; JSPreWrapCallback preWrap; }; -typedef void (*JSDestroyCompartmentCallback)(JSFreeOp* fop, - JS::Compartment* compartment); +using JSDestroyCompartmentCallback = void (*)(JSFreeOp*, JS::Compartment*); -typedef size_t (*JSSizeOfIncludingThisCompartmentCallback)( - mozilla::MallocSizeOf mallocSizeOf, JS::Compartment* compartment); +using JSSizeOfIncludingThisCompartmentCallback = + size_t (*)(mozilla::MallocSizeOf, JS::Compartment*); /** * Callback used to intercept JavaScript errors. @@ -490,8 +486,8 @@ namespace JS { enum class CompartmentIterResult { KeepGoing, Stop }; } // namespace JS -typedef JS::CompartmentIterResult (*JSIterateCompartmentCallback)( - JSContext* cx, void* data, JS::Compartment* compartment); +using JSIterateCompartmentCallback = + JS::CompartmentIterResult (*)(JSContext*, void*, JS::Compartment*); /** * This function calls |compartmentCallback| on every compartment until either @@ -675,9 +671,8 @@ extern JS_PUBLIC_API bool JS_InitCTypesClass(JSContext* cx, * charset, returning a null-terminated string allocated with JS_malloc. On * failure, this function should report an error. */ -typedef char* (*JSCTypesUnicodeToNativeFun)(JSContext* cx, - const char16_t* source, - size_t slen); +using JSCTypesUnicodeToNativeFun = char* (*)(JSContext*, const char16_t*, + size_t); /** * Set of function pointers that ctypes can use for various internal functions. @@ -1944,11 +1939,10 @@ class JS_PUBLIC_API StreamConsumer { enum class MimeType { Wasm }; -typedef bool (*ConsumeStreamCallback)(JSContext* cx, JS::HandleObject obj, - MimeType mimeType, - StreamConsumer* consumer); +using ConsumeStreamCallback = bool (*)(JSContext*, JS::HandleObject, MimeType, + StreamConsumer*); -typedef void (*ReportStreamErrorCallback)(JSContext* cx, size_t errorCode); +using ReportStreamErrorCallback = void (*)(JSContext*, size_t); extern JS_PUBLIC_API void InitConsumeStreamCallback( JSContext* cx, ConsumeStreamCallback consume, @@ -2971,7 +2965,7 @@ extern JS_PUBLIC_API MOZ_MUST_USE bool DisableWasmHugeMemory(); * can be called on any thread and must be set at most once in a process. */ -typedef void (*LargeAllocationFailureCallback)(); +using LargeAllocationFailureCallback = void (*)(); extern JS_PUBLIC_API void SetProcessLargeAllocationFailureCallback( LargeAllocationFailureCallback afc); @@ -2987,7 +2981,7 @@ extern JS_PUBLIC_API void SetProcessLargeAllocationFailureCallback( * large-allocation-failure callback has returned. */ -typedef void (*OutOfMemoryCallback)(JSContext* cx, void* data); +using OutOfMemoryCallback = void (*)(JSContext*, void*); extern JS_PUBLIC_API void SetOutOfMemoryCallback(JSContext* cx, OutOfMemoryCallback cb, diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index d083ae1900d8..92f5f5f73f59 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -178,8 +178,7 @@ enum { JS_TELEMETRY_END }; -typedef void (*JSAccumulateTelemetryDataCallback)(int id, uint32_t sample, - const char* key); +using JSAccumulateTelemetryDataCallback = void (*)(int, uint32_t, const char*); extern JS_FRIEND_API void JS_SetAccumulateTelemetryCallback( JSContext* cx, JSAccumulateTelemetryDataCallback callback); @@ -193,7 +192,7 @@ extern JS_FRIEND_API void JS_SetAccumulateTelemetryCallback( enum class JSUseCounter { ASMJS, WASM }; -typedef void (*JSSetUseCounterCallback)(JSObject* obj, JSUseCounter counter); +using JSSetUseCounterCallback = void (*)(JSObject*, JSUseCounter); extern JS_FRIEND_API void JS_SetSetUseCounterCallback( JSContext* cx, JSSetUseCounterCallback callback); @@ -424,7 +423,7 @@ extern JS_FRIEND_API void RunJobs(JSContext* cx); extern JS_FRIEND_API JS::Zone* GetRealmZone(JS::Realm* realm); -typedef bool (*PreserveWrapperCallback)(JSContext* cx, JS::HandleObject obj); +using PreserveWrapperCallback = bool (*)(JSContext*, JS::HandleObject); typedef enum { CollectNurseryBeforeDump, @@ -471,7 +470,7 @@ extern JS_FRIEND_API bool ZoneGlobalsAreAllGray(JS::Zone* zone); extern JS_FRIEND_API bool IsCompartmentZoneSweepingOrCompacting( JS::Compartment* comp); -typedef void (*GCThingCallback)(void* closure, JS::GCCellPtr thing); +using GCThingCallback = void (*)(void*, JS::GCCellPtr); extern JS_FRIEND_API void VisitGrayWrapperTargets(JS::Zone* zone, GCThingCallback callback, @@ -1097,13 +1096,12 @@ JS_FRIEND_API JS::UniqueChars GetCodeCoverageSummary(JSContext* cx, JS_FRIEND_API JS::UniqueChars GetCodeCoverageSummaryAll(JSContext* cx, size_t* length); -typedef bool (*DOMInstanceClassHasProtoAtDepth)(const JSClass* instanceClass, - uint32_t protoID, - uint32_t depth); +using DOMInstanceClassHasProtoAtDepth = bool (*)(const JSClass*, uint32_t, + uint32_t); struct JSDOMCallbacks { DOMInstanceClassHasProtoAtDepth instanceClassMatchesProto; }; -typedef struct JSDOMCallbacks DOMCallbacks; +using DOMCallbacks = struct JSDOMCallbacks; extern JS_FRIEND_API void SetDOMCallbacks(JSContext* cx, const DOMCallbacks* callbacks); @@ -1225,9 +1223,9 @@ typedef enum DOMProxyShadowsResult { ShadowsViaDirectExpando, ShadowsViaIndirectExpando } DOMProxyShadowsResult; -typedef DOMProxyShadowsResult (*DOMProxyShadowsCheck)(JSContext* cx, - JS::HandleObject object, - JS::HandleId id); +using DOMProxyShadowsCheck = DOMProxyShadowsResult (*)(JSContext*, + JS::HandleObject, + JS::HandleId); JS_FRIEND_API void SetDOMProxyInformation( const void* domProxyHandlerFamily, DOMProxyShadowsCheck domProxyShadowsCheck, @@ -1895,7 +1893,7 @@ struct JSJitMethodCallArgsTraits; class JSJitMethodCallArgs : protected JS::detail::CallArgsBase { private: - typedef JS::detail::CallArgsBase Base; + using Base = JS::detail::CallArgsBase; friend struct JSJitMethodCallArgsTraits; public: @@ -1935,13 +1933,12 @@ struct JSJitMethodCallArgsTraits { static const size_t offsetOfArgc = offsetof(JSJitMethodCallArgs, argc_); }; -typedef bool (*JSJitGetterOp)(JSContext* cx, JS::HandleObject thisObj, - void* specializedThis, JSJitGetterCallArgs args); -typedef bool (*JSJitSetterOp)(JSContext* cx, JS::HandleObject thisObj, - void* specializedThis, JSJitSetterCallArgs args); -typedef bool (*JSJitMethodOp)(JSContext* cx, JS::HandleObject thisObj, - void* specializedThis, - const JSJitMethodCallArgs& args); +using JSJitGetterOp = bool (*)(JSContext*, JS::HandleObject, void*, + JSJitGetterCallArgs); +using JSJitSetterOp = bool (*)(JSContext*, JS::HandleObject, void*, + JSJitSetterCallArgs); +using JSJitMethodOp = bool (*)(JSContext*, JS::HandleObject, void*, + const JSJitMethodCallArgs&); /** * This struct contains metadata passed from the DOM to the JS Engine for JIT @@ -2314,7 +2311,7 @@ enum CTypesActivityType { CTYPES_CALLBACK_END }; -typedef void (*CTypesActivityCallback)(JSContext* cx, CTypesActivityType type); +using CTypesActivityCallback = void (*)(JSContext*, CTypesActivityType); /** * Sets a callback that is run whenever js-ctypes is about to be used when @@ -2636,7 +2633,7 @@ extern JS_FRIEND_API void SetRealmValidAccessPtr(JSContext* cx, // contexts are using it now). extern JS_FRIEND_API bool SystemZoneAvailable(JSContext* cx); -typedef void (*LogCtorDtor)(void* self, const char* type, uint32_t sz); +using LogCtorDtor = void (*)(void*, const char*, uint32_t); /** * Set global function used to monitor a few internal classes to highlight diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 806e5957f59b..76ef704ac844 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -67,7 +67,7 @@ static const JSConstDoubleSpec math_constants[] = { // clang-format on }; -typedef double (*UnaryMathFunctionType)(double); +using UnaryMathFunctionType = double (*)(double); template static bool math_function(JSContext* cx, HandleValue val, @@ -541,7 +541,7 @@ template T js::GetBiggestNumberLessThan(T x) { MOZ_ASSERT(!IsNegative(x)); MOZ_ASSERT(IsFinite(x)); - typedef typename mozilla::FloatingPoint::Bits Bits; + using Bits = typename mozilla::FloatingPoint::Bits; Bits bits = mozilla::BitwiseCast(x); MOZ_ASSERT(bits > 0, "will underflow"); return mozilla::BitwiseCast(bits - 1); diff --git a/js/src/jsmath.h b/js/src/jsmath.h index 6fde3f7ce76a..588063b355a1 100644 --- a/js/src/jsmath.h +++ b/js/src/jsmath.h @@ -15,7 +15,7 @@ namespace js { -typedef double (*UnaryFunType)(double); +using UnaryFunType = double (*)(double); /* * JS math functions. diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index cc9cf9c8bf50..ea2d7bcb96b8 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -69,8 +69,8 @@ class JSLinearString; template struct JSConstScalarSpec; -typedef JSConstScalarSpec JSConstDoubleSpec; -typedef JSConstScalarSpec JSConstIntegerSpec; +using JSConstDoubleSpec = JSConstScalarSpec; +using JSConstIntegerSpec = JSConstScalarSpec; namespace js { @@ -113,7 +113,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API AutoEnterCycleCollection { extern "C" { // Defined in NSPR prio.h. -typedef struct PRFileDesc PRFileDesc; +using PRFileDesc = struct PRFileDesc; } #endif /* jspubtd_h */ diff --git a/js/src/threading/ExclusiveData.h b/js/src/threading/ExclusiveData.h index 978c18066632..c43cd1797cae 100644 --- a/js/src/threading/ExclusiveData.h +++ b/js/src/threading/ExclusiveData.h @@ -178,7 +178,7 @@ class ExclusiveData { template class ExclusiveWaitableData : public ExclusiveData { - typedef ExclusiveData Base; + using Base = ExclusiveData; mutable ConditionVariable condVar_; @@ -192,7 +192,7 @@ class ExclusiveWaitableData : public ExclusiveData { : Base(id, std::forward(args)...) {} class MOZ_STACK_CLASS Guard : public ExclusiveData::Guard { - typedef typename ExclusiveData::Guard Base; + using Base = typename ExclusiveData::Guard; public: explicit Guard(const ExclusiveWaitableData& parent) : Base(parent) {} diff --git a/js/src/util/Printf.cpp b/js/src/util/Printf.cpp index cbb80e729ae3..e1ab853af0c9 100644 --- a/js/src/util/Printf.cpp +++ b/js/src/util/Printf.cpp @@ -18,7 +18,7 @@ using namespace js; -typedef mozilla::SmprintfPolicyPointer JSSmprintfPointer; +using JSSmprintfPointer = mozilla::SmprintfPolicyPointer; JS_PUBLIC_API JS::UniqueChars JS_smprintf(const char* fmt, ...) { va_list ap; diff --git a/js/src/vm/ArrayBufferObject.h b/js/src/vm/ArrayBufferObject.h index 667c42da032e..7bc73ecf334d 100644 --- a/js/src/vm/ArrayBufferObject.h +++ b/js/src/vm/ArrayBufferObject.h @@ -126,12 +126,12 @@ class ArrayBufferObjectMaybeShared : public NativeObject { inline bool isWasm() const; }; -typedef Rooted - RootedArrayBufferObjectMaybeShared; -typedef Handle - HandleArrayBufferObjectMaybeShared; -typedef MutableHandle - MutableHandleArrayBufferObjectMaybeShared; +using RootedArrayBufferObjectMaybeShared = + Rooted; +using HandleArrayBufferObjectMaybeShared = + Handle; +using MutableHandleArrayBufferObjectMaybeShared = + MutableHandle; /* * ArrayBufferObject @@ -466,9 +466,9 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared { } }; -typedef Rooted RootedArrayBufferObject; -typedef Handle HandleArrayBufferObject; -typedef MutableHandle MutableHandleArrayBufferObject; +using RootedArrayBufferObject = Rooted; +using HandleArrayBufferObject = Handle; +using MutableHandleArrayBufferObject = MutableHandle; bool CreateWasmBuffer(JSContext* cx, const wasm::Limits& memory, MutableHandleArrayBufferObjectMaybeShared buffer); diff --git a/js/src/vm/AtomsTable.h b/js/src/vm/AtomsTable.h index d052a119c6ae..ee1e2844ad8a 100644 --- a/js/src/vm/AtomsTable.h +++ b/js/src/vm/AtomsTable.h @@ -109,7 +109,7 @@ class FrozenAtomSet { return mSet->shallowSizeOfIncludingThis(mallocSizeOf); } - typedef AtomSet::Range Range; + using Range = AtomSet::Range; AtomSet::Range all() const { return mSet->all(); } }; diff --git a/js/src/vm/BytecodeLocation.h b/js/src/vm/BytecodeLocation.h index ed5f2b2b848f..b23c158e5bd1 100644 --- a/js/src/vm/BytecodeLocation.h +++ b/js/src/vm/BytecodeLocation.h @@ -13,7 +13,7 @@ namespace js { -typedef uint32_t RawBytecodeLocationOffset; +using RawBytecodeLocationOffset = uint32_t; class PropertyName; @@ -27,7 +27,7 @@ class BytecodeLocationOffset { RawBytecodeLocationOffset rawOffset() const { return rawOffset_; } }; -typedef jsbytecode* RawBytecode; +using RawBytecode = jsbytecode*; // A immutable representation of a program location // diff --git a/js/src/vm/Caches.h b/js/src/vm/Caches.h index 490b27f23905..5d1b63ad463a 100644 --- a/js/src/vm/Caches.h +++ b/js/src/vm/Caches.h @@ -66,7 +66,7 @@ struct EvalCacheLookup { }; struct EvalCacheHashPolicy { - typedef EvalCacheLookup Lookup; + using Lookup = EvalCacheLookup; static HashNumber hash(const Lookup& l); static bool match(const EvalCacheEntry& entry, const EvalCacheLookup& l); diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp index 341dc6fc9c01..aa70574348bc 100644 --- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -38,8 +38,8 @@ using namespace js; -typedef Rooted RootedArgumentsObject; -typedef MutableHandle MutableHandleArgumentsObject; +using RootedArgumentsObject = Rooted; +using MutableHandleArgumentsObject = MutableHandle; /*****************************************************************************/ diff --git a/js/src/vm/EnvironmentObject.h b/js/src/vm/EnvironmentObject.h index 890a8b04e1e7..fd27c5c3f24f 100644 --- a/js/src/vm/EnvironmentObject.h +++ b/js/src/vm/EnvironmentObject.h @@ -23,7 +23,7 @@ namespace js { class ModuleObject; -typedef Handle HandleModuleObject; +using HandleModuleObject = Handle; /* * Return a shape representing the static scope containing the variable @@ -445,10 +445,10 @@ class ModuleEnvironmentObject : public EnvironmentObject { bool enumerableOnly); }; -typedef Rooted RootedModuleEnvironmentObject; -typedef Handle HandleModuleEnvironmentObject; -typedef MutableHandle - MutableHandleModuleEnvironmentObject; +using RootedModuleEnvironmentObject = Rooted; +using HandleModuleEnvironmentObject = Handle; +using MutableHandleModuleEnvironmentObject = + MutableHandle; class WasmInstanceEnvironmentObject : public EnvironmentObject { // Currently WasmInstanceScopes do not use their scopes in a @@ -823,7 +823,7 @@ class MissingEnvironmentKey { void updateFrame(AbstractFramePtr frame) { frame_ = frame; } // For use as hash policy. - typedef MissingEnvironmentKey Lookup; + using Lookup = MissingEnvironmentKey; static HashNumber hash(MissingEnvironmentKey sk); static bool match(MissingEnvironmentKey sk1, MissingEnvironmentKey sk2); bool operator!=(const MissingEnvironmentKey& other) const { diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index 51c67b45a57f..de50a333ea13 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -548,7 +548,7 @@ class GlobalObject : public NativeObject { } private: - typedef bool (*ObjectInitOp)(JSContext* cx, Handle global); + using ObjectInitOp = bool (*)(JSContext*, Handle); static JSObject* getOrCreateObject(JSContext* cx, Handle global, diff --git a/js/src/vm/HelperThreads.h b/js/src/vm/HelperThreads.h index 9ce8098c4d14..3897a76d8950 100644 --- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -72,7 +72,7 @@ struct Tier2GeneratorTask : public RunnableTask { virtual void cancel() = 0; }; -typedef UniquePtr UniqueTier2GeneratorTask; +using UniqueTier2GeneratorTask = UniquePtr; typedef Vector Tier2GeneratorTaskPtrVector; @@ -98,10 +98,10 @@ class GlobalHelperThreadState { typedef Vector IonCompileTaskVector; typedef Vector ParseTaskVector; - typedef mozilla::LinkedList ParseTaskList; + using ParseTaskList = mozilla::LinkedList; typedef Vector, 0, SystemAllocPolicy> SourceCompressionTaskVector; - typedef mozilla::LinkedList GCParallelTaskList; + using GCParallelTaskList = mozilla::LinkedList; typedef Vector PromiseHelperTaskVector; typedef Vector ContextVector; diff --git a/js/src/vm/Iteration.cpp b/js/src/vm/Iteration.cpp index fac3d27f1a16..89d63d41d6ec 100644 --- a/js/src/vm/Iteration.cpp +++ b/js/src/vm/Iteration.cpp @@ -53,7 +53,7 @@ using mozilla::DebugOnly; using mozilla::Maybe; using mozilla::PodCopy; -typedef Rooted RootedPropertyIteratorObject; +using RootedPropertyIteratorObject = Rooted; static const gc::AllocKind ITERATOR_FINALIZE_KIND = gc::AllocKind::OBJECT2_BACKGROUND; diff --git a/js/src/vm/JSFunction.h b/js/src/vm/JSFunction.h index 1960c43c6739..3e28c225c21b 100644 --- a/js/src/vm/JSFunction.h +++ b/js/src/vm/JSFunction.h @@ -21,7 +21,7 @@ namespace js { class FunctionExtended; struct SelfHostedLazyScript; -typedef JSNative Native; +using Native = JSNative; } // namespace js static const uint32_t JSSLOT_BOUND_FUNCTION_TARGET = 2; @@ -431,9 +431,9 @@ class JSFunction : public js::NativeObject { // Note: this should be kept in sync with // FunctionBox::needsCallObjectRegardlessOfBindings(). - MOZ_ASSERT_IF(baseScript()->funHasExtensibleScope() || - isGenerator() || isAsync(), - nonLazyScript()->bodyScope()->hasEnvironment()); + MOZ_ASSERT_IF( + baseScript()->funHasExtensibleScope() || isGenerator() || isAsync(), + nonLazyScript()->bodyScope()->hasEnvironment()); return nonLazyScript()->bodyScope()->hasEnvironment(); } diff --git a/js/src/vm/JSONParser.h b/js/src/vm/JSONParser.h index 6cefc4d2ed9c..a88980b3821d 100644 --- a/js/src/vm/JSONParser.h +++ b/js/src/vm/JSONParser.h @@ -209,7 +209,7 @@ class MOZ_STACK_CLASS JSONParserBase { template class MOZ_STACK_CLASS JSONParser : public JSONParserBase { private: - typedef mozilla::RangedPtr CharPtr; + using CharPtr = mozilla::RangedPtr; CharPtr current; const CharPtr begin, end; diff --git a/js/src/vm/PIC.h b/js/src/vm/PIC.h index eabdab9ca7ea..f6d6deeb3773 100644 --- a/js/src/vm/PIC.h +++ b/js/src/vm/PIC.h @@ -24,8 +24,8 @@ class PICStub { friend class PICChain; private: - typedef typename Category::Stub CatStub; - typedef typename Category::Chain CatChain; + using CatStub = typename Category::Stub; + using CatChain = typename Category::Chain; protected: CatStub* next_; @@ -51,8 +51,8 @@ class PICStub { template class PICChain { private: - typedef typename Category::Stub CatStub; - typedef typename Category::Chain CatChain; + using CatStub = typename Category::Stub; + using CatChain = typename Category::Chain; protected: CatStub* stubs_; @@ -86,8 +86,8 @@ struct ForOfPIC { ForOfPIC() = delete; ForOfPIC(const ForOfPIC& other) = delete; - typedef PICStub BaseStub; - typedef PICChain BaseChain; + using BaseStub = PICStub; + using BaseChain = PICChain; /* * A ForOfPIC has only one kind of stub for now: one that holds the shape diff --git a/js/src/vm/RegExpShared.h b/js/src/vm/RegExpShared.h index ffd7bec1d77f..d8c57ab38f75 100644 --- a/js/src/vm/RegExpShared.h +++ b/js/src/vm/RegExpShared.h @@ -224,7 +224,7 @@ class RegExpZone { : atom(shared.unbarrieredGet()->getSource()), flags(shared.unbarrieredGet()->getFlags()) {} - typedef Key Lookup; + using Lookup = Key; static HashNumber hash(const Lookup& l) { HashNumber hash = DefaultHasher::hash(l.atom); return mozilla::AddToHash(hash, l.flags.value()); diff --git a/js/src/vm/SavedFrame.h b/js/src/vm/SavedFrame.h index a256d90cceca..5258581f6dbe 100644 --- a/js/src/vm/SavedFrame.h +++ b/js/src/vm/SavedFrame.h @@ -142,16 +142,16 @@ class SavedFrame : public NativeObject { }; struct SavedFrame::HashPolicy { - typedef SavedFrame::Lookup Lookup; - typedef MovableCellHasher SavedFramePtrHasher; - typedef PointerHasher JSPrincipalsPtrHasher; + using Lookup = SavedFrame::Lookup; + using SavedFramePtrHasher = MovableCellHasher; + using JSPrincipalsPtrHasher = PointerHasher; static bool hasHash(const Lookup& l); static bool ensureHash(const Lookup& l); static HashNumber hash(const Lookup& lookup); static bool match(SavedFrame* existing, const Lookup& lookup); - typedef WeakHeapPtr Key; + using Key = WeakHeapPtr; static void rekey(Key& key, const Key& newKey); }; diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 334fdc1b0822..a119fdbf1bde 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -124,8 +124,8 @@ class Shape; struct StackShape; struct ShapeHasher : public DefaultHasher { - typedef Shape* Key; - typedef StackShape Lookup; + using Key = Shape*; + using Lookup = StackShape; static MOZ_ALWAYS_INLINE HashNumber hash(const Lookup& l); static MOZ_ALWAYS_INLINE bool match(Key k, const Lookup& l); @@ -254,8 +254,8 @@ class PropertyTree { class TenuringTracer; -typedef JSGetterOp GetterOp; -typedef JSSetterOp SetterOp; +using GetterOp = JSGetterOp; +using SetterOp = JSSetterOp; /* Limit on the number of slotful properties in an object. */ static const uint32_t SHAPE_INVALID_SLOT = Bit(24) - 1; @@ -918,7 +918,7 @@ namespace mozilla { template <> struct DefaultHasher { - typedef jsid Lookup; + using Lookup = jsid; static HashNumber hash(jsid id) { return js::HashId(id); } static bool match(jsid id1, jsid id2) { return id1 == id2; } }; diff --git a/js/src/vm/SharedArrayObject.h b/js/src/vm/SharedArrayObject.h index 8950ae9358bb..c70fc097e29b 100644 --- a/js/src/vm/SharedArrayObject.h +++ b/js/src/vm/SharedArrayObject.h @@ -247,10 +247,10 @@ bool IsSharedArrayBuffer(JSObject* o); SharedArrayBufferObject& AsSharedArrayBuffer(HandleObject o); -typedef Rooted RootedSharedArrayBufferObject; -typedef Handle HandleSharedArrayBufferObject; -typedef MutableHandle - MutableHandleSharedArrayBufferObject; +using RootedSharedArrayBufferObject = Rooted; +using HandleSharedArrayBufferObject = Handle; +using MutableHandleSharedArrayBufferObject = + MutableHandle; } // namespace js diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 31436f57c9d6..424302a1365a 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -981,7 +981,7 @@ namespace mozilla { template <> struct DefaultHasher { - typedef js::AbstractFramePtr Lookup; + using Lookup = js::AbstractFramePtr; static js::HashNumber hash(const Lookup& key) { return mozilla::HashGeneric(key.raw()); diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index 3a0be2e8e69c..5de406c769ea 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -173,7 +173,7 @@ namespace js { template struct BufferIterator { - typedef mozilla::BufferList BufferList; + using BufferList = mozilla::BufferList; explicit BufferIterator(const BufferList& buffer) : mBuffer(buffer), mIter(buffer.Iter()) { diff --git a/js/src/vm/SymbolType.h b/js/src/vm/SymbolType.h index c2710666e0a7..82884389aa62 100644 --- a/js/src/vm/SymbolType.h +++ b/js/src/vm/SymbolType.h @@ -111,8 +111,8 @@ namespace js { /* Hash policy used by the SymbolRegistry. */ struct HashSymbolsByDescription { - typedef JS::Symbol* Key; - typedef JSAtom* Lookup; + using Key = JS::Symbol*; + using Lookup = JSAtom*; static HashNumber hash(Lookup l) { return HashNumber(l->hash()); } static bool match(Key sym, Lookup l) { return sym->description() == l; } diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp index e64dd797b260..47c6439c8bba 100644 --- a/js/src/vm/TypeInference.cpp +++ b/js/src/vm/TypeInference.cpp @@ -1667,7 +1667,7 @@ void HeapTypeSetKey::freeze(CompilerConstraintList* constraints) { LifoAlloc* alloc = constraints->alloc(); LifoAlloc::AutoFallibleScope fallibleAllocator(alloc); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add(alloc->new_(alloc, *this, ConstraintDataFreeze())); } @@ -1869,7 +1869,7 @@ bool TypeSet::ObjectKey::hasFlags(CompilerConstraintList* constraints, HeapTypeSetKey objectProperty = property(JSID_EMPTY); LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add(alloc->new_(alloc, objectProperty, ConstraintDataFreezeObjectFlags(flags))); return false; @@ -1923,7 +1923,7 @@ gc::InitialHeap ObjectGroup::initialHeap(CompilerConstraintList* constraints) { TypeSet::ObjectKey::get(this)->property(JSID_EMPTY); LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add( alloc->new_(alloc, objectProperty, ConstraintDataFreezeObjectFlags(OBJECT_FLAG_PRE_TENURE))); @@ -1983,9 +1983,8 @@ void TypeSet::ObjectKey::watchStateChangeForTypedArrayData( HeapTypeSetKey objectProperty = property(JSID_EMPTY); LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance< - ConstraintDataFreezeObjectForTypedArrayData> - T; + using T = + CompilerConstraintInstance; constraints->add( alloc->new_(alloc, objectProperty, ConstraintDataFreezeObjectForTypedArrayData(tarray))); @@ -2062,7 +2061,7 @@ bool HeapTypeSetKey::nonData(CompilerConstraintList* constraints) { LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add( alloc->new_(alloc, *this, ConstraintDataFreezePropertyState( @@ -2077,7 +2076,7 @@ bool HeapTypeSetKey::nonWritable(CompilerConstraintList* constraints) { LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add( alloc->new_(alloc, *this, ConstraintDataFreezePropertyState( @@ -2152,7 +2151,7 @@ bool HeapTypeSetKey::constant(CompilerConstraintList* constraints, *valOut = val; LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add( alloc->new_(alloc, *this, ConstraintDataConstantProperty())); return true; @@ -2200,7 +2199,7 @@ bool HeapTypeSetKey::couldBeConstant(CompilerConstraintList* constraints) { // inert constraints to pin these properties in place. LifoAlloc* alloc = constraints->alloc(); - typedef CompilerConstraintInstance T; + using T = CompilerConstraintInstance; constraints->add(alloc->new_(alloc, *this, ConstraintDataInert())); return false; diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp index ca827588ca35..f55bc7d63546 100644 --- a/js/src/wasm/AsmJS.cpp +++ b/js/src/wasm/AsmJS.cpp @@ -387,7 +387,7 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod { const AsmJSMetadataCacheablePod& pod() const { return *this; } }; -typedef RefPtr MutableAsmJSMetadata; +using MutableAsmJSMetadata = RefPtr; /*****************************************************************************/ // ParseNode utilities diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h index b9aa0988bf0d..f892af9c1d6b 100644 --- a/js/src/wasm/WasmAST.h +++ b/js/src/wasm/WasmAST.h @@ -46,7 +46,7 @@ using AstHashMap = HashMap>; using mozilla::Variant; -typedef AstVector AstBoolVector; +using AstBoolVector = AstVector; class AstName { const char16_t* begin_; @@ -215,7 +215,7 @@ struct AstBlockType { }; struct AstNameHasher { - typedef const AstName Lookup; + using Lookup = const AstName; static js::HashNumber hash(Lookup l) { return mozilla::HashString(l.begin(), l.length()); } @@ -224,10 +224,10 @@ struct AstNameHasher { using AstNameMap = AstHashMap; -typedef AstVector AstValTypeVector; -typedef AstVector AstExprVector; -typedef AstVector AstNameVector; -typedef AstVector AstRefVector; +using AstValTypeVector = AstVector; +using AstExprVector = AstVector; +using AstNameVector = AstVector; +using AstRefVector = AstVector; struct AstBase { void* operator new(size_t numBytes, LifoAlloc& astLifo) noexcept(true) { @@ -289,7 +289,7 @@ class AstFuncType : public AstTypeDef { EqualContainers(results(), rhs.results()); } - typedef const AstFuncType& Lookup; + using Lookup = const AstFuncType&; static HashNumber hash(Lookup ft) { HashNumber hn = 0; for (const AstValType& vt : ft.args()) { @@ -1129,7 +1129,7 @@ class AstGlobal : public AstNode { } }; -typedef AstVector AstGlobalVector; +using AstGlobalVector = AstVector; class AstImport : public AstNode { AstName name_; @@ -1233,11 +1233,11 @@ class AstDataSegment : public AstNode { const AstNameVector& fragments() const { return fragments_; } }; -typedef AstVector AstDataSegmentVector; +using AstDataSegmentVector = AstVector; struct AstNullValue {}; typedef Variant AstElem; -typedef AstVector AstElemVector; +using AstElemVector = AstVector; enum class AstElemSegmentKind { Active, @@ -1271,7 +1271,7 @@ class AstElemSegment : public AstNode { const AstElemVector& elems() const { return elems_; } }; -typedef AstVector AstElemSegmentVector; +using AstElemSegmentVector = AstVector; class AstStartFunc : public AstNode { AstRef func_; @@ -1304,13 +1304,13 @@ struct AstTable { class AstModule : public AstNode { public: - typedef AstVector FuncVector; - typedef AstVector ImportVector; - typedef AstVector ExportVector; - typedef AstVector TypeDefVector; - typedef AstVector NameVector; - typedef AstVector AstMemoryVector; - typedef AstVector AstTableVector; + using FuncVector = AstVector; + using ImportVector = AstVector; + using ExportVector = AstVector; + using TypeDefVector = AstVector; + using NameVector = AstVector; + using AstMemoryVector = AstVector; + using AstTableVector = AstVector; private: typedef AstHashMap FuncTypeMap; diff --git a/js/src/wasm/WasmBuiltins.cpp b/js/src/wasm/WasmBuiltins.cpp index 0433e77eba62..5e9ca98849ed 100644 --- a/js/src/wasm/WasmBuiltins.cpp +++ b/js/src/wasm/WasmBuiltins.cpp @@ -1293,7 +1293,7 @@ struct TypedNative { TypedNative(InlinableNative native, ABIFunctionType abiType) : native(native), abiType(abiType) {} - typedef TypedNative Lookup; + using Lookup = TypedNative; static HashNumber hash(const Lookup& l) { return HashGeneric(uint32_t(l.native), uint32_t(l.abiType)); } diff --git a/js/src/wasm/WasmCode.h b/js/src/wasm/WasmCode.h index 366dfb97dc32..5431ad364e93 100644 --- a/js/src/wasm/WasmCode.h +++ b/js/src/wasm/WasmCode.h @@ -77,7 +77,7 @@ struct LinkData : LinkDataCacheablePod { WASM_DECLARE_SERIALIZABLE(LinkData) }; -typedef UniquePtr UniqueLinkData; +using UniqueLinkData = UniquePtr; // Executable code must be deallocated specially. @@ -160,7 +160,7 @@ class CodeSegment { // A wasm ModuleSegment owns the allocated executable code for a wasm module. -typedef UniquePtr UniqueModuleSegment; +using UniqueModuleSegment = UniquePtr; class ModuleSegment : public CodeSegment { const Tier tier_; @@ -402,8 +402,8 @@ struct Metadata : public ShareableBase, public MetadataCacheablePod { WASM_DECLARE_SERIALIZABLE(Metadata); }; -typedef RefPtr MutableMetadata; -typedef RefPtr SharedMetadata; +using MutableMetadata = RefPtr; +using SharedMetadata = RefPtr; struct MetadataTier { explicit MetadataTier(Tier tier) : tier(tier) {} @@ -538,8 +538,8 @@ class LazyStubTier { // CodeTier contains all the data related to a given compilation tier. It is // built during module generation and then immutably stored in a Code. -typedef UniquePtr UniqueCodeTier; -typedef UniquePtr UniqueConstCodeTier; +using UniqueCodeTier = UniquePtr; +using UniqueConstCodeTier = UniquePtr; class CodeTier { const Code* code_; @@ -643,8 +643,8 @@ class JumpTables { // // profilingLabels_ is lazily initialized, but behind a lock. -typedef RefPtr SharedCode; -typedef RefPtr MutableCode; +using SharedCode = RefPtr; +using MutableCode = RefPtr; class Code : public ShareableBase { UniqueCodeTier tier1_; diff --git a/js/src/wasm/WasmCompile.h b/js/src/wasm/WasmCompile.h index 1490e69f1462..5b22e137f22b 100644 --- a/js/src/wasm/WasmCompile.h +++ b/js/src/wasm/WasmCompile.h @@ -43,8 +43,8 @@ struct ScriptedCaller { // Describes all the parameters that control wasm compilation. struct CompileArgs; -typedef RefPtr MutableCompileArgs; -typedef RefPtr SharedCompileArgs; +using MutableCompileArgs = RefPtr; +using SharedCompileArgs = RefPtr; struct CompileArgs : ShareableBase { ScriptedCaller scriptedCaller; @@ -124,7 +124,7 @@ void CompileTier2(const CompileArgs& args, const Bytes& bytecode, // cancellation is set, both ExclusiveWaitableData will be notified and so every // wait() loop must check cancelled. -typedef ExclusiveWaitableData ExclusiveBytesPtr; +using ExclusiveBytesPtr = ExclusiveWaitableData; struct StreamEndData { bool reached; @@ -133,7 +133,7 @@ struct StreamEndData { StreamEndData() : reached(false) {} }; -typedef ExclusiveWaitableData ExclusiveStreamEndData; +using ExclusiveStreamEndData = ExclusiveWaitableData; SharedModule CompileStreaming(const CompileArgs& args, const Bytes& envBytes, const Bytes& codeBytes, diff --git a/js/src/wasm/WasmDebug.h b/js/src/wasm/WasmDebug.h index 74cbaaab8082..52ab09022e73 100644 --- a/js/src/wasm/WasmDebug.h +++ b/js/src/wasm/WasmDebug.h @@ -147,7 +147,7 @@ class DebugState { Code::SeenSet* seenCode, size_t* code, size_t* data) const; }; -typedef UniquePtr UniqueDebugState; +using UniqueDebugState = UniquePtr; } // namespace wasm } // namespace js diff --git a/js/src/wasm/WasmFrameIter.h b/js/src/wasm/WasmFrameIter.h index b1f52cfcd5b2..2ff564969bb4 100644 --- a/js/src/wasm/WasmFrameIter.h +++ b/js/src/wasm/WasmFrameIter.h @@ -45,7 +45,7 @@ struct CallableOffsets; struct FuncOffsets; struct Frame; -typedef JS::ProfilingFrameIterator::RegisterState RegisterState; +using RegisterState = JS::ProfilingFrameIterator::RegisterState; // Iterates over a linear group of wasm frames of a single wasm JitActivation, // called synchronously from C++ in the wasm thread. It will stop at the first diff --git a/js/src/wasm/WasmGenerator.cpp b/js/src/wasm/WasmGenerator.cpp index 361c600d4b14..b325934826b5 100644 --- a/js/src/wasm/WasmGenerator.cpp +++ b/js/src/wasm/WasmGenerator.cpp @@ -618,7 +618,7 @@ static bool AppendForEach(Vec* dstVec, const Vec& srcVec, Op op) { return false; } - typedef typename Vec::ElementType T; + using T = typename Vec::ElementType; const T* src = srcVec.begin(); diff --git a/js/src/wasm/WasmGenerator.h b/js/src/wasm/WasmGenerator.h index e3d7e15b414b..c98e7fb8191a 100644 --- a/js/src/wasm/WasmGenerator.h +++ b/js/src/wasm/WasmGenerator.h @@ -106,7 +106,7 @@ struct CompileTaskState { } }; -typedef ExclusiveWaitableData ExclusiveCompileTaskState; +using ExclusiveCompileTaskState = ExclusiveWaitableData; // A CompileTask holds a batch of input functions that are to be compiled on a // helper thread as well as, eventually, the results of compilation. diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp index 5456f62e51f2..43e0e96f0888 100644 --- a/js/src/wasm/WasmInstance.cpp +++ b/js/src/wasm/WasmInstance.cpp @@ -42,7 +42,7 @@ using namespace js::jit; using namespace js::wasm; using mozilla::BitwiseCast; -typedef CheckedInt CheckedU32; +using CheckedU32 = CheckedInt; class FuncTypeIdSet { typedef HashMap, SharedMem, size_t); + using RacyMemMove = + void (*)(SharedMem, SharedMem, size_t); const SharedArrayRawBuffer* rawBuf = SharedArrayRawBuffer::fromDataPtr(memBase); diff --git a/js/src/wasm/WasmInstance.h b/js/src/wasm/WasmInstance.h index 74c06e5b1da9..0d5faa876545 100644 --- a/js/src/wasm/WasmInstance.h +++ b/js/src/wasm/WasmInstance.h @@ -236,7 +236,7 @@ class Instance { uint32_t outputTypeIndex, void* maybeNullPtr); }; -typedef UniquePtr UniqueInstance; +using UniqueInstance = UniquePtr; } // namespace wasm } // namespace js diff --git a/js/src/wasm/WasmIonCompile.cpp b/js/src/wasm/WasmIonCompile.cpp index 71ecdd719964..be68b04f8f26 100644 --- a/js/src/wasm/WasmIonCompile.cpp +++ b/js/src/wasm/WasmIonCompile.cpp @@ -49,14 +49,14 @@ typedef Vector DefVector; struct IonCompilePolicy { // We store SSA definitions in the value stack. - typedef MDefinition* Value; - typedef DefVector ValueVector; + using Value = MDefinition*; + using ValueVector = DefVector; // We store loop headers and then/else blocks in the control flow stack. - typedef MBasicBlock* ControlItem; + using ControlItem = MBasicBlock*; }; -typedef OpIter IonOpIter; +using IonOpIter = OpIter; class FunctionCompiler; diff --git a/js/src/wasm/WasmModule.h b/js/src/wasm/WasmModule.h index 145a2f61e5df..61f3b8ffdc50 100644 --- a/js/src/wasm/WasmModule.h +++ b/js/src/wasm/WasmModule.h @@ -32,7 +32,7 @@ struct CompileArgs; // In the context of wasm, the OptimizedEncodingListener specifically is // listening for the completion of tier-2. -typedef RefPtr Tier2Listener; +using Tier2Listener = RefPtr; // A struct containing the typed, imported values that are harvested from the // import object and passed to Module::instantiate(). This struct must be @@ -228,8 +228,8 @@ class Module : public JS::WasmModule { bool extractCode(JSContext* cx, Tier tier, MutableHandleValue vp) const; }; -typedef RefPtr MutableModule; -typedef RefPtr SharedModule; +using MutableModule = RefPtr; +using SharedModule = RefPtr; // JS API implementations: diff --git a/js/src/wasm/WasmOpIter.h b/js/src/wasm/WasmOpIter.h index 3723514d301c..5b5297b7deab 100644 --- a/js/src/wasm/WasmOpIter.h +++ b/js/src/wasm/WasmOpIter.h @@ -105,7 +105,7 @@ class TaggedValue { // ResultType value is less than the OpIter, we can just borrow the pointer // without ownership or copying. class ResultType { - typedef TaggedValue Tagged; + using Tagged = TaggedValue; Tagged tagged_; enum Kind { @@ -220,7 +220,7 @@ class ResultType { // [] -> [results] via pointer to FuncType (ignoring [params]) class BlockType { - typedef TaggedValue Tagged; + using Tagged = TaggedValue; Tagged tagged_; enum Kind { @@ -555,12 +555,12 @@ class TypeAndValueT { template class MOZ_STACK_CLASS OpIter : private Policy { public: - typedef typename Policy::Value Value; - typedef typename Policy::ValueVector ValueVector; - typedef TypeAndValueT TypeAndValue; + using Value = typename Policy::Value; + using ValueVector = typename Policy::ValueVector; + using TypeAndValue = TypeAndValueT; typedef Vector TypeAndValueStack; - typedef typename Policy::ControlItem ControlItem; - typedef ControlStackEntry Control; + using ControlItem = typename Policy::ControlItem; + using Control = ControlStackEntry; typedef Vector ControlStack; private: diff --git a/js/src/wasm/WasmSignalHandlers.h b/js/src/wasm/WasmSignalHandlers.h index daa73ef41691..f66963463370 100644 --- a/js/src/wasm/WasmSignalHandlers.h +++ b/js/src/wasm/WasmSignalHandlers.h @@ -27,7 +27,7 @@ namespace js { namespace wasm { -typedef JS::ProfilingFrameIterator::RegisterState RegisterState; +using RegisterState = JS::ProfilingFrameIterator::RegisterState; // This function performs the low-overhead signal handler initialization that we // want to do eagerly to ensure a more-deterministic global process state. This diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp index cbd27f50f317..0051bdf20133 100644 --- a/js/src/wasm/WasmStubs.cpp +++ b/js/src/wasm/WasmStubs.cpp @@ -39,7 +39,7 @@ using namespace js::wasm; using mozilla::ArrayLength; typedef Vector MIRTypeVector; -typedef jit::ABIArgIter ABIArgMIRTypeIter; +using ABIArgMIRTypeIter = jit::ABIArgIter; /*****************************************************************************/ // ABIResultIter implementation @@ -1585,7 +1585,7 @@ static void StackCopy(MacroAssembler& masm, MIRType type, Register scratch, } } -typedef bool ToValue; +using ToValue = bool; // Note, when toValue is true then this may destroy the values in incoming // argument registers as a result of Spectre mitigation. diff --git a/js/src/wasm/WasmTable.h b/js/src/wasm/WasmTable.h index 5f3b3029e997..ce1c77620f1e 100644 --- a/js/src/wasm/WasmTable.h +++ b/js/src/wasm/WasmTable.h @@ -124,7 +124,7 @@ class Table : public ShareableBase { size_t gcMallocBytes() const; }; -typedef RefPtr
SharedTable; +using SharedTable = RefPtr
; typedef Vector SharedTableVector; } // namespace wasm diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp index f10f5e6e71c1..652e6d985b1e 100644 --- a/js/src/wasm/WasmTextToBinary.cpp +++ b/js/src/wasm/WasmTextToBinary.cpp @@ -2702,8 +2702,8 @@ static AstConst* ParseNaNLiteral(WasmParseContext& c, WasmToken token, MOZ_ALWAYS_TRUE(*cur++ == 'n' && *cur++ == 'a' && *cur++ == 'n'); - typedef FloatingPoint Traits; - typedef typename Traits::Bits Bits; + using Traits = FloatingPoint; + using Bits = typename Traits::Bits; Bits value; if (cur != end) { @@ -2750,8 +2750,8 @@ template static bool ParseHexFloatLiteral(const char16_t* cur, const char16_t* end, Float* result) { MOZ_ALWAYS_TRUE(*cur++ == '0' && *cur++ == 'x'); - typedef FloatingPoint Traits; - typedef typename Traits::Bits Bits; + using Traits = FloatingPoint; + using Bits = typename Traits::Bits; static const unsigned numBits = sizeof(Float) * CHAR_BIT; static const Bits allOnes = ~Bits(0); static const Bits mostSignificantBit = ~(allOnes >> 1); diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp index c91d90140853..256de5e3aa99 100644 --- a/js/src/wasm/WasmTypes.cpp +++ b/js/src/wasm/WasmTypes.cpp @@ -239,7 +239,7 @@ size_t FuncType::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const { return args_.sizeOfExcludingThis(mallocSizeOf); } -typedef uint32_t ImmediateType; // for 32/64 consistency +using ImmediateType = uint32_t; // for 32/64 consistency static const unsigned sTotalBits = sizeof(ImmediateType) * 8; static const unsigned sTagBits = 1; static const unsigned sReturnBit = 1; diff --git a/js/src/wasm/WasmTypes.h b/js/src/wasm/WasmTypes.h index 8085edad583c..2d7c3be6474e 100644 --- a/js/src/wasm/WasmTypes.h +++ b/js/src/wasm/WasmTypes.h @@ -55,32 +55,32 @@ enum class RoundingMode; typedef GCVector JSFunctionVector; class WasmMemoryObject; -typedef GCPtr GCPtrWasmMemoryObject; -typedef Rooted RootedWasmMemoryObject; -typedef Handle HandleWasmMemoryObject; -typedef MutableHandle MutableHandleWasmMemoryObject; +using GCPtrWasmMemoryObject = GCPtr; +using RootedWasmMemoryObject = Rooted; +using HandleWasmMemoryObject = Handle; +using MutableHandleWasmMemoryObject = MutableHandle; class WasmModuleObject; -typedef Rooted RootedWasmModuleObject; -typedef Handle HandleWasmModuleObject; -typedef MutableHandle MutableHandleWasmModuleObject; +using RootedWasmModuleObject = Rooted; +using HandleWasmModuleObject = Handle; +using MutableHandleWasmModuleObject = MutableHandle; class WasmInstanceObject; -typedef GCVector WasmInstanceObjectVector; -typedef Rooted RootedWasmInstanceObject; -typedef Handle HandleWasmInstanceObject; -typedef MutableHandle MutableHandleWasmInstanceObject; +using WasmInstanceObjectVector = GCVector; +using RootedWasmInstanceObject = Rooted; +using HandleWasmInstanceObject = Handle; +using MutableHandleWasmInstanceObject = MutableHandle; class WasmTableObject; typedef GCVector WasmTableObjectVector; -typedef Rooted RootedWasmTableObject; -typedef Handle HandleWasmTableObject; -typedef MutableHandle MutableHandleWasmTableObject; +using RootedWasmTableObject = Rooted; +using HandleWasmTableObject = Handle; +using MutableHandleWasmTableObject = MutableHandle; class WasmGlobalObject; typedef GCVector WasmGlobalObjectVector; -typedef Rooted RootedWasmGlobalObject; +using RootedWasmGlobalObject = Rooted; class StructTypeDescr; typedef GCVector, 0, SystemAllocPolicy> @@ -114,8 +114,8 @@ class Table; typedef Vector Uint32Vector; typedef Vector Bytes; -typedef UniquePtr UniqueBytes; -typedef UniquePtr UniqueConstBytes; +using UniqueBytes = UniquePtr; +using UniqueConstBytes = UniquePtr; typedef Vector UTF8Bytes; typedef Vector InstanceVector; typedef Vector UniqueCharsVector; @@ -199,8 +199,8 @@ struct ShareableBytes : ShareableBase { } }; -typedef RefPtr MutableBytes; -typedef RefPtr SharedBytes; +using MutableBytes = RefPtr; +using SharedBytes = RefPtr; // The Opcode compactly and safely represents the primary opcode plus any // extension, with convenient predicates and accessors. @@ -740,9 +740,9 @@ class AnyRef { static constexpr uintptr_t AnyRefObjTag = 0; }; -typedef Rooted RootedAnyRef; -typedef Handle HandleAnyRef; -typedef MutableHandle MutableHandleAnyRef; +using RootedAnyRef = Rooted; +using HandleAnyRef = Handle; +using MutableHandleAnyRef = MutableHandle; // TODO/AnyRef-boxing: With boxed immediates and strings, these will be defined // as MOZ_CRASH or similar so that we can find all locations that need to be @@ -853,9 +853,9 @@ class FuncRef { bool isNull() { return value_ == nullptr; } }; -typedef Rooted RootedFuncRef; -typedef Handle HandleFuncRef; -typedef MutableHandle MutableHandleFuncRef; +using RootedFuncRef = Rooted; +using HandleFuncRef = Handle; +using MutableHandleFuncRef = MutableHandle; // Given any FuncRef, unbox it as a JS Value -- always a JSFunction*. @@ -1009,14 +1009,14 @@ class MOZ_NON_PARAM Val : public LitVal { void trace(JSTracer* trc); }; -typedef Rooted RootedVal; -typedef Handle HandleVal; -typedef MutableHandle MutableHandleVal; +using RootedVal = Rooted; +using HandleVal = Handle; +using MutableHandleVal = MutableHandle; typedef GCVector ValVector; -typedef Rooted RootedValVector; -typedef Handle HandleValVector; -typedef MutableHandle MutableHandleValVector; +using RootedValVector = Rooted; +using HandleValVector = Handle; +using MutableHandleValVector = MutableHandle; // The FuncType class represents a WebAssembly function signature which takes a // list of value types and returns an expression type. The engine uses two @@ -1159,7 +1159,7 @@ class FuncType { }; struct FuncTypeHashPolicy { - typedef const FuncType& Lookup; + using Lookup = const FuncType&; static HashNumber hash(Lookup ft) { return ft.hash(); } static bool match(const FuncType* lhs, Lookup rhs) { return *lhs == rhs; } }; @@ -1548,8 +1548,8 @@ struct ElemSegment : AtomicRefCounted { constexpr uint32_t NullFuncIndex = UINT32_MAX; static_assert(NullFuncIndex > MaxFuncs, "Invariant"); -typedef RefPtr MutableElemSegment; -typedef SerializableRefPtr SharedElemSegment; +using MutableElemSegment = RefPtr; +using SharedElemSegment = SerializableRefPtr; typedef Vector ElemSegmentVector; // DataSegmentEnv holds the initial results of decoding a data segment from the @@ -1586,8 +1586,8 @@ struct DataSegment : AtomicRefCounted { WASM_DECLARE_SERIALIZABLE(DataSegment) }; -typedef RefPtr MutableDataSegment; -typedef SerializableRefPtr SharedDataSegment; +using MutableDataSegment = RefPtr; +using SharedDataSegment = SerializableRefPtr; typedef Vector DataSegmentVector; // The CustomSection(Env) structs are like DataSegment(Env): CustomSectionEnv is @@ -2480,7 +2480,7 @@ struct ExportArg { uint64_t hi; }; -typedef int32_t (*ExportFuncPtr)(ExportArg* args, TlsData* tls); +using ExportFuncPtr = int32_t (*)(ExportArg*, TlsData*); // FuncImportTls describes the region of wasm global memory allocated in the // instance's thread-local storage for a function import. This is accessed @@ -2944,7 +2944,7 @@ bool IsCodegenDebugEnabled(DebugChannel channel); void DebugCodegen(DebugChannel channel, const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3); -typedef void (*PrintCallback)(const char* text); +using PrintCallback = void (*)(const char*); } // namespace wasm } // namespace js diff --git a/js/src/wasm/WasmValidate.cpp b/js/src/wasm/WasmValidate.cpp index 505af4968002..f71e42bcb2e3 100644 --- a/js/src/wasm/WasmValidate.cpp +++ b/js/src/wasm/WasmValidate.cpp @@ -457,12 +457,12 @@ class NothingVector { }; struct ValidatingPolicy { - typedef Nothing Value; - typedef NothingVector ValueVector; - typedef Nothing ControlItem; + using Value = Nothing; + using ValueVector = NothingVector; + using ControlItem = Nothing; }; -typedef OpIter ValidatingOpIter; +using ValidatingOpIter = OpIter; static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env, uint32_t funcIndex, diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h index 47e55b7cd49c..2084b8d9fb0b 100644 --- a/js/src/wasm/WasmValidate.h +++ b/js/src/wasm/WasmValidate.h @@ -41,7 +41,7 @@ struct SectionRange { } }; -typedef Maybe MaybeSectionRange; +using MaybeSectionRange = Maybe; // CompilerEnvironment holds any values that will be needed to compute // compilation parameters once the module's feature opt-in sections have been diff --git a/js/xpconnect/src/XPCMaps.h b/js/xpconnect/src/XPCMaps.h index 8fdb811b3962..39fdf8ca16b2 100644 --- a/js/xpconnect/src/XPCMaps.h +++ b/js/xpconnect/src/XPCMaps.h @@ -357,7 +357,7 @@ class NativeSetMap { class XPCWrappedNativeProtoMap { public: - typedef PLDHashEntryStub Entry; + using Entry = PLDHashEntryStub; XPCWrappedNativeProtoMap(); diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 2b18b0e0243f..832c9b2c3e65 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -585,8 +585,8 @@ class XPCJSRuntime final : public mozilla::CycleCollectedJSRuntime { JS::Value mStrJSVals[XPCJSContext::IDX_TOTAL_COUNT]; struct Hasher { - typedef RefPtr Key; - typedef Key Lookup; + using Key = RefPtr; + using Lookup = Key; static uint32_t hash(const Lookup& l) { return l->GetOriginNoSuffixHash(); } static bool match(const Key& k, const Lookup& l) { return k->FastEquals(l); @@ -1826,7 +1826,7 @@ class XPCConvert { const void* buf, const nsXPTType& type, const nsID* iid, uint32_t count, nsresult* pErr); - typedef std::function ArrayAllocFixupLen; + using ArrayAllocFixupLen = std::function; /** * Convert a JS::Value into a native array. @@ -2083,11 +2083,11 @@ class TypedAutoMarkingPtr : public AutoMarkingPtr { T* mPtr; }; -typedef TypedAutoMarkingPtr AutoMarkingWrappedNativePtr; -typedef TypedAutoMarkingPtr - AutoMarkingWrappedNativeTearOffPtr; -typedef TypedAutoMarkingPtr - AutoMarkingWrappedNativeProtoPtr; +using AutoMarkingWrappedNativePtr = TypedAutoMarkingPtr; +using AutoMarkingWrappedNativeTearOffPtr = + TypedAutoMarkingPtr; +using AutoMarkingWrappedNativeProtoPtr = + TypedAutoMarkingPtr; /***************************************************************************/ namespace xpc { diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index 1f7f73056f53..83fc33a4b740 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -43,7 +43,7 @@ class Exception; } // namespace dom } // namespace mozilla -typedef void (*xpcGCCallback)(JSGCStatus status); +using xpcGCCallback = void (*)(JSGCStatus); namespace xpc {