Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in js/ r=bbouvier
authorSylvestre Ledru <sledru@mozilla.com>
Wed, 08 Feb 2017 14:24:51 +0100
changeset 342522 7bdff34f5eab7677cbd7aef45f04dfc40eb1f638
parent 342521 dcd3b1f4bc69dcd481f53ff84de46bb6702f936c
child 342523 7e5f3ebcd77c71796a6ab52186b950f78dea7b78
push id31357
push userkwierso@gmail.com
push dateTue, 14 Feb 2017 00:49:21 +0000
treeherdermozilla-central@bca082441767 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1337358
milestone54.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 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in js/ r=bbouvier MozReview-Commit-ID: 9QrvFfu3wbL
js/src/ctypes/CTypes.cpp
js/src/frontend/Parser.cpp
js/src/jsarray.cpp
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -4566,18 +4566,18 @@ CType::Trace(JSTracer* trc, JSObject* ob
       return;
 
     FunctionInfo* fninfo = static_cast<FunctionInfo*>(slot.toPrivate());
     MOZ_ASSERT(fninfo);
 
     // Identify our objects to the tracer.
     JS::TraceEdge(trc, &fninfo->mABI, "abi");
     JS::TraceEdge(trc, &fninfo->mReturnType, "returnType");
-    for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i)
-      JS::TraceEdge(trc, &fninfo->mArgTypes[i], "argType");
+    for (auto & argType : fninfo->mArgTypes)
+      JS::TraceEdge(trc, &argType, "argType");
 
     break;
   }
   default:
     // Nothing to do here.
     break;
   }
 }
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -933,18 +933,17 @@ template <typename ParseHandler>
 bool
 Parser<ParseHandler>::hasValidSimpleStrictParameterNames()
 {
     MOZ_ASSERT(pc->isFunctionBox() && pc->functionBox()->hasSimpleParameterList());
 
     if (pc->functionBox()->hasDuplicateParameters)
         return false;
 
-    for (size_t i = 0; i < pc->positionalFormalParameterNames().length(); i++) {
-        JSAtom* name = pc->positionalFormalParameterNames()[i];
+    for (auto* name : pc->positionalFormalParameterNames()) {
         MOZ_ASSERT(name);
         if (!isValidStrictBinding(name->asPropertyName()))
             return false;
     }
     return true;
 }
 
 template <typename ParseHandler>
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -2887,18 +2887,17 @@ SliceSparse(JSContext* cx, HandleObject 
     bool success;
     if (!GetIndexedPropertiesInRange(cx, obj, begin, end, indexes, &success))
         return false;
 
     if (!success)
         return SliceSlowly(cx, obj, begin, end, result);
 
     RootedValue value(cx);
-    for (size_t i = 0, len = indexes.length(); i < len; i++) {
-        uint32_t index = indexes[i];
+    for (size_t index : indexes) {
         MOZ_ASSERT(begin <= index && index < end);
 
         bool hole;
         if (!GetElement(cx, obj, index, &hole, &value))
             return false;
 
         if (!hole && !DefineElement(cx, result, index - begin, value))
             return false;