Bug 1516697 - Use |using| to define various typedefs in AsmJS.cpp. r=arai
authorJeff Walden <jwalden@mit.edu>
Fri, 28 Dec 2018 21:00:57 -0600
changeset 509931 6bdb62915f688c4cb729c1e9fcbbee4bf56a42bd
parent 509930 5f69b689d7c214eb27a522cbff027fc0b2605a4b
child 509932 cf7153f42f1cbe530b7f86189b8555a9598929c1
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1516697
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516697 - Use |using| to define various typedefs in AsmJS.cpp. r=arai
js/src/wasm/AsmJS.cpp
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -1114,18 +1114,18 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
       return bytes_;
     }
     Uint32Vector& callSiteLineNums() {
       MOZ_ASSERT(defined_);
       return callSiteLineNums_;
     }
   };
 
-  typedef Vector<const Func*> ConstFuncVector;
-  typedef Vector<Func> FuncVector;
+  using ConstFuncVector = Vector<const Func*>;
+  using FuncVector = Vector<Func>;
 
   class Table {
     uint32_t sigIndex_;
     PropertyName* name_;
     uint32_t firstUse_;
     uint32_t mask_;
     bool defined_;
 
@@ -1146,17 +1146,17 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
     unsigned mask() const { return mask_; }
     bool defined() const { return defined_; }
     void define() {
       MOZ_ASSERT(!defined_);
       defined_ = true;
     }
   };
 
-  typedef Vector<Table*> TableVector;
+  using TableVector = Vector<Table*>;
 
   class Global {
    public:
     enum Which {
       Variable,
       ConstantLiteral,
       ConstantImport,
       Function,
@@ -1287,17 +1287,17 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
 
    public:
     HashableSig(uint32_t sigIndex, const TypeDefVector& types)
         : sigIndex_(sigIndex), types_(types) {}
     uint32_t sigIndex() const { return sigIndex_; }
     const FuncType& funcType() const { return types_[sigIndex_].funcType(); }
 
     // Implement HashPolicy:
-    typedef const FuncType& Lookup;
+    using Lookup = const FuncType&;
     static HashNumber hash(Lookup l) { return l.hash(); }
     static bool match(HashableSig lhs, Lookup rhs) {
       return lhs.funcType() == rhs;
     }
   };
 
   class NamedSig : public HashableSig {
     PropertyName* name_;
@@ -1317,21 +1317,21 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
     static HashNumber hash(Lookup l) {
       return HashGeneric(l.name, l.funcType.hash());
     }
     static bool match(NamedSig lhs, Lookup rhs) {
       return lhs.name() == rhs.name && lhs.funcType() == rhs.funcType;
     }
   };
 
-  typedef HashSet<HashableSig, HashableSig> SigSet;
-  typedef HashMap<NamedSig, uint32_t, NamedSig> FuncImportMap;
-  typedef HashMap<PropertyName*, Global*> GlobalMap;
-  typedef HashMap<PropertyName*, MathBuiltin> MathNameMap;
-  typedef Vector<ArrayView> ArrayViewVector;
+  using SigSet = HashSet<HashableSig, HashableSig>;
+  using FuncImportMap = HashMap<NamedSig, uint32_t, NamedSig>;
+  using GlobalMap = HashMap<PropertyName*, Global*>;
+  using MathNameMap = HashMap<PropertyName*, MathBuiltin>;
+  using ArrayViewVector = Vector<ArrayView>;
 
   JSContext* cx_;
   AsmJSParser& parser_;
   CodeNode* moduleFunctionNode_;
   PropertyName* moduleFunctionName_;
   PropertyName* globalArgumentName_;
   PropertyName* importArgumentName_;
   PropertyName* bufferArgumentName_;
@@ -3817,18 +3817,18 @@ static bool CheckMathMinMax(FunctionVali
         return false;
       }
     }
   }
 
   return true;
 }
 
-typedef bool (*CheckArgType)(FunctionValidator& f, ParseNode* argNode,
-                             Type type);
+using CheckArgType = bool (*)(FunctionValidator& f, ParseNode* argNode,
+                              Type type);
 
 template <CheckArgType checkArg>
 static bool CheckCallArgs(FunctionValidator& f, ParseNode* callNode,
                           ValTypeVector* args) {
   ParseNode* argNode = CallArgList(callNode);
   for (unsigned i = 0; i < CallArgListLength(callNode);
        i++, argNode = NextNode(argNode)) {
     Type type;
@@ -5910,17 +5910,18 @@ static bool ParseFunction(ModuleValidato
   return true;
 }
 
 static bool CheckFunction(ModuleValidator& m) {
   // asm.js modules can be quite large when represented as parse trees so pop
   // the backing LifoAlloc after parsing/compiling each function. Release the
   // parser's lifo memory after the last use of a parse node.
   AsmJSParser::Mark mark = m.parser().mark();
-  auto releaseMark = mozilla::MakeScopeExit([&] { m.parser().release(mark); });
+  auto releaseMark =
+      mozilla::MakeScopeExit([&m, &mark] { m.parser().release(mark); });
 
   CodeNode* funNode = nullptr;
   unsigned line = 0;
   if (!ParseFunction(m, &funNode, &line)) {
     return false;
   }
 
   if (!CheckFunctionHead(m, funNode)) {