bug 1617532 - js/ replace typedef by using r=jandem

Done with:
./mach static-analysis check --checks="-*, modernize-use-using" --fix js/

Differential Revision: https://phabricator.services.mozilla.com/D63821

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2020-02-24 11:08:17 +00:00
parent 617cedcd11
commit 17f939518a
110 changed files with 515 additions and 532 deletions

View File

@ -18,7 +18,7 @@ namespace jsipc {
template <class Base>
class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base {
typedef WrapperAnswer Answer;
using Answer = WrapperAnswer;
public:
virtual ~JavaScriptBase() {}

View File

@ -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());
}

View File

@ -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();

View File

@ -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,

View File

@ -292,47 +292,47 @@ static inline uint64_t swapBytes(uint64_t x) {
template <typename DataType>
struct DataToRepType {
typedef DataType result;
using result = DataType;
};
template <>
struct DataToRepType<int8_t> {
typedef uint8_t result;
using result = uint8_t;
};
template <>
struct DataToRepType<uint8_t> {
typedef uint8_t result;
using result = uint8_t;
};
template <>
struct DataToRepType<int16_t> {
typedef uint16_t result;
using result = uint16_t;
};
template <>
struct DataToRepType<uint16_t> {
typedef uint16_t result;
using result = uint16_t;
};
template <>
struct DataToRepType<int32_t> {
typedef uint32_t result;
using result = uint32_t;
};
template <>
struct DataToRepType<uint32_t> {
typedef uint32_t result;
using result = uint32_t;
};
template <>
struct DataToRepType<int64_t> {
typedef uint64_t result;
using result = uint64_t;
};
template <>
struct DataToRepType<uint64_t> {
typedef uint64_t result;
using result = uint64_t;
};
template <>
struct DataToRepType<float> {
typedef uint32_t result;
using result = uint32_t;
};
template <>
struct DataToRepType<double> {
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<uint8_t*> dest, uint8_t* src,
template <typename DataType, typename BufferPtrType>
struct DataViewIO {
typedef typename DataToRepType<DataType>::result ReadWriteType;
using ReadWriteType = typename DataToRepType<DataType>::result;
static constexpr auto alignMask =
std::min<size_t>(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1;

View File

@ -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);

View File

@ -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);

View File

@ -25,10 +25,10 @@ namespace js {
class ModuleEnvironmentObject;
class ModuleObject;
typedef Rooted<ModuleObject*> RootedModuleObject;
typedef Handle<ModuleObject*> HandleModuleObject;
typedef Rooted<ModuleEnvironmentObject*> RootedModuleEnvironmentObject;
typedef Handle<ModuleEnvironmentObject*> HandleModuleEnvironmentObject;
using RootedModuleObject = Rooted<ModuleObject*>;
using HandleModuleObject = Handle<ModuleObject*>;
using RootedModuleEnvironmentObject = Rooted<ModuleEnvironmentObject*>;
using HandleModuleEnvironmentObject = Handle<ModuleEnvironmentObject*>;
class ImportEntryObject : public NativeObject {
public:
@ -53,10 +53,10 @@ class ImportEntryObject : public NativeObject {
uint32_t columnNumber() const;
};
typedef Rooted<ImportEntryObject*> RootedImportEntryObject;
typedef Handle<ImportEntryObject*> HandleImportEntryObject;
typedef Rooted<GCVector<ImportEntryObject*>> RootedImportEntryVector;
typedef MutableHandle<ImportEntryObject*> MutableHandleImportEntryObject;
using RootedImportEntryObject = Rooted<ImportEntryObject*>;
using HandleImportEntryObject = Handle<ImportEntryObject*>;
using RootedImportEntryVector = Rooted<GCVector<ImportEntryObject*> >;
using MutableHandleImportEntryObject = MutableHandle<ImportEntryObject*>;
template <XDRMode mode>
XDRResult XDRImportEntryObject(XDRState<mode>* xdr,
@ -92,8 +92,8 @@ class ExportEntryObject : public NativeObject {
template <XDRMode mode>
XDRResult XDRExportEntries(XDRState<mode>* xdr, MutableHandleArrayObject vec);
typedef Rooted<ExportEntryObject*> RootedExportEntryObject;
typedef Handle<ExportEntryObject*> HandleExportEntryObject;
using RootedExportEntryObject = Rooted<ExportEntryObject*>;
using HandleExportEntryObject = Handle<ExportEntryObject*>;
class RequestedModuleObject : public NativeObject {
public:
@ -110,11 +110,11 @@ class RequestedModuleObject : public NativeObject {
uint32_t columnNumber() const;
};
typedef Rooted<RequestedModuleObject*> RootedRequestedModuleObject;
typedef Handle<RequestedModuleObject*> HandleRequestedModuleObject;
typedef Rooted<GCVector<RequestedModuleObject*>> RootedRequestedModuleVector;
typedef MutableHandle<RequestedModuleObject*>
MutableHandleRequestedModuleObject;
using RootedRequestedModuleObject = Rooted<RequestedModuleObject*>;
using HandleRequestedModuleObject = Handle<RequestedModuleObject*>;
using RootedRequestedModuleVector = Rooted<GCVector<RequestedModuleObject*> >;
using MutableHandleRequestedModuleObject =
MutableHandle<RequestedModuleObject*>;
template <XDRMode mode>
XDRResult XDRRequestedModuleObject(XDRState<mode>* xdr,
@ -221,8 +221,8 @@ class ModuleNamespaceObject : public ProxyObject {
static const ProxyHandler proxyHandler;
};
typedef Rooted<ModuleNamespaceObject*> RootedModuleNamespaceObject;
typedef Handle<ModuleNamespaceObject*> HandleModuleNamespaceObject;
using RootedModuleNamespaceObject = Rooted<ModuleNamespaceObject*>;
using HandleModuleNamespaceObject = Handle<ModuleNamespaceObject*>;
struct FunctionDeclaration {
FunctionDeclaration(HandleAtom name, uint32_t funIndex);

View File

@ -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<AST_LIMIT> CallbackArray;
using CallbackArray = AutoValueArray<AST_LIMIT>;
JSContext* cx;
frontend::Parser<frontend::FullParseHandler, char16_t>* parser;

View File

@ -1758,7 +1758,7 @@ static int BoyerMooreHorspool(const TextChar* text, uint32_t textLen,
template <typename TextChar, typename PatChar>
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 <typename TextChar, typename PatChar>
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;

View File

@ -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<FindPathHandler> Traversal;
using NodeData = BackEdge;
using Traversal = JS::ubi::BreadthFirst<FindPathHandler>;
FindPathHandler(JSContext* cx, JS::ubi::Node start, JS::ubi::Node target,
MutableHandle<GCVector<Value>> nodes, Vector<EdgeName>& edges)

View File

@ -204,7 +204,7 @@ class TypeDescr : public NativeObject {
static void finalize(JSFreeOp* fop, JSObject* obj);
};
typedef Handle<TypeDescr*> HandleTypeDescr;
using HandleTypeDescr = Handle<TypeDescr*>;
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<StructTypeDescr*> HandleStructTypeDescr;
using HandleStructTypeDescr = Handle<StructTypeDescr*>;
/*
* This object exists in order to encapsulate the typed object types
@ -638,7 +638,7 @@ class TypedObject : public JSObject {
}
};
typedef Handle<TypedObject*> HandleTypedObject;
using HandleTypedObject = Handle<TypedObject*>;
class OutlineTypedObject : public TypedObject {
// The object which owns the data this object points to. Because this

View File

@ -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,

View File

@ -521,7 +521,7 @@ JSObject* CreateInternal(JSContext* cx, HandleObject baseType);
JSObject* GetBaseType(JSObject* obj);
} // namespace PointerType
typedef UniquePtr<ffi_type> UniquePtrFFIType;
using UniquePtrFFIType = UniquePtr<ffi_type>;
namespace ArrayType {
JSObject* CreateInternal(JSContext* cx, HandleObject baseType, size_t length,

View File

@ -164,7 +164,7 @@ class DebugAPI {
// change due to debugger activity.
class ExecutionObservableSet {
public:
typedef HashSet<Zone*>::Range ZoneRange;
using ZoneRange = HashSet<Zone*>::Range;
virtual Zone* singleZone() const { return nullptr; }
virtual JSScript* singleScriptForZoneInvalidation() const {

View File

@ -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<ObjectQuery> Traversal;
using Traversal = JS::ubi::BreadthFirst<ObjectQuery>;
bool operator()(Traversal& traversal, JS::ubi::Node origin,
const JS::ubi::Edge& edge, NodeData*, bool first) {
if (!first) {

View File

@ -341,8 +341,8 @@ extern void CheckDebuggeeThing(JSObject* obj, bool invisibleOk);
template <class Referent, class Wrapper, bool InvisibleKeysOk = false>
class DebuggerWeakMap : private WeakMap<HeapPtr<Referent*>, HeapPtr<Wrapper*>> {
private:
typedef HeapPtr<Referent*> Key;
typedef HeapPtr<Wrapper*> Value;
using Key = HeapPtr<Referent*>;
using Value = HeapPtr<Wrapper*>;
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.
//

View File

@ -55,8 +55,8 @@ namespace detail {
template <class T, class Ops, class AllocPolicy>
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<Key*>(&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 T, class OrderedHashPolicy, class AllocPolicy>
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<T&>(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) {}

View File

@ -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_);
}

View File

@ -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)) {

View File

@ -12,7 +12,7 @@
#include "jstypes.h"
typedef uint8_t jssrcnote;
using jssrcnote = uint8_t;
namespace js {

View File

@ -984,8 +984,8 @@ struct MovableCellHasher<WeakHeapPtr<T>> {
/* Useful for hashtables with a HeapPtr as key. */
template <class T>
struct HeapPtrHasher {
typedef HeapPtr<T> Key;
typedef T Lookup;
using Key = HeapPtr<T>;
using Lookup = T;
static HashNumber hash(Lookup obj) { return DefaultHasher<T>::hash(obj); }
static bool match(const Key& k, Lookup l) { return k.get() == l; }
@ -994,8 +994,8 @@ struct HeapPtrHasher {
template <class T>
struct PreBarrieredHasher {
typedef PreBarriered<T> Key;
typedef T Lookup;
using Key = PreBarriered<T>;
using Lookup = T;
static HashNumber hash(Lookup obj) { return DefaultHasher<T>::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 <class T>
struct WeakHeapPtrHasher {
typedef WeakHeapPtr<T> Key;
typedef T Lookup;
using Key = WeakHeapPtr<T>;
using Lookup = T;
static HashNumber hash(Lookup obj) { return DefaultHasher<T>::hash(obj); }
static bool match(const Key& k, Lookup l) { return k.unbarrieredGet() == l; }

View File

@ -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

View File

@ -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<ArenasPerChunk> PerArenaBitmap;
using PerArenaBitmap = BitArray<ArenasPerChunk>;
const size_t ChunkPadSize = ChunkSize - (sizeof(Arena) * ArenasPerChunk) -
sizeof(ChunkBitmap) - sizeof(PerArenaBitmap) -

View File

@ -736,11 +736,11 @@ void js::gc::TraceRangeInternal(JSTracer* trc, size_t len, T* vec,
namespace js {
typedef bool HasNoImplicitEdgesType;
using HasNoImplicitEdgesType = bool;
template <typename T>
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<T> call markImplicitEdges.
template <>
struct ImplicitEdgeHolderType<JSObject*> {
typedef JSObject* Type;
using Type = JSObject*;
};
template <>
struct ImplicitEdgeHolderType<BaseScript*> {
typedef BaseScript* Type;
using Type = BaseScript*;
};
void GCMarker::markEphemeronValues(gc::Cell* markedCell,

View File

@ -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 <typename T>
using TraceFunction = void (*)(JSTracer* trc, T* ref, const char* name);

View File

@ -37,65 +37,65 @@ class ModuleObject;
// These are internal counterparts to the public types such as HandleObject.
typedef JS::Handle<NativeObject*> HandleNativeObject;
typedef JS::Handle<Shape*> HandleShape;
typedef JS::Handle<ObjectGroup*> HandleObjectGroup;
typedef JS::Handle<JSAtom*> HandleAtom;
typedef JS::Handle<JSLinearString*> HandleLinearString;
typedef JS::Handle<PropertyName*> HandlePropertyName;
typedef JS::Handle<ArrayObject*> HandleArrayObject;
typedef JS::Handle<PlainObject*> HandlePlainObject;
typedef JS::Handle<SavedFrame*> HandleSavedFrame;
typedef JS::Handle<ScriptSourceObject*> HandleScriptSourceObject;
typedef JS::Handle<DebuggerArguments*> HandleDebuggerArguments;
typedef JS::Handle<DebuggerEnvironment*> HandleDebuggerEnvironment;
typedef JS::Handle<DebuggerFrame*> HandleDebuggerFrame;
typedef JS::Handle<DebuggerObject*> HandleDebuggerObject;
typedef JS::Handle<DebuggerScript*> HandleDebuggerScript;
typedef JS::Handle<DebuggerSource*> HandleDebuggerSource;
typedef JS::Handle<Scope*> HandleScope;
typedef JS::Handle<ModuleObject*> HandleModuleObject;
using HandleNativeObject = JS::Handle<NativeObject*>;
using HandleShape = JS::Handle<Shape*>;
using HandleObjectGroup = JS::Handle<ObjectGroup*>;
using HandleAtom = JS::Handle<JSAtom*>;
using HandleLinearString = JS::Handle<JSLinearString*>;
using HandlePropertyName = JS::Handle<PropertyName*>;
using HandleArrayObject = JS::Handle<ArrayObject*>;
using HandlePlainObject = JS::Handle<PlainObject*>;
using HandleSavedFrame = JS::Handle<SavedFrame*>;
using HandleScriptSourceObject = JS::Handle<ScriptSourceObject*>;
using HandleDebuggerArguments = JS::Handle<DebuggerArguments*>;
using HandleDebuggerEnvironment = JS::Handle<DebuggerEnvironment*>;
using HandleDebuggerFrame = JS::Handle<DebuggerFrame*>;
using HandleDebuggerObject = JS::Handle<DebuggerObject*>;
using HandleDebuggerScript = JS::Handle<DebuggerScript*>;
using HandleDebuggerSource = JS::Handle<DebuggerSource*>;
using HandleScope = JS::Handle<Scope*>;
using HandleModuleObject = JS::Handle<ModuleObject*>;
typedef JS::MutableHandle<Shape*> MutableHandleShape;
typedef JS::MutableHandle<JSAtom*> MutableHandleAtom;
typedef JS::MutableHandle<NativeObject*> MutableHandleNativeObject;
typedef JS::MutableHandle<PlainObject*> MutableHandlePlainObject;
typedef JS::MutableHandle<SavedFrame*> MutableHandleSavedFrame;
typedef JS::MutableHandle<DebuggerArguments*> MutableHandleDebuggerArguments;
typedef JS::MutableHandle<DebuggerEnvironment*>
MutableHandleDebuggerEnvironment;
typedef JS::MutableHandle<DebuggerFrame*> MutableHandleDebuggerFrame;
typedef JS::MutableHandle<DebuggerObject*> MutableHandleDebuggerObject;
typedef JS::MutableHandle<DebuggerScript*> MutableHandleDebuggerScript;
typedef JS::MutableHandle<DebuggerSource*> MutableHandleDebuggerSource;
typedef JS::MutableHandle<Scope*> MutableHandleScope;
typedef JS::MutableHandle<ModuleObject*> MutableHandleModuleObject;
typedef JS::MutableHandle<ArrayObject*> MutableHandleArrayObject;
using MutableHandleShape = JS::MutableHandle<Shape*>;
using MutableHandleAtom = JS::MutableHandle<JSAtom*>;
using MutableHandleNativeObject = JS::MutableHandle<NativeObject*>;
using MutableHandlePlainObject = JS::MutableHandle<PlainObject*>;
using MutableHandleSavedFrame = JS::MutableHandle<SavedFrame*>;
using MutableHandleDebuggerArguments = JS::MutableHandle<DebuggerArguments*>;
using MutableHandleDebuggerEnvironment =
JS::MutableHandle<DebuggerEnvironment*>;
using MutableHandleDebuggerFrame = JS::MutableHandle<DebuggerFrame*>;
using MutableHandleDebuggerObject = JS::MutableHandle<DebuggerObject*>;
using MutableHandleDebuggerScript = JS::MutableHandle<DebuggerScript*>;
using MutableHandleDebuggerSource = JS::MutableHandle<DebuggerSource*>;
using MutableHandleScope = JS::MutableHandle<Scope*>;
using MutableHandleModuleObject = JS::MutableHandle<ModuleObject*>;
using MutableHandleArrayObject = JS::MutableHandle<ArrayObject*>;
typedef JS::Rooted<NativeObject*> RootedNativeObject;
typedef JS::Rooted<Shape*> RootedShape;
typedef JS::Rooted<ObjectGroup*> RootedObjectGroup;
typedef JS::Rooted<JSAtom*> RootedAtom;
typedef JS::Rooted<JSLinearString*> RootedLinearString;
typedef JS::Rooted<PropertyName*> RootedPropertyName;
typedef JS::Rooted<ArrayObject*> RootedArrayObject;
typedef JS::Rooted<GlobalObject*> RootedGlobalObject;
typedef JS::Rooted<PlainObject*> RootedPlainObject;
typedef JS::Rooted<SavedFrame*> RootedSavedFrame;
typedef JS::Rooted<ScriptSourceObject*> RootedScriptSourceObject;
typedef JS::Rooted<DebuggerArguments*> RootedDebuggerArguments;
typedef JS::Rooted<DebuggerEnvironment*> RootedDebuggerEnvironment;
typedef JS::Rooted<DebuggerFrame*> RootedDebuggerFrame;
typedef JS::Rooted<DebuggerObject*> RootedDebuggerObject;
typedef JS::Rooted<DebuggerScript*> RootedDebuggerScript;
typedef JS::Rooted<DebuggerSource*> RootedDebuggerSource;
typedef JS::Rooted<Scope*> RootedScope;
typedef JS::Rooted<ModuleObject*> RootedModuleObject;
using RootedNativeObject = JS::Rooted<NativeObject*>;
using RootedShape = JS::Rooted<Shape*>;
using RootedObjectGroup = JS::Rooted<ObjectGroup*>;
using RootedAtom = JS::Rooted<JSAtom*>;
using RootedLinearString = JS::Rooted<JSLinearString*>;
using RootedPropertyName = JS::Rooted<PropertyName*>;
using RootedArrayObject = JS::Rooted<ArrayObject*>;
using RootedGlobalObject = JS::Rooted<GlobalObject*>;
using RootedPlainObject = JS::Rooted<PlainObject*>;
using RootedSavedFrame = JS::Rooted<SavedFrame*>;
using RootedScriptSourceObject = JS::Rooted<ScriptSourceObject*>;
using RootedDebuggerArguments = JS::Rooted<DebuggerArguments*>;
using RootedDebuggerEnvironment = JS::Rooted<DebuggerEnvironment*>;
using RootedDebuggerFrame = JS::Rooted<DebuggerFrame*>;
using RootedDebuggerObject = JS::Rooted<DebuggerObject*>;
using RootedDebuggerScript = JS::Rooted<DebuggerScript*>;
using RootedDebuggerSource = JS::Rooted<DebuggerSource*>;
using RootedScope = JS::Rooted<Scope*>;
using RootedModuleObject = JS::Rooted<ModuleObject*>;
typedef JS::GCVector<JSFunction*> FunctionVector;
typedef JS::GCVector<PropertyName*> PropertyNameVector;
typedef JS::GCVector<Shape*> ShapeVector;
typedef JS::GCVector<JSString*> StringVector;
using FunctionVector = JS::GCVector<JSFunction*>;
using PropertyNameVector = JS::GCVector<PropertyName*>;
using ShapeVector = JS::GCVector<Shape*>;
using StringVector = JS::GCVector<JSString*>;
/**
* Interface substitute for Rooted<T> which does not root the variable's
@ -168,9 +168,9 @@ class MaybeRooted {};
template <typename T>
class MaybeRooted<T, CanGC> {
public:
typedef JS::Handle<T> HandleType;
typedef JS::Rooted<T> RootType;
typedef JS::MutableHandle<T> MutableHandleType;
using HandleType = JS::Handle<T>;
using RootType = JS::Rooted<T>;
using MutableHandleType = JS::MutableHandle<T>;
static inline JS::Handle<T> toHandle(HandleType v) { return v; }
@ -187,9 +187,9 @@ class MaybeRooted<T, CanGC> {
template <typename T>
class MaybeRooted<T, NoGC> {
public:
typedef const T& HandleType;
typedef FakeRooted<T> RootType;
typedef FakeMutableHandle<T> MutableHandleType;
using HandleType = const T&;
using RootType = FakeRooted<T>;
using MutableHandleType = FakeMutableHandle<T>;
static JS::Handle<T> toHandle(HandleType v) { MOZ_CRASH("Bad conversion"); }

View File

@ -236,7 +236,7 @@ class StoreBuffer {
template <typename Edge>
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<ValueEdge> Hasher;
using Hasher = PointerEdgeHasher<ValueEdge>;
};
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_);
}

View File

@ -35,10 +35,10 @@ struct DataType<JS::Value> {
template <typename K, typename V>
struct Utils {
typedef typename DataType<K>::BarrieredType KeyType;
typedef typename DataType<V>::BarrieredType ValueType;
using KeyType = typename DataType<K>::BarrieredType;
using ValueType = typename DataType<V>::BarrieredType;
typedef WeakMap<KeyType, ValueType> Type;
typedef Type* PtrType;
using PtrType = Type*;
static PtrType cast(void* ptr) { return static_cast<PtrType>(ptr); }
};
@ -89,7 +89,7 @@ bool JS::WeakMapPtr<K, V>::put(JSContext* cx, const K& key, const V& value) {
template <typename K, typename V>
V JS::WeakMapPtr<K, V>::removeValue(const K& key) {
typedef typename WeakMapDetails::Utils<K, V>::Type Map;
typedef typename Map::Ptr Ptr;
using Ptr = typename Map::Ptr;
MOZ_ASSERT(initialized());

View File

@ -152,7 +152,7 @@ struct UsePosition : public TempObject,
}
};
typedef InlineForwardListIterator<UsePosition> UsePositionIterator;
using UsePositionIterator = InlineForwardListIterator<UsePosition>;
// Backtracking allocator data structures overview.
//
@ -186,8 +186,8 @@ class LiveRange : public TempObject {
class BundleLink : public InlineForwardListNode<BundleLink> {};
class RegisterLink : public InlineForwardListNode<RegisterLink> {};
typedef InlineForwardListIterator<BundleLink> BundleLinkIterator;
typedef InlineForwardListIterator<RegisterLink> RegisterLinkIterator;
using BundleLinkIterator = InlineForwardListIterator<BundleLink>;
using RegisterLinkIterator = InlineForwardListIterator<RegisterLink>;
// 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<CallRange> CallRangeList;
using CallRangeList = InlineList<CallRange>;
CallRangeList callRangesList;
SplayTree<CallRange*, CallRange> callRanges;
@ -586,7 +586,7 @@ class BacktrackingAllocator : protected RegisterAllocator {
SpillSlot(uint32_t slot, LifoAlloc* alloc)
: alloc(slot), allocated(alloc) {}
};
typedef InlineForwardList<SpillSlot> SpillSlotList;
using SpillSlotList = InlineForwardList<SpillSlot>;
// All allocated slots of each width.
SpillSlotList normalSlots, doubleSlots, quadSlots;

View File

@ -53,7 +53,7 @@ struct DebugModeOSREntry {
}
};
typedef Vector<DebugModeOSREntry> DebugModeOSREntryVector;
using DebugModeOSREntryVector = Vector<DebugModeOSREntry>;
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;

View File

@ -35,7 +35,7 @@ template <typename T>
class InlineForwardList : protected InlineForwardListNode<T> {
friend class InlineForwardListIterator<T>;
typedef InlineForwardListNode<T> Node;
using Node = InlineForwardListNode<T>;
Node* tail_;
#ifdef DEBUG
@ -52,7 +52,7 @@ class InlineForwardList : protected InlineForwardListNode<T> {
}
public:
typedef InlineForwardListIterator<T> iterator;
using iterator = InlineForwardListIterator<T>;
public:
iterator begin() const { return iterator(this); }
@ -144,7 +144,7 @@ class InlineForwardListIterator {
private:
friend class InlineForwardList<T>;
typedef InlineForwardListNode<T> Node;
using Node = InlineForwardListNode<T>;
explicit InlineForwardListIterator<T>(const InlineForwardList<T>* owner)
: prev(const_cast<Node*>(static_cast<const Node*>(owner))),
@ -252,14 +252,14 @@ class InlineListNode : public InlineForwardListNode<T> {
template <typename T>
class InlineList : protected InlineListNode<T> {
typedef InlineListNode<T> Node;
using Node = InlineListNode<T>;
public:
InlineList() : InlineListNode<T>(this, this) {}
public:
typedef InlineListIterator<T> iterator;
typedef InlineListReverseIterator<T> reverse_iterator;
using iterator = InlineListIterator<T>;
using reverse_iterator = InlineListReverseIterator<T>;
public:
iterator begin() const { return iterator(static_cast<Node*>(this->next)); }
@ -351,7 +351,7 @@ class InlineListIterator {
private:
friend class InlineList<T>;
typedef InlineListNode<T> Node;
using Node = InlineListNode<T>;
explicit InlineListIterator(const Node* iter)
: iter(const_cast<Node*>(iter)) {}
@ -393,7 +393,7 @@ class InlineListReverseIterator {
private:
friend class InlineList<T>;
typedef InlineListNode<T> Node;
using Node = InlineListNode<T>;
explicit InlineListReverseIterator(const Node* iter)
: iter(const_cast<Node*>(iter)) {}
@ -438,14 +438,14 @@ class InlineConcatListIterator;
template <typename T>
class InlineConcatList {
private:
typedef InlineConcatList<T> Node;
using Node = InlineConcatList<T>;
InlineConcatList<T>* thisFromConstructor() { return this; }
public:
InlineConcatList() : next(nullptr), tail(thisFromConstructor()) {}
typedef InlineConcatListIterator<T> iterator;
using iterator = InlineConcatListIterator<T>;
iterator begin() const { return iterator(this); }
@ -473,7 +473,7 @@ class InlineConcatListIterator {
private:
friend class InlineConcatList<T>;
typedef InlineConcatList<T> Node;
using Node = InlineConcatList<T>;
explicit InlineConcatListIterator(const Node* iter)
: iter(const_cast<Node*>(iter)) {}
@ -510,7 +510,7 @@ class InlineSpaghettiStackIterator;
template <typename T>
class InlineSpaghettiStackNode : public InlineForwardListNode<T> {
typedef InlineForwardListNode<T> Parent;
using Parent = InlineForwardListNode<T>;
public:
InlineSpaghettiStackNode() : Parent() {}
@ -529,13 +529,13 @@ template <typename T>
class InlineSpaghettiStack : protected InlineSpaghettiStackNode<T> {
friend class InlineSpaghettiStackIterator<T>;
typedef InlineSpaghettiStackNode<T> Node;
using Node = InlineSpaghettiStackNode<T>;
public:
InlineSpaghettiStack() {}
public:
typedef InlineSpaghettiStackIterator<T> iterator;
using iterator = InlineSpaghettiStackIterator<T>;
public:
iterator begin() const { return iterator(this); }
@ -557,7 +557,7 @@ class InlineSpaghettiStackIterator {
private:
friend class InlineSpaghettiStack<T>;
typedef InlineSpaghettiStackNode<T> Node;
using Node = InlineSpaghettiStackNode<T>;
explicit InlineSpaghettiStackIterator<T>(const InlineSpaghettiStack<T>* owner)
: iter(owner ? static_cast<Node*>(owner->next) : nullptr) {}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -819,8 +819,8 @@ class LElementVisitor {
: ins_(nullptr), lastPC_(nullptr), lastNotInlinedPC_(nullptr) {}
};
typedef InlineList<LInstruction>::iterator LInstructionIterator;
typedef InlineList<LInstruction>::reverse_iterator LInstructionReverseIterator;
using LInstructionIterator = InlineList<LInstruction>::iterator;
using LInstructionReverseIterator = InlineList<LInstruction>::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<SlotEntry, 0, JitAllocPolicy> 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; }
};

View File

@ -251,7 +251,7 @@ class MUse : public TempObject, public InlineListNode<MUse> {
#endif
};
typedef InlineList<MUse>::iterator MUseIterator;
using MUseIterator = InlineList<MUse>::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<T>& operator=(const CompilerGCPointer<T>&) = delete;
};
typedef CompilerGCPointer<JSObject*> CompilerObject;
typedef CompilerGCPointer<NativeObject*> CompilerNativeObject;
typedef CompilerGCPointer<JSFunction*> CompilerFunction;
typedef CompilerGCPointer<JSScript*> CompilerScript;
typedef CompilerGCPointer<PropertyName*> CompilerPropertyName;
typedef CompilerGCPointer<Shape*> CompilerShape;
typedef CompilerGCPointer<ObjectGroup*> CompilerObjectGroup;
using CompilerObject = CompilerGCPointer<JSObject*>;
using CompilerNativeObject = CompilerGCPointer<NativeObject*>;
using CompilerFunction = CompilerGCPointer<JSFunction*>;
using CompilerScript = CompilerGCPointer<JSScript*>;
using CompilerPropertyName = CompilerGCPointer<PropertyName*>;
using CompilerShape = CompilerGCPointer<Shape*>;
using CompilerObjectGroup = CompilerGCPointer<ObjectGroup*>;
class MRootList : public TempObject {
public:
@ -1321,7 +1321,7 @@ class MVariadicT : public T {
}
};
typedef MVariadicT<MInstruction> MVariadicInstruction;
using MVariadicInstruction = MVariadicT<MInstruction>;
// 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<MStoreToRecover> MStoresToRecoverList;
using MStoresToRecoverList = InlineSpaghettiStack<MStoreToRecover>;
// 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

View File

@ -24,9 +24,9 @@ class MStart;
class MDefinitionIterator;
typedef InlineListIterator<MInstruction> MInstructionIterator;
typedef InlineListReverseIterator<MInstruction> MInstructionReverseIterator;
typedef InlineListIterator<MPhi> MPhiIterator;
using MInstructionIterator = InlineListIterator<MInstruction>;
using MInstructionReverseIterator = InlineListReverseIterator<MInstruction>;
using MPhiIterator = InlineListIterator<MPhi>;
#ifdef DEBUG
typedef InlineForwardListIterator<MResumePoint> MResumePointIterator;
@ -703,9 +703,9 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> {
#endif
};
typedef InlineListIterator<MBasicBlock> MBasicBlockIterator;
typedef InlineListIterator<MBasicBlock> ReversePostorderIterator;
typedef InlineListReverseIterator<MBasicBlock> PostorderIterator;
using MBasicBlockIterator = InlineListIterator<MBasicBlock>;
using ReversePostorderIterator = InlineListIterator<MBasicBlock>;
using PostorderIterator = InlineListReverseIterator<MBasicBlock>;
typedef Vector<MBasicBlock*, 1, JitAllocPolicy> MIRGraphReturns;

View File

@ -255,7 +255,7 @@ class MoveResolver {
}
};
typedef InlineList<MoveResolver::PendingMove>::iterator PendingMoveIterator;
using PendingMoveIterator = InlineList<MoveResolver::PendingMove>::iterator;
js::Vector<MoveOp, 16, SystemAllocPolicy> orderedMoves_;
int numCycles_;

View File

@ -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;

View File

@ -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 <typename T>
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<Register> GeneralRegisterSet;
typedef TypedRegisterSet<FloatRegister> FloatRegisterSet;
using GeneralRegisterSet = TypedRegisterSet<Register>;
using FloatRegisterSet = TypedRegisterSet<FloatRegister>;
class AnyRegisterIterator;
@ -473,9 +473,9 @@ class LiveSet;
template <typename Set>
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<RegisterSet> {
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<RegisterSet> {
template <typename Set>
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<RegisterSet> {
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<RegisterSet> {
// |takeAny| variants.
template <class Accessors, typename Set>
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 Accessors>
class SpecializedRegSet<Accessors, RegisterSet> : public Accessors {
typedef Accessors Parent;
using Parent = Accessors;
public:
DEFINE_ACCESSOR_CONSTRUCTORS_(SpecializedRegSet)
@ -1007,13 +1007,13 @@ class AllocatableSet<RegisterSet>
#undef DEFINE_ACCESSOR_CONSTRUCTORS_FOR_REGISTERSET_
#undef DEFINE_ACCESSOR_CONSTRUCTORS_
typedef AllocatableSet<GeneralRegisterSet> AllocatableGeneralRegisterSet;
typedef AllocatableSet<FloatRegisterSet> AllocatableFloatRegisterSet;
typedef AllocatableSet<RegisterSet> AllocatableRegisterSet;
using AllocatableGeneralRegisterSet = AllocatableSet<GeneralRegisterSet>;
using AllocatableFloatRegisterSet = AllocatableSet<FloatRegisterSet>;
using AllocatableRegisterSet = AllocatableSet<RegisterSet>;
typedef LiveSet<GeneralRegisterSet> LiveGeneralRegisterSet;
typedef LiveSet<FloatRegisterSet> LiveFloatRegisterSet;
typedef LiveSet<RegisterSet> LiveRegisterSet;
using LiveGeneralRegisterSet = LiveSet<GeneralRegisterSet>;
using LiveFloatRegisterSet = LiveSet<FloatRegisterSet>;
using LiveRegisterSet = LiveSet<RegisterSet>;
// 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<RegTypeName::Any>(); }
};
typedef TypedRegisterIterator<Register> GeneralRegisterIterator;
typedef TypedRegisterIterator<FloatRegister> FloatRegisterIterator;
typedef TypedRegisterBackwardIterator<Register> GeneralRegisterBackwardIterator;
typedef TypedRegisterBackwardIterator<FloatRegister>
FloatRegisterBackwardIterator;
typedef TypedRegisterForwardIterator<Register> GeneralRegisterForwardIterator;
typedef TypedRegisterForwardIterator<FloatRegister>
FloatRegisterForwardIterator;
using GeneralRegisterIterator = TypedRegisterIterator<Register>;
using FloatRegisterIterator = TypedRegisterIterator<FloatRegister>;
using GeneralRegisterBackwardIterator = TypedRegisterBackwardIterator<Register>;
using FloatRegisterBackwardIterator =
TypedRegisterBackwardIterator<FloatRegister>;
using GeneralRegisterForwardIterator = TypedRegisterForwardIterator<Register>;
using FloatRegisterForwardIterator =
TypedRegisterForwardIterator<FloatRegister>;
class AnyRegisterIterator {
GeneralRegisterIterator geniter_;

View File

@ -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<Register> AutoRegisterScope;
typedef AutoGenericRegisterScope<FloatRegister> AutoFloatRegisterScope;
using AutoRegisterScope = AutoGenericRegisterScope<Register>;
using AutoFloatRegisterScope = AutoGenericRegisterScope<FloatRegister>;
} // namespace jit
} // namespace js

View File

@ -22,7 +22,7 @@ namespace jit {
template <typename MemoryView>
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:

View File

@ -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<RVA, uint32_t, RVA::Hasher, SystemAllocPolicy> RValueAllocMap;
RValueAllocMap allocMap_;

View File

@ -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<LDefinition*, 0, SystemAllocPolicy> virtualRegisters;

View File

@ -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 <unsigned Op>
class BoxPolicy final : public TypePolicy {

View File

@ -773,19 +773,19 @@ struct LastArg;
template <>
struct LastArg<> {
typedef void Type;
using Type = void;
static constexpr size_t nbArgs = 0;
};
template <typename HeadType>
struct LastArg<HeadType> {
typedef HeadType Type;
using Type = HeadType;
static constexpr size_t nbArgs = 1;
};
template <typename HeadType, typename... TailTypes>
struct LastArg<HeadType, TailTypes...> {
typedef typename LastArg<TailTypes...>::Type Type;
using Type = typename LastArg<TailTypes...>::Type;
static constexpr size_t nbArgs = LastArg<TailTypes...>::nbArgs + 1;
};

View File

@ -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);

View File

@ -983,7 +983,7 @@ class BaseAssemblerX64 : public BaseAssembler {
}
};
typedef BaseAssemblerX64 BaseAssemblerSpecific;
using BaseAssemblerSpecific = BaseAssemblerX64;
} // namespace X86Encoding

View File

@ -31,7 +31,7 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared {
void emitWasmStore(T* ins);
};
typedef CodeGeneratorX64 CodeGeneratorSpecific;
using CodeGeneratorSpecific = CodeGeneratorX64;
} // namespace jit
} // namespace js

View File

@ -50,7 +50,7 @@ class LIRGeneratorX64 : public LIRGeneratorX86Shared {
void lowerUModI64(MMod* mod);
};
typedef LIRGeneratorX64 LIRGeneratorSpecific;
using LIRGeneratorSpecific = LIRGeneratorX64;
} // namespace jit
} // namespace js

View File

@ -1022,7 +1022,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared {
void profilerExitFrame();
};
typedef MacroAssemblerX64 MacroAssemblerSpecific;
using MacroAssemblerSpecific = MacroAssemblerX64;
} // namespace jit
} // namespace js

View File

@ -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 <typename T>
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.
//

View File

@ -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() {

View File

@ -121,7 +121,7 @@ const MacroAssembler& MacroAssemblerX86Shared::asMasm() const {
template <class T, class Map>
T* MacroAssemblerX86Shared::getConstant(const typename T::Pod& value, Map& map,
Vector<T, 0, SystemAllocPolicy>& vec) {
typedef typename Map::AddPtr AddPtr;
using AddPtr = typename Map::AddPtr;
size_t index;
if (AddPtr p = map.lookupForAdd(value)) {
index = p->value();

View File

@ -34,7 +34,7 @@ class MacroAssemblerX86Shared : public Assembler {
// knows what to use instead of copying these data structures.
template <class T>
struct Constant {
typedef T Pod;
using Pod = T;
T value;
UsesVector uses;

View File

@ -67,7 +67,7 @@ class MoveEmitterX86 {
size_t i);
};
typedef MoveEmitterX86 MoveEmitter;
using MoveEmitter = MoveEmitterX86;
} // namespace jit
} // namespace js

View File

@ -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,

View File

@ -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<JS::detail::NoUsedRval> {
private:
typedef JS::detail::CallArgsBase<JS::detail::NoUsedRval> Base;
using Base = JS::detail::CallArgsBase<JS::detail::NoUsedRval>;
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

View File

@ -67,7 +67,7 @@ static const JSConstDoubleSpec math_constants[] = {
// clang-format on
};
typedef double (*UnaryMathFunctionType)(double);
using UnaryMathFunctionType = double (*)(double);
template <UnaryMathFunctionType F>
static bool math_function(JSContext* cx, HandleValue val,
@ -541,7 +541,7 @@ template <typename T>
T js::GetBiggestNumberLessThan(T x) {
MOZ_ASSERT(!IsNegative(x));
MOZ_ASSERT(IsFinite(x));
typedef typename mozilla::FloatingPoint<T>::Bits Bits;
using Bits = typename mozilla::FloatingPoint<T>::Bits;
Bits bits = mozilla::BitwiseCast<Bits>(x);
MOZ_ASSERT(bits > 0, "will underflow");
return mozilla::BitwiseCast<T>(bits - 1);

View File

@ -15,7 +15,7 @@
namespace js {
typedef double (*UnaryFunType)(double);
using UnaryFunType = double (*)(double);
/*
* JS math functions.

View File

@ -69,8 +69,8 @@ class JSLinearString;
template <typename T>
struct JSConstScalarSpec;
typedef JSConstScalarSpec<double> JSConstDoubleSpec;
typedef JSConstScalarSpec<int32_t> JSConstIntegerSpec;
using JSConstDoubleSpec = JSConstScalarSpec<double>;
using JSConstIntegerSpec = JSConstScalarSpec<int32_t>;
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 */

View File

@ -178,7 +178,7 @@ class ExclusiveData {
template <class T>
class ExclusiveWaitableData : public ExclusiveData<T> {
typedef ExclusiveData<T> Base;
using Base = ExclusiveData<T>;
mutable ConditionVariable condVar_;
@ -192,7 +192,7 @@ class ExclusiveWaitableData : public ExclusiveData<T> {
: Base(id, std::forward<Args>(args)...) {}
class MOZ_STACK_CLASS Guard : public ExclusiveData<T>::Guard {
typedef typename ExclusiveData<T>::Guard Base;
using Base = typename ExclusiveData<T>::Guard;
public:
explicit Guard(const ExclusiveWaitableData& parent) : Base(parent) {}

View File

@ -18,7 +18,7 @@
using namespace js;
typedef mozilla::SmprintfPolicyPointer<js::SystemAllocPolicy> JSSmprintfPointer;
using JSSmprintfPointer = mozilla::SmprintfPolicyPointer<js::SystemAllocPolicy>;
JS_PUBLIC_API JS::UniqueChars JS_smprintf(const char* fmt, ...) {
va_list ap;

View File

@ -126,12 +126,12 @@ class ArrayBufferObjectMaybeShared : public NativeObject {
inline bool isWasm() const;
};
typedef Rooted<ArrayBufferObjectMaybeShared*>
RootedArrayBufferObjectMaybeShared;
typedef Handle<ArrayBufferObjectMaybeShared*>
HandleArrayBufferObjectMaybeShared;
typedef MutableHandle<ArrayBufferObjectMaybeShared*>
MutableHandleArrayBufferObjectMaybeShared;
using RootedArrayBufferObjectMaybeShared =
Rooted<ArrayBufferObjectMaybeShared*>;
using HandleArrayBufferObjectMaybeShared =
Handle<ArrayBufferObjectMaybeShared*>;
using MutableHandleArrayBufferObjectMaybeShared =
MutableHandle<ArrayBufferObjectMaybeShared*>;
/*
* ArrayBufferObject
@ -466,9 +466,9 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
}
};
typedef Rooted<ArrayBufferObject*> RootedArrayBufferObject;
typedef Handle<ArrayBufferObject*> HandleArrayBufferObject;
typedef MutableHandle<ArrayBufferObject*> MutableHandleArrayBufferObject;
using RootedArrayBufferObject = Rooted<ArrayBufferObject*>;
using HandleArrayBufferObject = Handle<ArrayBufferObject*>;
using MutableHandleArrayBufferObject = MutableHandle<ArrayBufferObject*>;
bool CreateWasmBuffer(JSContext* cx, const wasm::Limits& memory,
MutableHandleArrayBufferObjectMaybeShared buffer);

View File

@ -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(); }
};

View File

@ -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
//

View File

@ -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);

View File

@ -38,8 +38,8 @@
using namespace js;
typedef Rooted<ArgumentsObject*> RootedArgumentsObject;
typedef MutableHandle<ArgumentsObject*> MutableHandleArgumentsObject;
using RootedArgumentsObject = Rooted<ArgumentsObject*>;
using MutableHandleArgumentsObject = MutableHandle<ArgumentsObject*>;
/*****************************************************************************/

View File

@ -23,7 +23,7 @@
namespace js {
class ModuleObject;
typedef Handle<ModuleObject*> HandleModuleObject;
using HandleModuleObject = Handle<ModuleObject*>;
/*
* Return a shape representing the static scope containing the variable
@ -445,10 +445,10 @@ class ModuleEnvironmentObject : public EnvironmentObject {
bool enumerableOnly);
};
typedef Rooted<ModuleEnvironmentObject*> RootedModuleEnvironmentObject;
typedef Handle<ModuleEnvironmentObject*> HandleModuleEnvironmentObject;
typedef MutableHandle<ModuleEnvironmentObject*>
MutableHandleModuleEnvironmentObject;
using RootedModuleEnvironmentObject = Rooted<ModuleEnvironmentObject*>;
using HandleModuleEnvironmentObject = Handle<ModuleEnvironmentObject*>;
using MutableHandleModuleEnvironmentObject =
MutableHandle<ModuleEnvironmentObject*>;
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 {

View File

@ -548,7 +548,7 @@ class GlobalObject : public NativeObject {
}
private:
typedef bool (*ObjectInitOp)(JSContext* cx, Handle<GlobalObject*> global);
using ObjectInitOp = bool (*)(JSContext*, Handle<GlobalObject*>);
static JSObject* getOrCreateObject(JSContext* cx,
Handle<GlobalObject*> global,

View File

@ -72,7 +72,7 @@ struct Tier2GeneratorTask : public RunnableTask {
virtual void cancel() = 0;
};
typedef UniquePtr<Tier2GeneratorTask> UniqueTier2GeneratorTask;
using UniqueTier2GeneratorTask = UniquePtr<Tier2GeneratorTask>;
typedef Vector<Tier2GeneratorTask*, 0, SystemAllocPolicy>
Tier2GeneratorTaskPtrVector;
@ -98,10 +98,10 @@ class GlobalHelperThreadState {
typedef Vector<jit::IonCompileTask*, 0, SystemAllocPolicy>
IonCompileTaskVector;
typedef Vector<ParseTask*, 0, SystemAllocPolicy> ParseTaskVector;
typedef mozilla::LinkedList<ParseTask> ParseTaskList;
using ParseTaskList = mozilla::LinkedList<ParseTask>;
typedef Vector<UniquePtr<SourceCompressionTask>, 0, SystemAllocPolicy>
SourceCompressionTaskVector;
typedef mozilla::LinkedList<GCParallelTask> GCParallelTaskList;
using GCParallelTaskList = mozilla::LinkedList<GCParallelTask>;
typedef Vector<PromiseHelperTask*, 0, SystemAllocPolicy>
PromiseHelperTaskVector;
typedef Vector<JSContext*, 0, SystemAllocPolicy> ContextVector;

View File

@ -53,7 +53,7 @@ using mozilla::DebugOnly;
using mozilla::Maybe;
using mozilla::PodCopy;
typedef Rooted<PropertyIteratorObject*> RootedPropertyIteratorObject;
using RootedPropertyIteratorObject = Rooted<PropertyIteratorObject*>;
static const gc::AllocKind ITERATOR_FINALIZE_KIND =
gc::AllocKind::OBJECT2_BACKGROUND;

View File

@ -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();
}

View File

@ -209,7 +209,7 @@ class MOZ_STACK_CLASS JSONParserBase {
template <typename CharT>
class MOZ_STACK_CLASS JSONParser : public JSONParserBase {
private:
typedef mozilla::RangedPtr<const CharT> CharPtr;
using CharPtr = mozilla::RangedPtr<const CharT>;
CharPtr current;
const CharPtr begin, end;

View File

@ -24,8 +24,8 @@ class PICStub {
friend class PICChain<Category>;
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 <typename Category>
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<ForOfPIC> BaseStub;
typedef PICChain<ForOfPIC> BaseChain;
using BaseStub = PICStub<ForOfPIC>;
using BaseChain = PICChain<ForOfPIC>;
/*
* A ForOfPIC has only one kind of stub for now: one that holds the shape

View File

@ -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<JSAtom*>::hash(l.atom);
return mozilla::AddToHash(hash, l.flags.value());

View File

@ -142,16 +142,16 @@ class SavedFrame : public NativeObject {
};
struct SavedFrame::HashPolicy {
typedef SavedFrame::Lookup Lookup;
typedef MovableCellHasher<SavedFrame*> SavedFramePtrHasher;
typedef PointerHasher<JSPrincipals*> JSPrincipalsPtrHasher;
using Lookup = SavedFrame::Lookup;
using SavedFramePtrHasher = MovableCellHasher<SavedFrame*>;
using JSPrincipalsPtrHasher = PointerHasher<JSPrincipals*>;
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<SavedFrame*> Key;
using Key = WeakHeapPtr<SavedFrame*>;
static void rekey(Key& key, const Key& newKey);
};

View File

@ -124,8 +124,8 @@ class Shape;
struct StackShape;
struct ShapeHasher : public DefaultHasher<Shape*> {
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<jsid> {
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; }
};

View File

@ -247,10 +247,10 @@ bool IsSharedArrayBuffer(JSObject* o);
SharedArrayBufferObject& AsSharedArrayBuffer(HandleObject o);
typedef Rooted<SharedArrayBufferObject*> RootedSharedArrayBufferObject;
typedef Handle<SharedArrayBufferObject*> HandleSharedArrayBufferObject;
typedef MutableHandle<SharedArrayBufferObject*>
MutableHandleSharedArrayBufferObject;
using RootedSharedArrayBufferObject = Rooted<SharedArrayBufferObject*>;
using HandleSharedArrayBufferObject = Handle<SharedArrayBufferObject*>;
using MutableHandleSharedArrayBufferObject =
MutableHandle<SharedArrayBufferObject*>;
} // namespace js

View File

@ -981,7 +981,7 @@ namespace mozilla {
template <>
struct DefaultHasher<js::AbstractFramePtr> {
typedef js::AbstractFramePtr Lookup;
using Lookup = js::AbstractFramePtr;
static js::HashNumber hash(const Lookup& key) {
return mozilla::HashGeneric(key.raw());

View File

@ -173,7 +173,7 @@ namespace js {
template <typename T, typename AllocPolicy>
struct BufferIterator {
typedef mozilla::BufferList<AllocPolicy> BufferList;
using BufferList = mozilla::BufferList<AllocPolicy>;
explicit BufferIterator(const BufferList& buffer)
: mBuffer(buffer), mIter(buffer.Iter()) {

View File

@ -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; }

View File

@ -1667,7 +1667,7 @@ void HeapTypeSetKey::freeze(CompilerConstraintList* constraints) {
LifoAlloc* alloc = constraints->alloc();
LifoAlloc::AutoFallibleScope fallibleAllocator(alloc);
typedef CompilerConstraintInstance<ConstraintDataFreeze> T;
using T = CompilerConstraintInstance<ConstraintDataFreeze>;
constraints->add(alloc->new_<T>(alloc, *this, ConstraintDataFreeze()));
}
@ -1869,7 +1869,7 @@ bool TypeSet::ObjectKey::hasFlags(CompilerConstraintList* constraints,
HeapTypeSetKey objectProperty = property(JSID_EMPTY);
LifoAlloc* alloc = constraints->alloc();
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectFlags> T;
using T = CompilerConstraintInstance<ConstraintDataFreezeObjectFlags>;
constraints->add(alloc->new_<T>(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<ConstraintDataFreezeObjectFlags> T;
using T = CompilerConstraintInstance<ConstraintDataFreezeObjectFlags>;
constraints->add(
alloc->new_<T>(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<ConstraintDataFreezeObjectForTypedArrayData>;
constraints->add(
alloc->new_<T>(alloc, objectProperty,
ConstraintDataFreezeObjectForTypedArrayData(tarray)));
@ -2062,7 +2061,7 @@ bool HeapTypeSetKey::nonData(CompilerConstraintList* constraints) {
LifoAlloc* alloc = constraints->alloc();
typedef CompilerConstraintInstance<ConstraintDataFreezePropertyState> T;
using T = CompilerConstraintInstance<ConstraintDataFreezePropertyState>;
constraints->add(
alloc->new_<T>(alloc, *this,
ConstraintDataFreezePropertyState(
@ -2077,7 +2076,7 @@ bool HeapTypeSetKey::nonWritable(CompilerConstraintList* constraints) {
LifoAlloc* alloc = constraints->alloc();
typedef CompilerConstraintInstance<ConstraintDataFreezePropertyState> T;
using T = CompilerConstraintInstance<ConstraintDataFreezePropertyState>;
constraints->add(
alloc->new_<T>(alloc, *this,
ConstraintDataFreezePropertyState(
@ -2152,7 +2151,7 @@ bool HeapTypeSetKey::constant(CompilerConstraintList* constraints,
*valOut = val;
LifoAlloc* alloc = constraints->alloc();
typedef CompilerConstraintInstance<ConstraintDataConstantProperty> T;
using T = CompilerConstraintInstance<ConstraintDataConstantProperty>;
constraints->add(
alloc->new_<T>(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<ConstraintDataInert> T;
using T = CompilerConstraintInstance<ConstraintDataInert>;
constraints->add(alloc->new_<T>(alloc, *this, ConstraintDataInert()));
return false;

View File

@ -387,7 +387,7 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod {
const AsmJSMetadataCacheablePod& pod() const { return *this; }
};
typedef RefPtr<AsmJSMetadata> MutableAsmJSMetadata;
using MutableAsmJSMetadata = RefPtr<AsmJSMetadata>;
/*****************************************************************************/
// ParseNode utilities

View File

@ -46,7 +46,7 @@ using AstHashMap = HashMap<K, V, HP, LifoAllocPolicy<Fallible>>;
using mozilla::Variant;
typedef AstVector<bool> AstBoolVector;
using AstBoolVector = AstVector<bool>;
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<AstName, uint32_t, AstNameHasher>;
typedef AstVector<AstValType> AstValTypeVector;
typedef AstVector<AstExpr*> AstExprVector;
typedef AstVector<AstName> AstNameVector;
typedef AstVector<AstRef> AstRefVector;
using AstValTypeVector = AstVector<AstValType>;
using AstExprVector = AstVector<AstExpr*>;
using AstNameVector = AstVector<AstName>;
using AstRefVector = AstVector<AstRef>;
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<AstGlobal*> AstGlobalVector;
using AstGlobalVector = AstVector<AstGlobal*>;
class AstImport : public AstNode {
AstName name_;
@ -1233,11 +1233,11 @@ class AstDataSegment : public AstNode {
const AstNameVector& fragments() const { return fragments_; }
};
typedef AstVector<AstDataSegment*> AstDataSegmentVector;
using AstDataSegmentVector = AstVector<AstDataSegment*>;
struct AstNullValue {};
typedef Variant<AstRef, AstNullValue> AstElem;
typedef AstVector<AstElem> AstElemVector;
using AstElemVector = AstVector<AstElem>;
enum class AstElemSegmentKind {
Active,
@ -1271,7 +1271,7 @@ class AstElemSegment : public AstNode {
const AstElemVector& elems() const { return elems_; }
};
typedef AstVector<AstElemSegment*> AstElemSegmentVector;
using AstElemSegmentVector = AstVector<AstElemSegment*>;
class AstStartFunc : public AstNode {
AstRef func_;
@ -1304,13 +1304,13 @@ struct AstTable {
class AstModule : public AstNode {
public:
typedef AstVector<AstFunc*> FuncVector;
typedef AstVector<AstImport*> ImportVector;
typedef AstVector<AstExport*> ExportVector;
typedef AstVector<AstTypeDef*> TypeDefVector;
typedef AstVector<AstName> NameVector;
typedef AstVector<AstMemory> AstMemoryVector;
typedef AstVector<AstTable> AstTableVector;
using FuncVector = AstVector<AstFunc*>;
using ImportVector = AstVector<AstImport*>;
using ExportVector = AstVector<AstExport*>;
using TypeDefVector = AstVector<AstTypeDef*>;
using NameVector = AstVector<AstName>;
using AstMemoryVector = AstVector<AstMemory>;
using AstTableVector = AstVector<AstTable>;
private:
typedef AstHashMap<AstFuncType*, uint32_t, AstFuncType> FuncTypeMap;

View File

@ -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));
}

View File

@ -77,7 +77,7 @@ struct LinkData : LinkDataCacheablePod {
WASM_DECLARE_SERIALIZABLE(LinkData)
};
typedef UniquePtr<LinkData> UniqueLinkData;
using UniqueLinkData = UniquePtr<LinkData>;
// 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<ModuleSegment> UniqueModuleSegment;
using UniqueModuleSegment = UniquePtr<ModuleSegment>;
class ModuleSegment : public CodeSegment {
const Tier tier_;
@ -402,8 +402,8 @@ struct Metadata : public ShareableBase<Metadata>, public MetadataCacheablePod {
WASM_DECLARE_SERIALIZABLE(Metadata);
};
typedef RefPtr<Metadata> MutableMetadata;
typedef RefPtr<const Metadata> SharedMetadata;
using MutableMetadata = RefPtr<Metadata>;
using SharedMetadata = RefPtr<const Metadata>;
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<CodeTier> UniqueCodeTier;
typedef UniquePtr<const CodeTier> UniqueConstCodeTier;
using UniqueCodeTier = UniquePtr<CodeTier>;
using UniqueConstCodeTier = UniquePtr<const CodeTier>;
class CodeTier {
const Code* code_;
@ -643,8 +643,8 @@ class JumpTables {
//
// profilingLabels_ is lazily initialized, but behind a lock.
typedef RefPtr<const Code> SharedCode;
typedef RefPtr<Code> MutableCode;
using SharedCode = RefPtr<const Code>;
using MutableCode = RefPtr<Code>;
class Code : public ShareableBase<Code> {
UniqueCodeTier tier1_;

View File

@ -43,8 +43,8 @@ struct ScriptedCaller {
// Describes all the parameters that control wasm compilation.
struct CompileArgs;
typedef RefPtr<CompileArgs> MutableCompileArgs;
typedef RefPtr<const CompileArgs> SharedCompileArgs;
using MutableCompileArgs = RefPtr<CompileArgs>;
using SharedCompileArgs = RefPtr<const CompileArgs>;
struct CompileArgs : ShareableBase<CompileArgs> {
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<const uint8_t*> ExclusiveBytesPtr;
using ExclusiveBytesPtr = ExclusiveWaitableData<const uint8_t*>;
struct StreamEndData {
bool reached;
@ -133,7 +133,7 @@ struct StreamEndData {
StreamEndData() : reached(false) {}
};
typedef ExclusiveWaitableData<StreamEndData> ExclusiveStreamEndData;
using ExclusiveStreamEndData = ExclusiveWaitableData<StreamEndData>;
SharedModule CompileStreaming(const CompileArgs& args, const Bytes& envBytes,
const Bytes& codeBytes,

View File

@ -147,7 +147,7 @@ class DebugState {
Code::SeenSet* seenCode, size_t* code, size_t* data) const;
};
typedef UniquePtr<DebugState> UniqueDebugState;
using UniqueDebugState = UniquePtr<DebugState>;
} // namespace wasm
} // namespace js

View File

@ -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

View File

@ -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();

View File

@ -106,7 +106,7 @@ struct CompileTaskState {
}
};
typedef ExclusiveWaitableData<CompileTaskState> ExclusiveCompileTaskState;
using ExclusiveCompileTaskState = ExclusiveWaitableData<CompileTaskState>;
// 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.

View File

@ -42,7 +42,7 @@ using namespace js::jit;
using namespace js::wasm;
using mozilla::BitwiseCast;
typedef CheckedInt<uint32_t> CheckedU32;
using CheckedU32 = CheckedInt<uint32_t>;
class FuncTypeIdSet {
typedef HashMap<const FuncType*, uint32_t, FuncTypeHashPolicy,
@ -558,7 +558,8 @@ inline int32_t WasmMemoryCopy(T memBase, uint32_t memLen,
uint32_t len, uint8_t* memBase) {
MOZ_ASSERT(SASigMemCopy.failureMode == FailureMode::FailOnNegI32);
typedef void (*RacyMemMove)(SharedMem<uint8_t*>, SharedMem<uint8_t*>, size_t);
using RacyMemMove =
void (*)(SharedMem<uint8_t*>, SharedMem<uint8_t*>, size_t);
const SharedArrayRawBuffer* rawBuf =
SharedArrayRawBuffer::fromDataPtr(memBase);

View File

@ -236,7 +236,7 @@ class Instance {
uint32_t outputTypeIndex, void* maybeNullPtr);
};
typedef UniquePtr<Instance> UniqueInstance;
using UniqueInstance = UniquePtr<Instance>;
} // namespace wasm
} // namespace js

View File

@ -49,14 +49,14 @@ typedef Vector<MDefinition*, 8, SystemAllocPolicy> 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<IonCompilePolicy> IonOpIter;
using IonOpIter = OpIter<IonCompilePolicy>;
class FunctionCompiler;

View File

@ -32,7 +32,7 @@ struct CompileArgs;
// In the context of wasm, the OptimizedEncodingListener specifically is
// listening for the completion of tier-2.
typedef RefPtr<JS::OptimizedEncodingListener> Tier2Listener;
using Tier2Listener = RefPtr<JS::OptimizedEncodingListener>;
// 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<Module> MutableModule;
typedef RefPtr<const Module> SharedModule;
using MutableModule = RefPtr<Module>;
using SharedModule = RefPtr<const Module>;
// JS API implementations:

View File

@ -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<const ValTypeVector> Tagged;
using Tagged = TaggedValue<const ValTypeVector>;
Tagged tagged_;
enum Kind {
@ -220,7 +220,7 @@ class ResultType {
// [] -> [results] via pointer to FuncType (ignoring [params])
class BlockType {
typedef TaggedValue<const FuncType> Tagged;
using Tagged = TaggedValue<const FuncType>;
Tagged tagged_;
enum Kind {
@ -555,12 +555,12 @@ class TypeAndValueT {
template <typename Policy>
class MOZ_STACK_CLASS OpIter : private Policy {
public:
typedef typename Policy::Value Value;
typedef typename Policy::ValueVector ValueVector;
typedef TypeAndValueT<Value> TypeAndValue;
using Value = typename Policy::Value;
using ValueVector = typename Policy::ValueVector;
using TypeAndValue = TypeAndValueT<Value>;
typedef Vector<TypeAndValue, 8, SystemAllocPolicy> TypeAndValueStack;
typedef typename Policy::ControlItem ControlItem;
typedef ControlStackEntry<ControlItem> Control;
using ControlItem = typename Policy::ControlItem;
using Control = ControlStackEntry<ControlItem>;
typedef Vector<Control, 8, SystemAllocPolicy> ControlStack;
private:

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More