From aab004d66fed24812c628e35cbdb613f23337c85 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 28 Jul 2016 22:23:10 -0700 Subject: [PATCH] Bug 1289987 - Part 3: Remove curly braces workaround for VS2013 ICE in ranged for loops in js/. r=fitzgen --- js/public/HeapAPI.h | 3 +-- js/src/asmjs/WasmIonCompile.cpp | 3 +-- js/src/jsapi-tests/testGCExactRooting.cpp | 12 ++++-------- .../testSharedImmutableStringsCache.cpp | 3 +-- js/src/jscntxt.cpp | 3 +-- js/src/jsgc.cpp | 18 ++++++------------ js/src/jspubtd.h | 3 +-- js/src/jsweakmap.cpp | 3 +-- 8 files changed, 16 insertions(+), 32 deletions(-) diff --git a/js/public/HeapAPI.h b/js/public/HeapAPI.h index 0b8cc08293f5..12d753e85c49 100644 --- a/js/public/HeapAPI.h +++ b/js/public/HeapAPI.h @@ -126,9 +126,8 @@ struct Zone barrierTracer_(barrierTracerArg), needsIncrementalBarrier_(false) { - for (auto& stackRootPtr : stackRoots_) { + for (auto& stackRootPtr : stackRoots_) stackRootPtr = nullptr; - } } bool needsIncrementalBarrier() const { diff --git a/js/src/asmjs/WasmIonCompile.cpp b/js/src/asmjs/WasmIonCompile.cpp index b66fee4988d3..15c50ec886dc 100644 --- a/js/src/asmjs/WasmIonCompile.cpp +++ b/js/src/asmjs/WasmIonCompile.cpp @@ -220,9 +220,8 @@ class FunctionCompiler MOZ_ASSERT(loopDepth_ == 0); MOZ_ASSERT(blockDepth_ == 0); #ifdef DEBUG - for (ControlFlowPatchVector& patches : blockPatches_) { + for (ControlFlowPatchVector& patches : blockPatches_) MOZ_ASSERT(patches.empty()); - } #endif MOZ_ASSERT(inDeadCode()); MOZ_ASSERT(done(), "all bytes must be consumed"); diff --git a/js/src/jsapi-tests/testGCExactRooting.cpp b/js/src/jsapi-tests/testGCExactRooting.cpp index 0f2e46be5bc7..ff1177aa4cbb 100644 --- a/js/src/jsapi-tests/testGCExactRooting.cpp +++ b/js/src/jsapi-tests/testGCExactRooting.cpp @@ -263,9 +263,8 @@ BEGIN_TEST(testGCRootedVector) } // Ensure iterator enumeration works through the rooted. - for (auto shape : shapes) { + for (auto shape : shapes) CHECK(shape); - } CHECK(receiveConstRefToShapeVector(shapes)); @@ -280,9 +279,8 @@ bool receiveConstRefToShapeVector(const JS::Rooted>& rooted) { // Ensure range enumeration works through the reference. - for (auto shape : rooted) { + for (auto shape : rooted) CHECK(shape); - } return true; } @@ -290,9 +288,8 @@ bool receiveHandleToShapeVector(JS::Handle> handle) { // Ensure range enumeration works through the handle. - for (auto shape : handle) { + for (auto shape : handle) CHECK(shape); - } return true; } @@ -300,9 +297,8 @@ bool receiveMutableHandleToShapeVector(JS::MutableHandle> handle) { // Ensure range enumeration works through the handle. - for (auto shape : handle) { + for (auto shape : handle) CHECK(shape); - } return true; } END_TEST(testGCRootedVector) diff --git a/js/src/jsapi-tests/testSharedImmutableStringsCache.cpp b/js/src/jsapi-tests/testSharedImmutableStringsCache.cpp index c4dd596bce28..dc3eb589798b 100644 --- a/js/src/jsapi-tests/testSharedImmutableStringsCache.cpp +++ b/js/src/jsapi-tests/testSharedImmutableStringsCache.cpp @@ -81,9 +81,8 @@ BEGIN_TEST(testSharedImmutableStringsCache) threads.infallibleAppend(thread); } - for (auto thread : threads) { + for (auto thread : threads) CHECK(PR_JoinThread(thread) == PR_SUCCESS); - } return true; } diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 0bf324507e0a..c4f9bde0e120 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -140,9 +140,8 @@ js::DestroyContext(JSContext* cx) void RootLists::checkNoGCRooters() { #ifdef DEBUG - for (auto const& stackRootPtr : stackRoots_) { + for (auto const& stackRootPtr : stackRoots_) MOZ_ASSERT(stackRootPtr == nullptr); - } #endif } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 7c44bbd67ef6..27727fc33c7f 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -1426,9 +1426,8 @@ GCRuntime::removeFinalizeCallback(JSFinalizeCallback callback) void GCRuntime::callFinalizeCallbacks(FreeOp* fop, JSFinalizeStatus status) const { - for (auto& p : finalizeCallbacks) { + for (auto& p : finalizeCallbacks) p.op(fop, status, !isFull, p.data); - } } bool @@ -1452,9 +1451,8 @@ GCRuntime::removeWeakPointerZoneGroupCallback(JSWeakPointerZoneGroupCallback cal void GCRuntime::callWeakPointerZoneGroupCallbacks() const { - for (auto const& p : updateWeakPointerZoneGroupCallbacks) { + for (auto const& p : updateWeakPointerZoneGroupCallbacks) p.op(rt->contextFromMainThread(), p.data); - } } bool @@ -1478,9 +1476,8 @@ GCRuntime::removeWeakPointerCompartmentCallback(JSWeakPointerCompartmentCallback void GCRuntime::callWeakPointerCompartmentCallbacks(JSCompartment* comp) const { - for (auto const& p : updateWeakPointerCompartmentCallbacks) { + for (auto const& p : updateWeakPointerCompartmentCallbacks) p.op(rt->contextFromMainThread(), comp, p.data); - } } JS::GCSliceCallback @@ -2054,9 +2051,8 @@ ArenaLists::relocateArenas(Zone* zone, Arena*& relocatedListOut, JS::gcreason::R size_t relocCount = 0; AllAllocKindArray toRelocate; - for (auto kind : AllocKindsToRelocate) { + for (auto kind : AllocKindsToRelocate) toRelocate[kind] = arenaLists[kind].pickArenasToRelocate(arenaCount, relocCount); - } if (!ShouldRelocateZone(arenaCount, relocCount, reason)) return false; @@ -2824,9 +2820,8 @@ ArenaLists::queueForegroundObjectsForSweep(FreeOp* fop) gcstats::AutoPhase ap(fop->runtime()->gc.stats, gcstats::PHASE_SWEEP_OBJECT); #ifdef DEBUG - for (auto i : ObjectAllocKinds()) { // Braces needed to appease MSVC 2013. + for (auto i : ObjectAllocKinds()) MOZ_ASSERT(savedObjectArenas[i].isEmpty()); - } MOZ_ASSERT(savedEmptyObjectArenas == nullptr); #endif @@ -3785,9 +3780,8 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAcces MOZ_ASSERT(!zone->isCollecting()); MOZ_ASSERT(!zone->compartments.empty()); #ifdef DEBUG - for (auto i : AllAllocKinds()) { // Braces needed to appease MSVC 2013. + for (auto i : AllAllocKinds()) MOZ_ASSERT(!zone->arenas.arenaListsToSweep[i]); - } #endif /* Set up which zones will be collected. */ diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index e01307b62cd3..51d917480e95 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -287,9 +287,8 @@ class RootLists public: RootLists() : autoGCRooters_(nullptr) { - for (auto& stackRootPtr : stackRoots_) { + for (auto& stackRootPtr : stackRoots_) stackRootPtr = nullptr; - } } ~RootLists() { diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 5f07a6e6cad9..e97ef1a640bf 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -89,9 +89,8 @@ WeakMapBase::sweepZone(JS::Zone* zone) } #ifdef DEBUG - for (WeakMapBase* m : zone->gcWeakMapList) { + for (WeakMapBase* m : zone->gcWeakMapList) MOZ_ASSERT(m->isInList() && m->marked); - } #endif }