Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 12. r=bbouvier
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 06 Sep 2018 11:19:10 +0200
changeset 491473 710ba7b57cd3b7febccd5f390081f614ebe2df3c
parent 491472 219721735c51630107ce70c295c26b88bb87ab3a
child 491474 9a67686aabe8131742f00bdcf6919b5a2cc48f9a
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1488698
milestone64.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 1488698 - Always use braces for if/for/while statements in js/src/vm, part 12. r=bbouvier
js/src/vm/UbiNode.cpp
js/src/vm/UbiNodeCensus.cpp
js/src/vm/UbiNodeShortestPaths.cpp
js/src/vm/UnboxedObject.cpp
js/src/vm/UnboxedObject.h
js/src/vm/Xdr.cpp
js/src/vm/Xdr.h
--- a/js/src/vm/UbiNode.cpp
+++ b/js/src/vm/UbiNode.cpp
@@ -68,39 +68,42 @@ struct CopyToBufferMatcher
       , maxLength(maxLength)
     { }
 
     template<typename CharT>
     static size_t
     copyToBufferHelper(const CharT* src, RangedPtr<char16_t> dest, size_t length)
     {
         size_t i = 0;
-        for ( ; i < length; i++)
+        for ( ; i < length; i++) {
             dest[i] = src[i];
+        }
         return i;
     }
 
     size_t
     match(JSAtom* atom)
     {
-        if (!atom)
+        if (!atom) {
             return 0;
+        }
 
         size_t length = std::min(atom->length(), maxLength);
         JS::AutoCheckCannotGC noGC;
         return atom->hasTwoByteChars()
             ? copyToBufferHelper(atom->twoByteChars(noGC), destination, length)
             : copyToBufferHelper(atom->latin1Chars(noGC), destination, length);
     }
 
     size_t
     match(const char16_t* chars)
     {
-        if (!chars)
+        if (!chars) {
             return 0;
+        }
 
         size_t length = std::min(js_strlen(chars), maxLength);
         return copyToBufferHelper(chars, destination, length);
     }
 };
 
 size_t
 JS::ubi::AtomOrTwoByteChars::copyToBuffer(RangedPtr<char16_t> destination, size_t length)
@@ -181,18 +184,19 @@ struct Node::ConstructFunctor : public j
 
 Node::Node(const JS::GCCellPtr &thing)
 {
     DispatchTyped(ConstructFunctor(), thing, this);
 }
 
 Node::Node(HandleValue value)
 {
-    if (!DispatchTyped(ConstructFunctor(), value, this))
+    if (!DispatchTyped(ConstructFunctor(), value, this)) {
         construct<void>(nullptr);
+    }
 }
 
 Value
 Node::exposeToJS() const
 {
     Value v;
 
     if (is<JSObject>()) {
@@ -228,43 +232,47 @@ Node::exposeToJS() const
 class EdgeVectorTracer : public JS::CallbackTracer {
     // The vector to which we add Edges.
     EdgeVector* vec;
 
     // True if we should populate the edge's names.
     bool wantNames;
 
     void onChild(const JS::GCCellPtr& thing) override {
-        if (!okay)
+        if (!okay) {
             return;
+        }
 
         // Don't trace permanent atoms and well-known symbols that are owned by
         // a parent JSRuntime.
-        if (thing.is<JSString>() && thing.as<JSString>().isPermanentAtom())
+        if (thing.is<JSString>() && thing.as<JSString>().isPermanentAtom()) {
             return;
-        if (thing.is<JS::Symbol>() && thing.as<JS::Symbol>().isWellKnownSymbol())
+        }
+        if (thing.is<JS::Symbol>() && thing.as<JS::Symbol>().isWellKnownSymbol()) {
             return;
+        }
 
         char16_t* name16 = nullptr;
         if (wantNames) {
             // Ask the tracer to compute an edge name for us.
             char buffer[1024];
             getTracingEdgeName(buffer, sizeof(buffer));
             const char* name = buffer;
 
             // Convert the name to char16_t characters.
             name16 = js_pod_malloc<char16_t>(strlen(name) + 1);
             if (!name16) {
                 okay = false;
                 return;
             }
 
             size_t i;
-            for (i = 0; name[i]; i++)
+            for (i = 0; name[i]; i++) {
                 name16[i] = name[i];
+            }
             name16[i] = '\0';
         }
 
         // The simplest code is correct! The temporary Edge takes
         // ownership of name; if the append succeeds, the vector element
         // then takes ownership; if the append fails, then the temporary
         // retains it, and its destructor will free it.
         if (!vec->append(Edge(name16, Node(thing)))) {
@@ -304,21 +312,23 @@ template JS::Zone* TracerConcrete<JS::Sy
 template JS::Zone* TracerConcrete<BigInt>::zone() const;
 #endif
 template JS::Zone* TracerConcrete<JSString>::zone() const;
 
 template<typename Referent>
 UniquePtr<EdgeRange>
 TracerConcrete<Referent>::edges(JSContext* cx, bool wantNames) const {
     auto range = js::MakeUnique<SimpleEdgeRange>();
-    if (!range)
+    if (!range) {
         return nullptr;
+    }
 
-    if (!range->addTracerEdges(cx->runtime(), ptr, JS::MapTypeToTraceKind<Referent>::kind, wantNames))
+    if (!range->addTracerEdges(cx->runtime(), ptr, JS::MapTypeToTraceKind<Referent>::kind, wantNames)) {
         return nullptr;
+    }
 
     // Note: Clang 3.8 (or older) require an explicit construction of the
     // target UniquePtr type. When we no longer require to support these Clang
     // versions the return statement can be simplified to |return range;|.
     return UniquePtr<EdgeRange>(range.release());
 }
 
 template UniquePtr<EdgeRange> TracerConcrete<JSScript>::edges(JSContext* cx, bool wantNames) const;
@@ -378,22 +388,24 @@ Concrete<JSObject>::jsObjectConstructorN
         outName.reset(nullptr);
         return true;
     }
 
     auto len = JS_GetStringLength(name);
     auto size = len + 1;
 
     outName.reset(cx->pod_malloc<char16_t>(size * sizeof(char16_t)));
-    if (!outName)
+    if (!outName) {
         return false;
+    }
 
     mozilla::Range<char16_t> chars(outName.get(), size);
-    if (!JS_CopyStringChars(cx, chars, name))
+    if (!JS_CopyStringChars(cx, chars, name)) {
         return false;
+    }
 
     outName[len] = '\0';
     return true;
 }
 
 JS::Compartment*
 Concrete<JSObject>::compartment() const
 {
@@ -432,75 +444,84 @@ RootList::RootList(JSContext* cx, Maybe<
 { }
 
 
 bool
 RootList::init()
 {
     EdgeVectorTracer tracer(cx->runtime(), &edges, wantNames);
     js::TraceRuntime(&tracer);
-    if (!tracer.okay)
+    if (!tracer.okay) {
         return false;
+    }
     noGC.emplace();
     return true;
 }
 
 bool
 RootList::init(CompartmentSet& debuggees)
 {
     EdgeVector allRootEdges;
     EdgeVectorTracer tracer(cx->runtime(), &allRootEdges, wantNames);
 
     ZoneSet debuggeeZones;
     for (auto range = debuggees.all(); !range.empty(); range.popFront()) {
-        if (!debuggeeZones.put(range.front()->zone()))
+        if (!debuggeeZones.put(range.front()->zone())) {
             return false;
+        }
     }
 
     js::TraceRuntime(&tracer);
-    if (!tracer.okay)
+    if (!tracer.okay) {
         return false;
+    }
     TraceIncomingCCWs(&tracer, debuggees);
-    if (!tracer.okay)
+    if (!tracer.okay) {
         return false;
+    }
 
     for (EdgeVector::Range r = allRootEdges.all(); !r.empty(); r.popFront()) {
         Edge& edge = r.front();
 
         JS::Compartment* compartment = edge.referent.compartment();
-        if (compartment && !debuggees.has(compartment))
+        if (compartment && !debuggees.has(compartment)) {
             continue;
+        }
 
         Zone* zone = edge.referent.zone();
-        if (zone && !debuggeeZones.has(zone))
+        if (zone && !debuggeeZones.has(zone)) {
             continue;
+        }
 
-        if (!edges.append(std::move(edge)))
+        if (!edges.append(std::move(edge))) {
             return false;
+        }
     }
 
     noGC.emplace();
     return true;
 }
 
 bool
 RootList::init(HandleObject debuggees)
 {
     MOZ_ASSERT(debuggees && JS::dbg::IsDebugger(*debuggees));
     js::Debugger* dbg = js::Debugger::fromJSObject(debuggees.get());
 
     CompartmentSet debuggeeCompartments;
 
     for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
-        if (!debuggeeCompartments.put(r.front()->compartment()))
+        if (!debuggeeCompartments.put(r.front()->compartment())) {
             return false;
+        }
     }
 
-    if (!init(debuggeeCompartments))
+    if (!init(debuggeeCompartments)) {
         return false;
+    }
 
     // Ensure that each of our debuggee globals are in the root list.
     for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
         if (!addRoot(JS::ubi::Node(static_cast<JSObject*>(r.front())),
                      u"debuggee global"))
         {
             return false;
         }
@@ -513,18 +534,19 @@ bool
 RootList::addRoot(Node node, const char16_t* edgeName)
 {
     MOZ_ASSERT(noGC.isSome());
     MOZ_ASSERT_IF(wantNames, edgeName);
 
     UniqueTwoByteChars name;
     if (edgeName) {
         name = js::DuplicateString(edgeName);
-        if (!name)
+        if (!name) {
             return false;
+        }
     }
 
     return edges.append(Edge(name.release(), node));
 }
 
 const char16_t Concrete<RootList>::concreteTypeName[] = u"JS::ubi::RootList";
 
 UniquePtr<EdgeRange>
--- a/js/src/vm/UbiNodeCensus.cpp
+++ b/js/src/vm/UbiNodeCensus.cpp
@@ -19,18 +19,19 @@
 using namespace js;
 
 namespace JS {
 namespace ubi {
 
 JS_PUBLIC_API(void)
 CountDeleter::operator()(CountBase* ptr)
 {
-    if (!ptr)
+    if (!ptr) {
         return;
+    }
 
     // Downcast to our true type and destruct, as guided by our CountType
     // pointer.
     ptr->destruct();
     js_free(ptr);
 }
 
 /*** Count Types ***********************************************************************************/
@@ -78,45 +79,51 @@ class SimpleCount : public CountType {
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 bool
 SimpleCount::count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node)
 {
     Count& count = static_cast<Count&>(countBase);
-    if (reportBytes)
+    if (reportBytes) {
         count.totalBytes_ += node.size(mallocSizeOf);
+    }
     return true;
 }
 
 bool
 SimpleCount::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     RootedPlainObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
 
     RootedValue countValue(cx, NumberValue(count.total_));
-    if (reportCount && !DefineDataProperty(cx, obj, cx->names().count, countValue))
+    if (reportCount && !DefineDataProperty(cx, obj, cx->names().count, countValue)) {
         return false;
+    }
 
     RootedValue bytesValue(cx, NumberValue(count.totalBytes_));
-    if (reportBytes && !DefineDataProperty(cx, obj, cx->names().bytes, bytesValue))
+    if (reportBytes && !DefineDataProperty(cx, obj, cx->names().bytes, bytesValue)) {
         return false;
+    }
 
     if (label) {
         JSString* labelString = JS_NewUCStringCopyZ(cx, label.get());
-        if (!labelString)
+        if (!labelString) {
             return false;
+        }
         RootedValue labelValue(cx, StringValue(labelString));
-        if (!DefineDataProperty(cx, obj, cx->names().label, labelValue))
+        if (!DefineDataProperty(cx, obj, cx->names().label, labelValue)) {
             return false;
+        }
     }
 
     report.setObject(*obj);
     return true;
 }
 
 
 // A count type that collects all matching nodes in a bucket.
@@ -156,22 +163,24 @@ BucketCount::count(CountBase& countBase,
 
 bool
 BucketCount::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     size_t length = count.ids_.length();
     RootedArrayObject arr(cx, NewDenseFullyAllocatedArray(cx, length));
-    if (!arr)
+    if (!arr) {
         return false;
+    }
     arr->ensureDenseInitializedLength(cx, 0, length);
 
-    for (size_t i = 0; i < length; i++)
+    for (size_t i = 0; i < length; i++) {
         arr->setDenseElement(i, NumberValue(count.ids_[i]));
+    }
 
     report.setObject(*arr);
     return true;
 }
 
 
 // A type that categorizes nodes by their JavaScript type -- 'objects',
 // 'strings', 'scripts', 'domNode', and 'other' -- and then passes the nodes to child
@@ -237,18 +246,19 @@ CountBasePtr
 ByCoarseType::makeCount()
 {
     CountBasePtr objectsCount(objects->makeCount());
     CountBasePtr scriptsCount(scripts->makeCount());
     CountBasePtr stringsCount(strings->makeCount());
     CountBasePtr otherCount(other->makeCount());
     CountBasePtr domNodeCount(domNode->makeCount());
 
-    if (!objectsCount || !scriptsCount || !stringsCount || !otherCount || !domNodeCount)
+    if (!objectsCount || !scriptsCount || !stringsCount || !otherCount || !domNodeCount) {
         return CountBasePtr(nullptr);
+    }
 
     return CountBasePtr(js_new<Count>(*this,
                                       objectsCount,
                                       scriptsCount,
                                       stringsCount,
                                       otherCount,
                                       domNodeCount));
 }
@@ -287,18 +297,19 @@ ByCoarseType::count(CountBase& countBase
 }
 
 bool
 ByCoarseType::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     RootedPlainObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
 
     RootedValue objectsReport(cx);
     if (!count.objects->report(cx, &objectsReport) ||
         !DefineDataProperty(cx, obj, cx->names().objects, objectsReport))
         return false;
 
     RootedValue scriptsReport(cx);
     if (!count.scripts->report(cx, &scriptsReport) ||
@@ -330,20 +341,22 @@ ByCoarseType::report(JSContext* cx, Coun
 // arguments are doubly indirect: they're pointers to elements in an array of
 // pointers to table entries.
 template<typename Entry>
 static int compareEntries(const void* lhsVoid, const void* rhsVoid) {
     auto lhs = (*static_cast<const Entry* const*>(lhsVoid))->value()->smallestNodeIdCounted_;
     auto rhs = (*static_cast<const Entry* const*>(rhsVoid))->value()->smallestNodeIdCounted_;
 
     // We don't want to just subtract the values, as they're unsigned.
-    if (lhs < rhs)
+    if (lhs < rhs) {
         return 1;
-    if (lhs > rhs)
+    }
+    if (lhs > rhs) {
         return -1;
+    }
     return 0;
 }
 
 // A hash map mapping from C strings to counts.
 using CStringCountMap =
     HashMap<const char*, CountBasePtr, mozilla::CStringHasher, SystemAllocPolicy>;
 
 // Convert a HashMap into an object with each key one of the entries from the
@@ -362,43 +375,48 @@ countMapToObject(JSContext* cx, Map& map
     // more interesting, and a little less non-deterministic.
 
     JS::ubi::Vector<typename Map::Entry*> entries;
     if (!entries.reserve(map.count())) {
         ReportOutOfMemory(cx);
         return nullptr;
     }
 
-    for (auto r = map.all(); !r.empty(); r.popFront())
+    for (auto r = map.all(); !r.empty(); r.popFront()) {
         entries.infallibleAppend(&r.front());
+    }
 
     if (entries.length()) {
         qsort(entries.begin(), entries.length(), sizeof(*entries.begin()),
               compareEntries<typename Map::Entry>);
     }
 
     RootedPlainObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     for (auto& entry : entries) {
         CountBasePtr& thenCount = entry->value();
         RootedValue thenReport(cx);
-        if (!thenCount->report(cx, &thenReport))
+        if (!thenCount->report(cx, &thenReport)) {
             return nullptr;
+        }
 
         const char* name = getName(entry->key());
         MOZ_ASSERT(name);
         JSAtom* atom = Atomize(cx, name, strlen(name));
-        if (!atom)
+        if (!atom) {
             return nullptr;
+        }
 
         RootedId entryId(cx, AtomToId(atom));
-        if (!DefineDataProperty(cx, obj, entryId, thenReport))
+        if (!DefineDataProperty(cx, obj, entryId, thenReport)) {
             return nullptr;
+        }
     }
 
     return obj;
 }
 
 template <class Map, class GetName>
 static PlainObject*
 countMap16ToObject(JSContext* cx, Map& map, GetName getName) {
@@ -407,43 +425,48 @@ countMap16ToObject(JSContext* cx, Map& m
     // more interesting, and a little less non-deterministic.
 
     JS::ubi::Vector<typename Map::Entry*> entries;
     if (!entries.reserve(map.count())) {
         ReportOutOfMemory(cx);
         return nullptr;
     }
 
-    for (auto r = map.all(); !r.empty(); r.popFront())
+    for (auto r = map.all(); !r.empty(); r.popFront()) {
         entries.infallibleAppend(&r.front());
+    }
 
     if (entries.length()) {
         qsort(entries.begin(), entries.length(), sizeof(*entries.begin()),
               compareEntries<typename Map::Entry>);
     }
 
     RootedPlainObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     for (auto& entry : entries) {
         CountBasePtr& thenCount = entry->value();
         RootedValue thenReport(cx);
-        if (!thenCount->report(cx, &thenReport))
+        if (!thenCount->report(cx, &thenReport)) {
             return nullptr;
+        }
 
         const char16_t* name = getName(entry->key());
         MOZ_ASSERT(name);
         JSAtom* atom = AtomizeChars(cx, name, js_strlen(name));
-        if (!atom)
+        if (!atom) {
             return nullptr;
+        }
 
         RootedId entryId(cx, AtomToId(atom));
-        if (!DefineDataProperty(cx, obj, entryId, thenReport))
+        if (!DefineDataProperty(cx, obj, entryId, thenReport)) {
             return nullptr;
+        }
     }
 
     return obj;
 }
 
 
 // A type that categorizes nodes that are JSObjects by their class name,
 // and places all other nodes in an 'other' category.
@@ -486,63 +509,69 @@ class ByObjectClass : public CountType {
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 CountBasePtr
 ByObjectClass::makeCount()
 {
     CountBasePtr otherCount(otherType->makeCount());
-    if (!otherCount)
+    if (!otherCount) {
         return nullptr;
+    }
 
     auto count = js::MakeUnique<Count>(*this, otherCount);
-    if (!count)
+    if (!count) {
         return nullptr;
+    }
 
     return CountBasePtr(count.release());
 }
 
 void
 ByObjectClass::traceCount(CountBase& countBase, JSTracer* trc)
 {
     Count& count = static_cast<Count&>(countBase);
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         r.front().value()->trace(trc);
+    }
     count.other->trace(trc);
 }
 
 bool
 ByObjectClass::count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node)
 {
     Count& count = static_cast<Count&>(countBase);
 
     const char* className = node.jsObjectClassName();
-    if (!className)
+    if (!className) {
         return count.other->count(mallocSizeOf, node);
+    }
 
     Table::AddPtr p = count.table.lookupForAdd(className);
     if (!p) {
         CountBasePtr classCount(classesType->makeCount());
-        if (!classCount || !count.table.add(p, className, std::move(classCount)))
+        if (!classCount || !count.table.add(p, className, std::move(classCount))) {
             return false;
+        }
     }
     return p->value()->count(mallocSizeOf, node);
 }
 
 bool
 ByObjectClass::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     RootedPlainObject obj(cx, countMapToObject(cx, count.table, [](const char* key) {
         return key;
     }));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
 
     RootedValue otherReport(cx);
     if (!count.other->report(cx, &otherReport) ||
         !DefineDataProperty(cx, obj, cx->names().other, otherReport))
         return false;
 
     report.setObject(*obj);
     return true;
@@ -596,62 +625,68 @@ class ByDomObjectClass : public CountTyp
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 CountBasePtr
 ByDomObjectClass::makeCount()
 {
     auto count = js::MakeUnique<Count>(*this);
-    if (!count)
+    if (!count) {
         return nullptr;
+    }
 
     return CountBasePtr(count.release());
 }
 
 void
 ByDomObjectClass::traceCount(CountBase& countBase, JSTracer* trc)
 {
     Count& count = static_cast<Count&>(countBase);
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         r.front().value()->trace(trc);
+    }
 }
 
 bool
 ByDomObjectClass::count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node)
 {
     Count& count = static_cast<Count&>(countBase);
 
     const char16_t* nodeName = node.descriptiveTypeName();
-    if (!nodeName)
+    if (!nodeName) {
         return false;
+    }
 
     UniqueC16String name = DuplicateString(nodeName);
-    if (!name)
+    if (!name) {
         return false;
+    }
 
     Table::AddPtr p = count.table.lookupForAdd(name);
     if (!p) {
         CountBasePtr classesCount(classesType->makeCount());
-        if (!classesCount || !count.table.add(p, std::move(name), std::move(classesCount)))
+        if (!classesCount || !count.table.add(p, std::move(name), std::move(classesCount))) {
             return false;
+        }
     }
     return p->value()->count(mallocSizeOf, node);
 }
 
 bool
 ByDomObjectClass::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     RootedPlainObject obj(cx, countMap16ToObject(cx, count.table, [](const UniqueC16String& key) {
         return key.get();
     }));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
 
     report.setObject(*obj);
     return true;
 }
 
 // A count type that categorizes nodes by their ubi::Node::typeName.
 class ByUbinodeType : public CountType {
     // Note that, because ubi::Node::typeName promises to return a specific
@@ -685,82 +720,92 @@ class ByUbinodeType : public CountType {
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 CountBasePtr
 ByUbinodeType::makeCount()
 {
     auto count = js::MakeUnique<Count>(*this);
-    if (!count)
+    if (!count) {
         return nullptr;
+    }
 
     return CountBasePtr(count.release());
 }
 
 void
 ByUbinodeType::traceCount(CountBase& countBase, JSTracer* trc)
 {
     Count& count = static_cast<Count&>(countBase);
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         r.front().value()->trace(trc);
+    }
 }
 
 bool
 ByUbinodeType::count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node)
 {
     Count& count = static_cast<Count&>(countBase);
 
     const char16_t* key = node.typeName();
     MOZ_ASSERT(key);
     Table::AddPtr p = count.table.lookupForAdd(key);
     if (!p) {
         CountBasePtr typesCount(entryType->makeCount());
-        if (!typesCount || !count.table.add(p, key, std::move(typesCount)))
+        if (!typesCount || !count.table.add(p, key, std::move(typesCount))) {
             return false;
+        }
     }
     return p->value()->count(mallocSizeOf, node);
 }
 
 bool
 ByUbinodeType::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     // Build a vector of pointers to entries; sort by total; and then use
     // that to build the result object. This makes the ordering of entries
     // more interesting, and a little less non-deterministic.
     JS::ubi::Vector<Entry*> entries;
-    if (!entries.reserve(count.table.count()))
+    if (!entries.reserve(count.table.count())) {
         return false;
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    }
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         entries.infallibleAppend(&r.front());
-    if (entries.length())
+    }
+    if (entries.length()) {
         qsort(entries.begin(), entries.length(), sizeof(*entries.begin()), compareEntries<Entry>);
+    }
 
     // Now build the result by iterating over the sorted vector.
     RootedPlainObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
     for (Entry** entryPtr = entries.begin(); entryPtr < entries.end(); entryPtr++) {
         Entry& entry = **entryPtr;
         CountBasePtr& typeCount = entry.value();
         RootedValue typeReport(cx);
-        if (!typeCount->report(cx, &typeReport))
+        if (!typeCount->report(cx, &typeReport)) {
             return false;
+        }
 
         const char16_t* name = entry.key();
         MOZ_ASSERT(name);
         JSAtom* atom = AtomizeChars(cx, name, js_strlen(name));
-        if (!atom)
+        if (!atom) {
             return false;
+        }
         RootedId entryId(cx, AtomToId(atom));
 
-        if (!DefineDataProperty(cx, obj, entryId, typeReport))
+        if (!DefineDataProperty(cx, obj, entryId, typeReport)) {
             return false;
+        }
     }
 
     report.setObject(*obj);
     return true;
 }
 
 
 // A count type that categorizes nodes by the JS stack under which they were
@@ -827,22 +872,24 @@ class ByAllocationStack : public CountTy
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 CountBasePtr
 ByAllocationStack::makeCount()
 {
     CountBasePtr noStackCount(noStackType->makeCount());
-    if (!noStackCount)
+    if (!noStackCount) {
         return nullptr;
+    }
 
     auto count = js::MakeUnique<Count>(*this, noStackCount);
-    if (!count)
+    if (!count) {
         return nullptr;
+    }
     return CountBasePtr(count.release());
 }
 
 void
 ByAllocationStack::traceCount(CountBase& countBase, JSTracer* trc)
 {
     Count& count = static_cast<Count&>(countBase);
     for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
@@ -865,18 +912,19 @@ ByAllocationStack::count(CountBase& coun
 
     // If we do have an allocation stack for this node, include it in the
     // count for that stack.
     if (node.hasAllocationStack()) {
         auto allocationStack = node.allocationStack();
         auto p = count.table.lookupForAdd(allocationStack);
         if (!p) {
             CountBasePtr stackCount(entryType->makeCount());
-            if (!stackCount || !count.table.add(p, allocationStack, std::move(stackCount)))
+            if (!stackCount || !count.table.add(p, allocationStack, std::move(stackCount))) {
                 return false;
+            }
         }
         MOZ_ASSERT(p);
         return p->value()->count(mallocSizeOf, node);
     }
 
     // Otherwise, count it in the "no stack" category.
     return count.noStack->count(mallocSizeOf, node);
 }
@@ -890,55 +938,63 @@ ByAllocationStack::report(JSContext* cx,
     // Check that nothing rehashes our table while we hold pointers into it.
     mozilla::Generation generation = count.table.generation();
 #endif
 
     // Build a vector of pointers to entries; sort by total; and then use
     // that to build the result object. This makes the ordering of entries
     // more interesting, and a little less non-deterministic.
     JS::ubi::Vector<Entry*> entries;
-    if (!entries.reserve(count.table.count()))
+    if (!entries.reserve(count.table.count())) {
         return false;
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    }
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         entries.infallibleAppend(&r.front());
-    if (entries.length())
+    }
+    if (entries.length()) {
         qsort(entries.begin(), entries.length(), sizeof(*entries.begin()), compareEntries<Entry>);
+    }
 
     // Now build the result by iterating over the sorted vector.
     Rooted<MapObject*> map(cx, MapObject::create(cx));
-    if (!map)
+    if (!map) {
         return false;
+    }
     for (Entry** entryPtr = entries.begin(); entryPtr < entries.end(); entryPtr++) {
         Entry& entry = **entryPtr;
         MOZ_ASSERT(entry.key());
 
         RootedObject stack(cx);
         if (!entry.key().constructSavedFrameStack(cx, &stack) ||
             !cx->compartment()->wrap(cx, &stack))
             {
                 return false;
             }
         RootedValue stackVal(cx, ObjectValue(*stack));
 
         CountBasePtr& stackCount = entry.value();
         RootedValue stackReport(cx);
-        if (!stackCount->report(cx, &stackReport))
+        if (!stackCount->report(cx, &stackReport)) {
             return false;
+        }
 
-        if (!MapObject::set(cx, map, stackVal, stackReport))
+        if (!MapObject::set(cx, map, stackVal, stackReport)) {
             return false;
+        }
     }
 
     if (count.noStack->total_ > 0) {
         RootedValue noStackReport(cx);
-        if (!count.noStack->report(cx, &noStackReport))
+        if (!count.noStack->report(cx, &noStackReport)) {
             return false;
+        }
         RootedValue noStack(cx, StringValue(cx->names().noStack));
-        if (!MapObject::set(cx, map, noStack, noStackReport))
+        if (!MapObject::set(cx, map, noStack, noStackReport)) {
             return false;
+        }
     }
 
     MOZ_ASSERT(generation == count.table.generation());
 
     report.setObject(*map);
     return true;
 }
 
@@ -997,71 +1053,79 @@ class ByFilename : public CountType {
     bool count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node) override;
     bool report(JSContext* cx, CountBase& countBase, MutableHandleValue report) override;
 };
 
 CountBasePtr
 ByFilename::makeCount()
 {
     CountBasePtr thenCount(thenType->makeCount());
-    if (!thenCount)
+    if (!thenCount) {
         return nullptr;
+    }
 
     CountBasePtr noFilenameCount(noFilenameType->makeCount());
-    if (!noFilenameCount)
+    if (!noFilenameCount) {
         return nullptr;
+    }
 
     auto count = js::MakeUnique<Count>(*this, std::move(thenCount), std::move(noFilenameCount));
-    if (!count)
+    if (!count) {
         return nullptr;
+    }
 
     return CountBasePtr(count.release());
 }
 
 void
 ByFilename::traceCount(CountBase& countBase, JSTracer* trc)
 {
     Count& count = static_cast<Count&>(countBase);
-    for (Table::Range r = count.table.all(); !r.empty(); r.popFront())
+    for (Table::Range r = count.table.all(); !r.empty(); r.popFront()) {
         r.front().value()->trace(trc);
+    }
     count.noFilename->trace(trc);
 }
 
 bool
 ByFilename::count(CountBase& countBase, mozilla::MallocSizeOf mallocSizeOf, const Node& node)
 {
     Count& count = static_cast<Count&>(countBase);
 
     const char* filename = node.scriptFilename();
-    if (!filename)
+    if (!filename) {
         return count.noFilename->count(mallocSizeOf, node);
+    }
 
     UniqueCString myFilename = DuplicateString(filename);
-    if (!myFilename)
+    if (!myFilename) {
         return false;
+    }
 
     Table::AddPtr p = count.table.lookupForAdd(myFilename);
     if (!p) {
         CountBasePtr thenCount(thenType->makeCount());
-        if (!thenCount || !count.table.add(p, std::move(myFilename), std::move(thenCount)))
+        if (!thenCount || !count.table.add(p, std::move(myFilename), std::move(thenCount))) {
             return false;
+        }
     }
     return p->value()->count(mallocSizeOf, node);
 }
 
 bool
 ByFilename::report(JSContext* cx, CountBase& countBase, MutableHandleValue report)
 {
     Count& count = static_cast<Count&>(countBase);
 
     RootedPlainObject obj(cx, countMapToObject(cx, count.table, [](const UniqueCString& key) {
         return key.get();
     }));
-    if (!obj)
+    if (!obj) {
         return false;
+    }
 
     RootedValue noFilenameReport(cx);
     if (!count.noFilename->report(cx, &noFilenameReport) ||
         !DefineDataProperty(cx, obj, cx->names().noFilename, noFilenameReport))
     {
         return false;
     }
 
@@ -1074,30 +1138,32 @@ ByFilename::report(JSContext* cx, CountB
 
 JS_PUBLIC_API(bool)
 CensusHandler::operator() (BreadthFirst<CensusHandler>& traversal,
                            Node origin, const Edge& edge,
                            NodeData* referentData, bool first)
 {
     // We're only interested in the first time we reach edge.referent, not
     // in every edge arriving at that node.
-    if (!first)
+    if (!first) {
         return true;
+    }
 
     // Don't count nodes outside the debuggee zones. Do count things in the
     // special atoms zone, but don't traverse their outgoing edges, on the
     // assumption that they are shared resources that debuggee is using.
     // Symbols are always allocated in the atoms zone, even if they were
     // created for exactly one compartment and never shared; this rule will
     // include such nodes in the count.
     const Node& referent = edge.referent;
     Zone* zone = referent.zone();
 
-    if (census.targetZones.count() == 0 || census.targetZones.has(zone))
+    if (census.targetZones.count() == 0 || census.targetZones.has(zone)) {
         return rootCount->count(mallocSizeOf, referent);
+    }
 
     if (zone && zone->isAtomsZone()) {
         traversal.abandonReferent();
         return rootCount->count(mallocSizeOf, referent);
     }
 
     traversal.abandonReferent();
     return true;
@@ -1105,171 +1171,196 @@ CensusHandler::operator() (BreadthFirst<
 
 
 /*** Parsing Breakdowns ***************************************************************************/
 
 static CountTypePtr
 ParseChildBreakdown(JSContext* cx, HandleObject breakdown, PropertyName* prop)
 {
     RootedValue v(cx);
-    if (!GetProperty(cx, breakdown, breakdown, prop, &v))
+    if (!GetProperty(cx, breakdown, breakdown, prop, &v)) {
         return nullptr;
+    }
     return ParseBreakdown(cx, v);
 }
 
 JS_PUBLIC_API(CountTypePtr)
 ParseBreakdown(JSContext* cx, HandleValue breakdownValue)
 {
     if (breakdownValue.isUndefined()) {
         // Construct the default type, { by: 'count' }
         CountTypePtr simple(cx->new_<SimpleCount>());
         return simple;
     }
 
     RootedObject breakdown(cx, ToObject(cx, breakdownValue));
-    if (!breakdown)
+    if (!breakdown) {
         return nullptr;
+    }
 
     RootedValue byValue(cx);
-    if (!GetProperty(cx, breakdown, breakdown, cx->names().by, &byValue))
+    if (!GetProperty(cx, breakdown, breakdown, cx->names().by, &byValue)) {
         return nullptr;
+    }
     RootedString byString(cx, ToString(cx, byValue));
-    if (!byString)
+    if (!byString) {
         return nullptr;
+    }
     RootedLinearString by(cx, byString->ensureLinear(cx));
-    if (!by)
+    if (!by) {
         return nullptr;
+    }
 
     if (StringEqualsAscii(by, "count")) {
         RootedValue countValue(cx), bytesValue(cx);
         if (!GetProperty(cx, breakdown, breakdown, cx->names().count, &countValue) ||
             !GetProperty(cx, breakdown, breakdown, cx->names().bytes, &bytesValue))
             return nullptr;
 
         // Both 'count' and 'bytes' default to true if omitted, but ToBoolean
         // naturally treats 'undefined' as false; fix this up.
         if (countValue.isUndefined()) countValue.setBoolean(true);
         if (bytesValue.isUndefined()) bytesValue.setBoolean(true);
 
         // Undocumented feature, for testing: { by: 'count' } breakdowns can have
         // a 'label' property whose value is converted to a string and included as
         // a 'label' property on the report object.
         RootedValue label(cx);
-        if (!GetProperty(cx, breakdown, breakdown, cx->names().label, &label))
+        if (!GetProperty(cx, breakdown, breakdown, cx->names().label, &label)) {
             return nullptr;
+        }
 
         UniqueTwoByteChars labelUnique(nullptr);
         if (!label.isUndefined()) {
             RootedString labelString(cx, ToString(cx, label));
-            if (!labelString)
+            if (!labelString) {
                 return nullptr;
+            }
 
             JSFlatString* flat = labelString->ensureFlat(cx);
-            if (!flat)
+            if (!flat) {
                 return nullptr;
+            }
 
             AutoStableStringChars chars(cx);
-            if (!chars.initTwoByte(cx, flat))
+            if (!chars.initTwoByte(cx, flat)) {
                 return nullptr;
+            }
 
             // Since flat strings are null-terminated, and AutoStableStringChars
             // null- terminates if it needs to make a copy, we know that
             // chars.twoByteChars() is null-terminated.
             labelUnique = DuplicateString(cx, chars.twoByteChars());
-            if (!labelUnique)
+            if (!labelUnique) {
                 return nullptr;
+            }
         }
 
         CountTypePtr simple(cx->new_<SimpleCount>(labelUnique,
                                                   ToBoolean(countValue),
                                                   ToBoolean(bytesValue)));
         return simple;
     }
 
-    if (StringEqualsAscii(by, "bucket"))
+    if (StringEqualsAscii(by, "bucket")) {
         return CountTypePtr(cx->new_<BucketCount>());
+    }
 
     if (StringEqualsAscii(by, "objectClass")) {
         CountTypePtr thenType(ParseChildBreakdown(cx, breakdown, cx->names().then));
-        if (!thenType)
+        if (!thenType) {
             return nullptr;
+        }
 
         CountTypePtr otherType(ParseChildBreakdown(cx, breakdown, cx->names().other));
-        if (!otherType)
+        if (!otherType) {
             return nullptr;
+        }
 
         return CountTypePtr(cx->new_<ByObjectClass>(thenType, otherType));
     }
 
     if (StringEqualsAscii(by, "coarseType")) {
         CountTypePtr objectsType(ParseChildBreakdown(cx, breakdown, cx->names().objects));
-        if (!objectsType)
+        if (!objectsType) {
             return nullptr;
+        }
         CountTypePtr scriptsType(ParseChildBreakdown(cx, breakdown, cx->names().scripts));
-        if (!scriptsType)
+        if (!scriptsType) {
             return nullptr;
+        }
         CountTypePtr stringsType(ParseChildBreakdown(cx, breakdown, cx->names().strings));
-        if (!stringsType)
+        if (!stringsType) {
             return nullptr;
+        }
         CountTypePtr otherType(ParseChildBreakdown(cx, breakdown, cx->names().other));
-        if (!otherType)
+        if (!otherType) {
             return nullptr;
+        }
         CountTypePtr domNodeType(ParseChildBreakdown(cx, breakdown, cx->names().domNode));
-        if (!domNodeType)
+        if (!domNodeType) {
             return nullptr;
+        }
 
         return CountTypePtr(cx->new_<ByCoarseType>(objectsType,
                                                    scriptsType,
                                                    stringsType,
                                                    otherType,
                                                    domNodeType));
     }
 
     if (StringEqualsAscii(by, "internalType")) {
         CountTypePtr thenType(ParseChildBreakdown(cx, breakdown, cx->names().then));
-        if (!thenType)
+        if (!thenType) {
             return nullptr;
+        }
 
         return CountTypePtr(cx->new_<ByUbinodeType>(thenType));
     }
 
     if (StringEqualsAscii(by, "descriptiveType")) {
         CountTypePtr thenType(ParseChildBreakdown(cx, breakdown, cx->names().then));
-        if (!thenType)
+        if (!thenType) {
             return nullptr;
+        }
         return CountTypePtr(cx->new_<ByDomObjectClass>(thenType));
     }
 
     if (StringEqualsAscii(by, "allocationStack")) {
         CountTypePtr thenType(ParseChildBreakdown(cx, breakdown, cx->names().then));
-        if (!thenType)
+        if (!thenType) {
             return nullptr;
+        }
         CountTypePtr noStackType(ParseChildBreakdown(cx, breakdown, cx->names().noStack));
-        if (!noStackType)
+        if (!noStackType) {
             return nullptr;
+        }
 
         return CountTypePtr(cx->new_<ByAllocationStack>(thenType, noStackType));
     }
 
     if (StringEqualsAscii(by, "filename")) {
         CountTypePtr thenType(ParseChildBreakdown(cx, breakdown, cx->names().then));
-        if (!thenType)
+        if (!thenType) {
             return nullptr;
+        }
 
         CountTypePtr noFilenameType(ParseChildBreakdown(cx, breakdown, cx->names().noFilename));
-        if (!noFilenameType)
+        if (!noFilenameType) {
             return nullptr;
+        }
 
         return CountTypePtr(cx->new_<ByFilename>(std::move(thenType), std::move(noFilenameType)));
     }
 
     // We didn't recognize the breakdown type; complain.
     UniqueChars byBytes = QuoteString(cx, by, '"');
-    if (!byBytes)
+    if (!byBytes) {
         return nullptr;
+    }
 
     JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_CENSUS_BREAKDOWN,
                               byBytes.get());
     return nullptr;
 }
 
 // Get the default census breakdown:
 //
@@ -1277,62 +1368,72 @@ ParseBreakdown(JSContext* cx, HandleValu
 //   objects: { by: "objectClass" },
 //   other:   { by: "internalType" },
 //   domNode: { by: "descriptiveType" }
 // }
 static CountTypePtr
 GetDefaultBreakdown(JSContext* cx)
 {
     CountTypePtr byDomClass(cx->new_<SimpleCount>());
-    if (!byDomClass)
+    if (!byDomClass) {
         return nullptr;
+    }
     CountTypePtr byClass(cx->new_<SimpleCount>());
-    if (!byClass)
+    if (!byClass) {
         return nullptr;
+    }
 
     CountTypePtr byClassElse(cx->new_<SimpleCount>());
-    if (!byClassElse)
+    if (!byClassElse) {
         return nullptr;
+    }
 
     CountTypePtr objects(cx->new_<ByObjectClass>(byClass, byClassElse));
-    if (!objects)
+    if (!objects) {
         return nullptr;
+    }
 
     CountTypePtr scripts(cx->new_<SimpleCount>());
-    if (!scripts)
+    if (!scripts) {
         return nullptr;
+    }
 
     CountTypePtr strings(cx->new_<SimpleCount>());
-    if (!strings)
+    if (!strings) {
         return nullptr;
+    }
 
     CountTypePtr byType(cx->new_<SimpleCount>());
-    if (!byType)
+    if (!byType) {
         return nullptr;
+    }
 
     CountTypePtr other(cx->new_<ByUbinodeType>(byType));
-    if (!other)
+    if (!other) {
         return nullptr;
+    }
     CountTypePtr domNode(cx->new_<ByDomObjectClass>(byDomClass));
-    if (!domNode)
+    if (!domNode) {
         return nullptr;
+    }
 
     return CountTypePtr(cx->new_<ByCoarseType>(objects,
                                                scripts,
                                                strings,
                                                other,
                                                domNode));
 }
 
 JS_PUBLIC_API(bool)
 ParseCensusOptions(JSContext* cx, Census& census, HandleObject options, CountTypePtr& outResult)
 {
     RootedValue breakdown(cx, UndefinedValue());
-    if (options && !GetProperty(cx, options, options, cx->names().breakdown, &breakdown))
+    if (options && !GetProperty(cx, options, options, cx->names().breakdown, &breakdown)) {
         return false;
+    }
 
     outResult = breakdown.isUndefined()
         ? GetDefaultBreakdown(cx)
         : ParseBreakdown(cx, breakdown);
     return !!outResult;
 }
 
 } // namespace ubi
--- a/js/src/vm/UbiNodeShortestPaths.cpp
+++ b/js/src/vm/UbiNodeShortestPaths.cpp
@@ -14,38 +14,41 @@
 
 namespace JS {
 namespace ubi {
 
 JS_PUBLIC_API(BackEdge::Ptr)
 BackEdge::clone() const
 {
     auto clone = js::MakeUnique<BackEdge>();
-    if (!clone)
+    if (!clone) {
         return nullptr;
+    }
 
     clone->predecessor_ = predecessor();
     if (name()) {
         clone->name_ = js::DuplicateString(name().get());
-        if (!clone->name_)
+        if (!clone->name_) {
             return nullptr;
+        }
     }
     return clone;
 }
 
 #ifdef DEBUG
 
 static void
 dumpNode(const JS::ubi::Node& node)
 {
     fprintf(stderr, "    %p ", (void*) node.identifier());
     js_fputs(node.typeName(), stderr);
     if (node.coarseType() == JS::ubi::CoarseType::Object) {
-        if (const char* clsName = node.jsObjectClassName())
+        if (const char* clsName = node.jsObjectClassName()) {
             fprintf(stderr, " [object %s]", clsName);
+        }
     }
     fputc('\n', stderr);
 }
 
 JS_PUBLIC_API(void)
 dumpPaths(JSContext* cx, Node node, uint32_t maxNumPaths /* = 10 */)
 {
     mozilla::Maybe<AutoCheckCannotGC> nogc;
@@ -65,30 +68,32 @@ dumpPaths(JSContext* cx, Node node, uint
         fprintf(stderr, "Path %d:\n", i++);
         for (auto backEdge : path) {
             dumpNode(backEdge->predecessor());
             fprintf(stderr, "            |\n");
             fprintf(stderr, "            |\n");
             fprintf(stderr, "        '");
 
             const char16_t* name = backEdge->name().get();
-            if (!name)
+            if (!name) {
                 name = u"<no edge name>";
+            }
             js_fputs(name, stderr);
             fprintf(stderr, "'\n");
 
             fprintf(stderr, "            |\n");
             fprintf(stderr, "            V\n");
         }
 
         dumpNode(node);
         fputc('\n', stderr);
         return true;
     });
     MOZ_ASSERT(ok);
 
-    if (i == 0)
+    if (i == 0) {
         fprintf(stderr, "No retaining paths found.\n");
+    }
 }
 #endif
 
 } // namespace ubi
 } // namespace JS
--- a/js/src/vm/UnboxedObject.cpp
+++ b/js/src/vm/UnboxedObject.cpp
@@ -26,21 +26,23 @@ using namespace js;
 
 /////////////////////////////////////////////////////////////////////
 // UnboxedLayout
 /////////////////////////////////////////////////////////////////////
 
 void
 UnboxedLayout::trace(JSTracer* trc)
 {
-    for (size_t i = 0; i < properties_.length(); i++)
+    for (size_t i = 0; i < properties_.length(); i++) {
         TraceManuallyBarrieredEdge(trc, &properties_[i].name, "unboxed_layout_name");
+    }
 
-    if (newScript())
+    if (newScript()) {
         newScript()->trace(trc);
+    }
 
     TraceNullableEdge(trc, &nativeGroup_, "unboxed_layout_nativeGroup");
     TraceNullableEdge(trc, &nativeShape_, "unboxed_layout_nativeShape");
     TraceNullableEdge(trc, &allocationScript_, "unboxed_layout_allocationScript");
     TraceNullableEdge(trc, &replacementGroup_, "unboxed_layout_replacementGroup");
     TraceNullableEdge(trc, &constructorCode_, "unboxed_layout_constructorCode");
 }
 
@@ -51,42 +53,45 @@ UnboxedLayout::sizeOfIncludingThis(mozil
          + properties_.sizeOfExcludingThis(mallocSizeOf)
          + (newScript() ? newScript()->sizeOfIncludingThis(mallocSizeOf) : 0)
          + mallocSizeOf(traceList());
 }
 
 void
 UnboxedLayout::setNewScript(TypeNewScript* newScript, bool writeBarrier /* = true */)
 {
-    if (newScript_ && writeBarrier)
+    if (newScript_ && writeBarrier) {
         TypeNewScript::writeBarrierPre(newScript_);
+    }
     newScript_ = newScript;
 }
 
 // Constructor code returns a 0x1 value to indicate the constructor code should
 // be cleared.
 static const uintptr_t CLEAR_CONSTRUCTOR_CODE_TOKEN = 0x1;
 
 /* static */ bool
 UnboxedLayout::makeConstructorCode(JSContext* cx, HandleObjectGroup group)
 {
     gc::AutoSuppressGC suppress(cx);
 
     using namespace jit;
 
-    if (!cx->realm()->ensureJitRealmExists(cx))
+    if (!cx->realm()->ensureJitRealmExists(cx)) {
         return false;
+    }
 
     AutoSweepObjectGroup sweep(group);
     UnboxedLayout& layout = group->unboxedLayout(sweep);
     MOZ_ASSERT(!layout.constructorCode());
 
     UnboxedPlainObject* templateObject = UnboxedPlainObject::create(cx, group, TenuredObject);
-    if (!templateObject)
+    if (!templateObject) {
         return false;
+    }
 
     JitContext jitContext(cx, nullptr);
 
     StackMacroAssembler masm;
 
     Register propertiesReg, newKindReg;
 #ifdef JS_CODEGEN_X86
     propertiesReg = eax;
@@ -118,18 +123,19 @@ UnboxedLayout::makeConstructorCode(JSCon
     regs.take(propertiesReg);
     regs.take(newKindReg);
     Register object = regs.takeAny(), scratch1 = regs.takeAny(), scratch2 = regs.takeAny();
 
     LiveGeneralRegisterSet savedNonVolatileRegisters = SavedNonVolatileRegisters(regs);
     masm.PushRegsInMask(savedNonVolatileRegisters);
 
     // The scratch double register might be used by MacroAssembler methods.
-    if (ScratchDoubleReg.volatile_())
+    if (ScratchDoubleReg.volatile_()) {
         masm.push(ScratchDoubleReg);
+    }
 
     Label failure, tenuredObject, allocated;
     masm.branch32(Assembler::NotEqual, newKindReg, Imm32(GenericObject), &tenuredObject);
     masm.branchTest32(Assembler::NonZero, AbsoluteAddress(group->addressOfFlags()),
                       Imm32(OBJECT_FLAG_PRE_TENURE), &tenuredObject);
 
     // Allocate an object in the nursery
     TemplateObject templateObj(templateObject);
@@ -143,18 +149,19 @@ UnboxedLayout::makeConstructorCode(JSCon
     masm.createGCObject(object, scratch1, templateObj, gc::TenuredHeap, &failure,
                         /* initFixedSlots = */ false);
 
     // If any of the properties being stored are in the nursery, add a store
     // buffer entry for the new object.
     Label postBarrier;
     for (size_t i = 0; i < layout.properties().length(); i++) {
         const UnboxedLayout::Property& property = layout.properties()[i];
-        if (!UnboxedTypeNeedsPostBarrier(property.type))
+        if (!UnboxedTypeNeedsPostBarrier(property.type)) {
             continue;
+        }
 
         Address valueAddress(propertiesReg, i * sizeof(IdValuePair) + offsetof(IdValuePair, value));
         if (property.type == JSVAL_TYPE_OBJECT) {
             Label notObject;
             masm.branchTestObject(Assembler::NotEqual, valueAddress, &notObject);
             Register valueObject = masm.extractObject(valueAddress, scratch1);
             masm.branchPtrInNurseryChunk(Assembler::Equal, valueObject, scratch2, &postBarrier);
             masm.bind(&notObject);
@@ -168,18 +175,19 @@ UnboxedLayout::makeConstructorCode(JSCon
         }
     }
 
     masm.jump(&allocated);
     masm.bind(&postBarrier);
 
     LiveGeneralRegisterSet liveVolatileRegisters;
     liveVolatileRegisters.add(propertiesReg);
-    if (object.volatile_())
+    if (object.volatile_()) {
         liveVolatileRegisters.add(object);
+    }
     masm.PushRegsInMask(liveVolatileRegisters);
 
     masm.mov(ImmPtr(cx->runtime()), scratch1);
     masm.setupUnalignedABICall(scratch2);
     masm.passABIArg(scratch1);
     masm.passABIArg(object);
     masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, PostWriteBarrier));
 
@@ -233,22 +241,24 @@ UnboxedLayout::makeConstructorCode(JSCon
             masm.storeUnboxedProperty(targetAddress, property.type,
                                       ConstantOrRegister(valueOperand), &failureStoreOther);
         }
     }
 
     Label done;
     masm.bind(&done);
 
-    if (object != ReturnReg)
+    if (object != ReturnReg) {
         masm.movePtr(object, ReturnReg);
+    }
 
     // Restore non-volatile registers which were saved on entry.
-    if (ScratchDoubleReg.volatile_())
+    if (ScratchDoubleReg.volatile_()) {
         masm.pop(ScratchDoubleReg);
+    }
     masm.PopRegsInMask(savedNonVolatileRegisters);
 
 #ifdef JS_CODEGEN_ARM64
     // Now restore the value that was in the PSP register on entry, and return.
 
     // Obtain the correct SP from the PSP.
     masm.Mov(sp, PseudoStackPointer64);
 
@@ -292,56 +302,61 @@ UnboxedLayout::makeConstructorCode(JSCon
     masm.initUnboxedObjectContents(object, templateObject->layoutDontCheckGeneration());
 
     masm.movePtr(ImmWord(CLEAR_CONSTRUCTOR_CODE_TOKEN), object);
     masm.jump(&done);
 
     Linker linker(masm);
     AutoFlushICache afc("UnboxedObject");
     JitCode* code = linker.newCode(cx, CodeKind::Other);
-    if (!code)
+    if (!code) {
         return false;
+    }
 
     layout.setConstructorCode(code);
     return true;
 }
 
 void
 UnboxedLayout::detachFromRealm()
 {
-    if (isInList())
+    if (isInList()) {
         remove();
+    }
 }
 
 static Value
 GetUnboxedValue(uint8_t* p, JSValueType type, bool maybeUninitialized)
 {
     switch (type) {
       case JSVAL_TYPE_BOOLEAN:
         if (maybeUninitialized) {
             // Squelch Valgrind/MSan errors.
             MOZ_MAKE_MEM_DEFINED(p, 1);
         }
         return BooleanValue(*p != 0);
 
       case JSVAL_TYPE_INT32:
-        if (maybeUninitialized)
+        if (maybeUninitialized) {
             MOZ_MAKE_MEM_DEFINED(p, sizeof(int32_t));
+        }
         return Int32Value(*reinterpret_cast<int32_t*>(p));
 
       case JSVAL_TYPE_DOUBLE: {
         // During unboxed plain object creation, non-GC thing properties are
         // left uninitialized. This is normally fine, since the properties will
         // be filled in shortly, but if they are read before that happens we
         // need to make sure that doubles are canonical.
-        if (maybeUninitialized)
+        if (maybeUninitialized) {
             MOZ_MAKE_MEM_DEFINED(p, sizeof(double));
+        }
         double d = *reinterpret_cast<double*>(p);
-        if (maybeUninitialized)
+        if (maybeUninitialized) {
             return DoubleValue(JS::CanonicalizeNaN(d));
+        }
         return DoubleValue(d);
       }
 
       case JSVAL_TYPE_STRING:
         return StringValue(*reinterpret_cast<JSString**>(p));
 
       case JSVAL_TYPE_OBJECT:
         return ObjectOrNullValue(*reinterpret_cast<JSObject**>(p));
@@ -375,42 +390,46 @@ SetUnboxedValue(JSContext* cx, JSObject*
             *reinterpret_cast<double*>(p) = v.toNumber();
             return true;
         }
         return false;
 
       case JSVAL_TYPE_STRING:
         if (v.isString()) {
             JSString** np = reinterpret_cast<JSString**>(p);
-            if (IsInsideNursery(v.toString()) && !IsInsideNursery(unboxedObject))
+            if (IsInsideNursery(v.toString()) && !IsInsideNursery(unboxedObject)) {
                 v.toString()->storeBuffer()->putWholeCell(unboxedObject);
+            }
 
-            if (preBarrier)
+            if (preBarrier) {
                 JSString::writeBarrierPre(*np);
+            }
             *np = v.toString();
             return true;
         }
         return false;
 
       case JSVAL_TYPE_OBJECT:
         if (v.isObjectOrNull()) {
             JSObject** np = reinterpret_cast<JSObject**>(p);
 
             // Update property types when writing object properties. Types for
             // other properties were captured when the unboxed layout was
             // created.
             AddTypePropertyId(cx, unboxedObject, id, v);
 
             // As above, trigger post barriers on the whole object.
             JSObject* obj = v.toObjectOrNull();
-            if (IsInsideNursery(obj) && !IsInsideNursery(unboxedObject))
+            if (IsInsideNursery(obj) && !IsInsideNursery(unboxedObject)) {
                 obj->storeBuffer()->putWholeCell(unboxedObject);
+            }
 
-            if (preBarrier)
+            if (preBarrier) {
                 JSObject::writeBarrierPre(*np);
+            }
             *np = obj;
             return true;
         }
         return false;
 
       default:
         MOZ_CRASH("Invalid type for unboxed value");
     }
@@ -437,23 +456,25 @@ UnboxedPlainObject::getValue(const Unbox
     return GetUnboxedValue(p, property.type, maybeUninitialized);
 }
 
 void
 UnboxedPlainObject::trace(JSTracer* trc, JSObject* obj)
 {
     UnboxedPlainObject* uobj = &obj->as<UnboxedPlainObject>();
 
-    if (uobj->maybeExpando())
+    if (uobj->maybeExpando()) {
         TraceManuallyBarrieredEdge(trc, uobj->addressOfExpando(), "unboxed_expando");
+    }
 
     const UnboxedLayout& layout = uobj->layoutDontCheckGeneration();
     const int32_t* list = layout.traceList();
-    if (!list)
+    if (!list) {
         return;
+    }
 
     uint8_t* data = uobj->data();
     while (*list != -1) {
         GCPtrString* heap = reinterpret_cast<GCPtrString*>(data + *list);
         TraceEdge(trc, heap, "unboxed_string");
         list++;
     }
     list++;
@@ -465,88 +486,96 @@ UnboxedPlainObject::trace(JSTracer* trc,
 
     // Unboxed objects don't have Values to trace.
     MOZ_ASSERT(*(list + 1) == -1);
 }
 
 /* static */ UnboxedExpandoObject*
 UnboxedPlainObject::ensureExpando(JSContext* cx, Handle<UnboxedPlainObject*> obj)
 {
-    if (obj->maybeExpando())
+    if (obj->maybeExpando()) {
         return obj->maybeExpando();
+    }
 
     UnboxedExpandoObject* expando =
         NewObjectWithGivenProto<UnboxedExpandoObject>(cx, nullptr, gc::AllocKind::OBJECT4);
-    if (!expando)
+    if (!expando) {
         return nullptr;
+    }
 
     // Don't track property types for expando objects. This allows Baseline
     // and Ion AddSlot ICs to guard on the unboxed group without guarding on
     // the expando group.
     MarkObjectGroupUnknownProperties(cx, expando->group());
 
     // If the expando is tenured then the original object must also be tenured.
     // Otherwise barriers triggered on the original object for writes to the
     // expando (as can happen in the JIT) won't see the tenured->nursery edge.
     // See WholeCellEdges::mark.
     MOZ_ASSERT_IF(!IsInsideNursery(expando), !IsInsideNursery(obj));
 
     // As with setValue(), we need to manually trigger post barriers on the
     // whole object. If we treat the field as a GCPtrObject and later
     // convert the object to its native representation, we will end up with a
     // corrupted store buffer entry.
-    if (IsInsideNursery(expando) && !IsInsideNursery(obj))
+    if (IsInsideNursery(expando) && !IsInsideNursery(obj)) {
         expando->storeBuffer()->putWholeCell(obj);
+    }
 
     obj->setExpandoUnsafe(expando);
     return expando;
 }
 
 bool
 UnboxedPlainObject::containsUnboxedOrExpandoProperty(JSContext* cx, jsid id) const
 {
-    if (layoutDontCheckGeneration().lookup(id))
+    if (layoutDontCheckGeneration().lookup(id)) {
         return true;
+    }
 
-    if (maybeExpando() && maybeExpando()->containsShapeOrElement(cx, id))
+    if (maybeExpando() && maybeExpando()->containsShapeOrElement(cx, id)) {
         return true;
+    }
 
     return false;
 }
 
 static bool
 PropagatePropertyTypes(JSContext* cx, jsid id, ObjectGroup* oldGroup, ObjectGroup* newGroup)
 {
     AutoSweepObjectGroup sweepOld(oldGroup);
     HeapTypeSet* typeProperty = oldGroup->maybeGetProperty(sweepOld, id);
     TypeSet::TypeList types;
     if (!typeProperty->enumerateTypes(&types)) {
         ReportOutOfMemory(cx);
         return false;
     }
-    for (size_t j = 0; j < types.length(); j++)
+    for (size_t j = 0; j < types.length(); j++) {
         AddTypePropertyId(cx, newGroup, nullptr, id, types[j]);
+    }
     return true;
 }
 
 static PlainObject*
 MakeReplacementTemplateObject(JSContext* cx, HandleObjectGroup group, const UnboxedLayout &layout)
 {
     Rooted<PlainObject*> obj(cx, NewObjectWithGroup<PlainObject>(cx, group, layout.getAllocKind(),
                                                                  TenuredObject));
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     RootedId id(cx);
     for (size_t i = 0; i < layout.properties().length(); i++) {
         const UnboxedLayout::Property& property = layout.properties()[i];
         id = NameToId(property.name);
         Shape* shape = NativeObject::addDataProperty(cx, obj, id, SHAPE_INVALID_SLOT, JSPROP_ENUMERATE);
-        if (!shape)
+        if (!shape) {
             return nullptr;
+        }
         MOZ_ASSERT(shape->slot() == i);
         MOZ_ASSERT(obj->slotSpan() == i + 1);
         MOZ_ASSERT(!obj->inDictionaryMode());
     }
 
     return obj;
 }
 
@@ -569,103 +598,115 @@ UnboxedLayout::makeNativeGroup(JSContext
     // the existing new script with one for a replacement default new group.
     // This is done so that the size of the replacment group's objects is the
     // same as that for the unboxed group, so that we do not see polymorphic
     // slot accesses later on for sites that see converted objects from this
     // group and objects that were allocated using the replacement new group.
     if (layout.newScript()) {
         replacementGroup = ObjectGroupRealm::makeGroup(cx, group->realm(), &PlainObject::class_,
                                                        proto);
-        if (!replacementGroup)
+        if (!replacementGroup) {
             return false;
+        }
 
         PlainObject* templateObject = MakeReplacementTemplateObject(cx, replacementGroup, layout);
-        if (!templateObject)
+        if (!templateObject) {
             return false;
+        }
 
         TypeNewScript* replacementNewScript =
             TypeNewScript::makeNativeVersion(cx, layout.newScript(), templateObject);
-        if (!replacementNewScript)
+        if (!replacementNewScript) {
             return false;
+        }
 
         replacementGroup->setNewScript(replacementNewScript);
         gc::gcTracer.traceTypeNewScript(replacementGroup);
 
         group->clearNewScript(cx, replacementGroup);
     }
 
     // Similarly, if this group is keyed to an allocation site, replace its
     // entry with a new group that has no unboxed layout.
     if (layout.allocationScript()) {
         RootedScript script(cx, layout.allocationScript());
         jsbytecode* pc = layout.allocationPc();
 
         replacementGroup = ObjectGroupRealm::makeGroup(cx, group->realm(), &PlainObject::class_,
                                                        proto);
-        if (!replacementGroup)
+        if (!replacementGroup) {
             return false;
+        }
 
         PlainObject* templateObject = &script->getObject(pc)->as<PlainObject>();
         replacementGroup->addDefiniteProperties(cx, templateObject->lastProperty());
 
         ObjectGroupRealm& realm = ObjectGroupRealm::get(group);
         realm.replaceAllocationSiteGroup(script, pc, JSProto_Object, replacementGroup);
 
         // Clear any baseline information at this opcode which might use the old group.
         if (script->hasBaselineScript()) {
             jit::ICEntry& entry = script->baselineScript()->icEntryFromPCOffset(script->pcToOffset(pc));
             jit::ICFallbackStub* fallback = entry.fallbackStub();
-            for (jit::ICStubIterator iter = fallback->beginChain(); !iter.atEnd(); iter++)
+            for (jit::ICStubIterator iter = fallback->beginChain(); !iter.atEnd(); iter++) {
                 iter.unlink(cx);
-            if (fallback->isNewObject_Fallback())
+            }
+            if (fallback->isNewObject_Fallback()) {
                 fallback->toNewObject_Fallback()->setTemplateObject(nullptr);
-            else if (fallback->isNewArray_Fallback())
+            } else if (fallback->isNewArray_Fallback()) {
                 fallback->toNewArray_Fallback()->setTemplateGroup(replacementGroup);
+            }
         }
     }
 
     size_t nfixed = gc::GetGCKindSlots(layout.getAllocKind());
 
     RootedShape shape(cx, EmptyShape::getInitialShape(cx, &PlainObject::class_, proto, nfixed, 0));
-    if (!shape)
+    if (!shape) {
         return false;
+    }
 
     // Add shapes for each property, if this is for a plain object.
     for (size_t i = 0; i < layout.properties().length(); i++) {
         const UnboxedLayout::Property& property = layout.properties()[i];
 
         Rooted<StackShape> child(cx, StackShape(shape->base()->unowned(), NameToId(property.name),
                                                 i, JSPROP_ENUMERATE));
         shape = cx->zone()->propertyTree().getChild(cx, shape, child);
-        if (!shape)
+        if (!shape) {
             return false;
+        }
     }
 
     ObjectGroup* nativeGroup =
         ObjectGroupRealm::makeGroup(cx, group->realm(), &PlainObject::class_, proto,
                                     group->flags(sweep) & OBJECT_FLAG_DYNAMIC_MASK);
-    if (!nativeGroup)
+    if (!nativeGroup) {
         return false;
+    }
 
     // No sense propagating if we don't know what we started with.
     AutoSweepObjectGroup sweepNative(nativeGroup);
     if (!group->unknownProperties(sweep)) {
         for (size_t i = 0; i < layout.properties().length(); i++) {
             const UnboxedLayout::Property& property = layout.properties()[i];
             jsid id = NameToId(property.name);
-            if (!PropagatePropertyTypes(cx, id, group, nativeGroup))
+            if (!PropagatePropertyTypes(cx, id, group, nativeGroup)) {
                 return false;
+            }
 
             // If we are OOM we may not be able to propagate properties.
-            if (nativeGroup->unknownProperties(sweepNative))
+            if (nativeGroup->unknownProperties(sweepNative)) {
                 break;
+            }
 
             HeapTypeSet* nativeProperty = nativeGroup->maybeGetProperty(sweepNative, id);
-            if (nativeProperty && nativeProperty->canSetDefinite(i))
+            if (nativeProperty && nativeProperty->canSetDefinite(i)) {
                 nativeProperty->setDefinite(i);
+            }
         }
     } else {
         // If we skip, though, the new group had better agree.
         MOZ_ASSERT(nativeGroup->unknownProperties(sweepNative));
     }
 
     layout.nativeGroup_ = nativeGroup;
     layout.nativeShape_ = shape;
@@ -685,83 +726,93 @@ UnboxedPlainObject::convertToNative(JSCo
     // Ion's LConvertUnboxedObjectToNative works correctly. If we return bool
     // and use defineReuseInput, the object register is not preserved across the
     // call.
 
     const UnboxedLayout& layout = obj->as<UnboxedPlainObject>().layout();
     UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando();
 
     if (!layout.nativeGroup()) {
-        if (!UnboxedLayout::makeNativeGroup(cx, obj->group()))
+        if (!UnboxedLayout::makeNativeGroup(cx, obj->group())) {
             return nullptr;
+        }
 
         // makeNativeGroup can reentrantly invoke this method.
-        if (obj->is<PlainObject>())
+        if (obj->is<PlainObject>()) {
             return &obj->as<PlainObject>();
+        }
     }
 
     AutoValueVector values(cx);
     for (size_t i = 0; i < layout.properties().length(); i++) {
         // We might be reading properties off the object which have not been
         // initialized yet. Make sure any double values we read here are
         // canonicalized.
-        if (!values.append(obj->as<UnboxedPlainObject>().getValue(layout.properties()[i], true)))
+        if (!values.append(obj->as<UnboxedPlainObject>().getValue(layout.properties()[i], true))) {
             return nullptr;
+        }
     }
 
     // We are eliminating the expando edge with the conversion, so trigger a
     // pre barrier.
     JSObject::writeBarrierPre(expando);
 
     // Additionally trigger a post barrier on the expando itself. Whole cell
     // store buffer entries can be added on the original unboxed object for
     // writes to the expando (see WholeCellEdges::trace), so after conversion
     // we need to make sure the expando itself will still be traced.
-    if (expando && !IsInsideNursery(expando))
+    if (expando && !IsInsideNursery(expando)) {
         cx->runtime()->gc.storeBuffer().putWholeCell(expando);
+    }
 
     obj->setGroup(layout.nativeGroup());
     obj->as<PlainObject>().setLastPropertyMakeNative(cx, layout.nativeShape());
 
-    for (size_t i = 0; i < values.length(); i++)
+    for (size_t i = 0; i < values.length(); i++) {
         obj->as<PlainObject>().initSlotUnchecked(i, values[i]);
+    }
 
-    if (!expando)
+    if (!expando) {
         return &obj->as<PlainObject>();
+    }
 
     // Add properties from the expando object to the object, in order.
     // Suppress GC here, so that callers don't need to worry about this
     // method collecting. The stuff below can only fail due to OOM, in
     // which case the object will not have been completely filled back in.
     gc::AutoSuppressGC suppress(cx);
 
     Vector<jsid> ids(cx);
     for (Shape::Range<NoGC> r(expando->lastProperty()); !r.empty(); r.popFront()) {
-        if (!ids.append(r.front().propid()))
+        if (!ids.append(r.front().propid())) {
             return nullptr;
+        }
     }
     for (size_t i = 0; i < expando->getDenseInitializedLength(); i++) {
         if (!expando->getDenseElement(i).isMagic(JS_ELEMENTS_HOLE)) {
-            if (!ids.append(INT_TO_JSID(i)))
+            if (!ids.append(INT_TO_JSID(i))) {
                 return nullptr;
+            }
         }
     }
     ::Reverse(ids.begin(), ids.end());
 
     RootedPlainObject nobj(cx, &obj->as<PlainObject>());
     Rooted<UnboxedExpandoObject*> nexpando(cx, expando);
     RootedId id(cx);
     Rooted<PropertyDescriptor> desc(cx);
     for (size_t i = 0; i < ids.length(); i++) {
         id = ids[i];
-        if (!GetOwnPropertyDescriptor(cx, nexpando, id, &desc))
+        if (!GetOwnPropertyDescriptor(cx, nexpando, id, &desc)) {
             return nullptr;
+        }
         ObjectOpResult result;
-        if (!DefineProperty(cx, nobj, id, desc, result))
+        if (!DefineProperty(cx, nobj, id, desc, result)) {
             return nullptr;
+        }
         MOZ_ASSERT(result.ok());
     }
 
     return nobj;
 }
 
 /* static */ JS::Result<UnboxedObject*, JS::OOM&>
 UnboxedObject::createInternal(JSContext* cx, js::gc::AllocKind kind, js::gc::InitialHeap heap,
@@ -771,18 +822,19 @@ UnboxedObject::createInternal(JSContext*
     MOZ_ASSERT(clasp == &UnboxedPlainObject::class_);
 
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, clasp));
     kind = GetBackgroundAllocKind(kind);
 
     debugCheckNewObject(group, /* shape = */ nullptr, kind, heap);
 
     JSObject* obj = js::Allocate<JSObject>(cx, kind, /* nDynamicSlots = */ 0, heap, clasp);
-    if (!obj)
+    if (!obj) {
         return cx->alreadyReportedOOM();
+    }
 
     UnboxedObject* uobj = static_cast<UnboxedObject*>(obj);
     uobj->initGroup(group);
 
     MOZ_ASSERT(clasp->shouldDelayMetadataBuilder());
     cx->realm()->setObjectPendingMetadata(cx, uobj);
 
     js::gc::gcTracer.traceCreateObject(uobj);
@@ -853,27 +905,30 @@ UnboxedPlainObject::createWithProperties
             ConstructorCodeSignature function =
                 reinterpret_cast<ConstructorCodeSignature>(layout.constructorCode()->raw());
 
             JSObject* obj;
             {
                 JS::AutoSuppressGCAnalysis nogc;
                 obj = reinterpret_cast<JSObject*>(CALL_GENERATED_2(function, properties, newKind));
             }
-            if (obj > reinterpret_cast<JSObject*>(CLEAR_CONSTRUCTOR_CODE_TOKEN))
+            if (obj > reinterpret_cast<JSObject*>(CLEAR_CONSTRUCTOR_CODE_TOKEN)) {
                 return obj;
+            }
 
-            if (obj == reinterpret_cast<JSObject*>(CLEAR_CONSTRUCTOR_CODE_TOKEN))
+            if (obj == reinterpret_cast<JSObject*>(CLEAR_CONSTRUCTOR_CODE_TOKEN)) {
                 layout.setConstructorCode(nullptr);
+            }
         }
     }
 
     UnboxedPlainObject* obj = UnboxedPlainObject::create(cx, group, newKind);
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     // AutoSweepObjectGroup can't be live across a GC call, so we reset() it
     // before calling NewPlainObjectWithProperties.
     mozilla::Maybe<AutoSweepObjectGroup> sweep;
     sweep.emplace(group);
     UnboxedLayout& layout = group->unboxedLayout(*sweep);
 
     for (size_t i = 0; i < layout.properties().length(); i++) {
@@ -885,18 +940,19 @@ UnboxedPlainObject::createWithProperties
 
 #ifndef JS_CODEGEN_NONE
     if (!cx->helperThread() &&
         !group->unknownProperties(*sweep) &&
         !layout.constructorCode() &&
         cx->runtime()->jitSupportsFloatingPoint &&
         jit::CanLikelyAllocateMoreExecutableMemory())
     {
-        if (!UnboxedLayout::makeConstructorCode(cx, group))
+        if (!UnboxedLayout::makeConstructorCode(cx, group)) {
             return nullptr;
+        }
     }
 #endif
 
     return obj;
 }
 
 /* static */ bool
 UnboxedPlainObject::obj_lookupProperty(JSContext* cx, HandleObject obj,
@@ -924,32 +980,35 @@ UnboxedPlainObject::obj_defineProperty(J
                                        Handle<PropertyDescriptor> desc,
                                        ObjectOpResult& result)
 {
     const UnboxedLayout& layout = obj->as<UnboxedPlainObject>().layout();
 
     if (const UnboxedLayout::Property* property = layout.lookup(id)) {
         if (!desc.getter() && !desc.setter() && desc.attributes() == JSPROP_ENUMERATE) {
             // This define is equivalent to setting an existing property.
-            if (obj->as<UnboxedPlainObject>().setValue(cx, *property, desc.value()))
+            if (obj->as<UnboxedPlainObject>().setValue(cx, *property, desc.value())) {
                 return result.succeed();
+            }
         }
 
         // Trying to incompatibly redefine an existing property requires the
         // object to be converted to a native object.
-        if (!convertToNative(cx, obj))
+        if (!convertToNative(cx, obj)) {
             return false;
+        }
 
         return DefineProperty(cx, obj, id, desc, result);
     }
 
     // Define the property on the expando object.
     Rooted<UnboxedExpandoObject*> expando(cx, ensureExpando(cx, obj.as<UnboxedPlainObject>()));
-    if (!expando)
+    if (!expando) {
         return false;
+    }
 
     // Update property types on the unboxed object as well.
     AddTypePropertyId(cx, obj, id, desc.value());
 
     return DefineProperty(cx, expando, id, desc, result);
 }
 
 /* static */ bool
@@ -999,21 +1058,23 @@ UnboxedPlainObject::obj_getProperty(JSCo
 /* static */ bool
 UnboxedPlainObject::obj_setProperty(JSContext* cx, HandleObject obj, HandleId id, HandleValue v,
                                     HandleValue receiver, ObjectOpResult& result)
 {
     const UnboxedLayout& layout = obj->as<UnboxedPlainObject>().layout();
 
     if (const UnboxedLayout::Property* property = layout.lookup(id)) {
         if (receiver.isObject() && obj == &receiver.toObject()) {
-            if (obj->as<UnboxedPlainObject>().setValue(cx, *property, v))
+            if (obj->as<UnboxedPlainObject>().setValue(cx, *property, v)) {
                 return result.succeed();
+            }
 
-            if (!convertToNative(cx, obj))
+            if (!convertToNative(cx, obj)) {
                 return false;
+            }
             return SetProperty(cx, obj, id, v, receiver, result);
         }
 
         return SetPropertyByDefining(cx, id, v, receiver, result);
     }
 
     if (UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando()) {
         if (expando->containsShapeOrElement(cx, id)) {
@@ -1039,48 +1100,52 @@ UnboxedPlainObject::obj_getOwnPropertyDe
         desc.setAttributes(JSPROP_ENUMERATE);
         desc.object().set(obj);
         return true;
     }
 
     if (UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando()) {
         if (expando->containsShapeOrElement(cx, id)) {
             RootedObject nexpando(cx, expando);
-            if (!GetOwnPropertyDescriptor(cx, nexpando, id, desc))
+            if (!GetOwnPropertyDescriptor(cx, nexpando, id, desc)) {
                 return false;
-            if (desc.object() == nexpando)
+            }
+            if (desc.object() == nexpando) {
                 desc.object().set(obj);
+            }
             return true;
         }
     }
 
     desc.object().set(nullptr);
     return true;
 }
 
 /* static */ bool
 UnboxedPlainObject::obj_deleteProperty(JSContext* cx, HandleObject obj, HandleId id,
                                        ObjectOpResult& result)
 {
-    if (!convertToNative(cx, obj))
+    if (!convertToNative(cx, obj)) {
         return false;
+    }
     return DeleteProperty(cx, obj, id, result);
 }
 
 /* static */ bool
 UnboxedPlainObject::newEnumerate(JSContext* cx, HandleObject obj, AutoIdVector& properties,
                                  bool enumerableOnly)
 {
     // Ignore expando properties here, they are special-cased by the property
     // enumeration code.
 
     const UnboxedLayout::PropertyVector& unboxed = obj->as<UnboxedPlainObject>().layout().properties();
     for (size_t i = 0; i < unboxed.length(); i++) {
-        if (!properties.append(NameToId(unboxed[i].name)))
+        if (!properties.append(NameToId(unboxed[i].name))) {
             return false;
+        }
     }
 
     return true;
 }
 
 const Class UnboxedExpandoObject::class_ = {
     "UnboxedExpandoObject",
     0
@@ -1126,34 +1191,37 @@ const Class UnboxedPlainObject::class_ =
 
 /////////////////////////////////////////////////////////////////////
 // API
 /////////////////////////////////////////////////////////////////////
 
 static bool
 UnboxedTypeIncludes(JSValueType supertype, JSValueType subtype)
 {
-    if (supertype == JSVAL_TYPE_DOUBLE && subtype == JSVAL_TYPE_INT32)
+    if (supertype == JSVAL_TYPE_DOUBLE && subtype == JSVAL_TYPE_INT32) {
         return true;
-    if (supertype == JSVAL_TYPE_OBJECT && subtype == JSVAL_TYPE_NULL)
+    }
+    if (supertype == JSVAL_TYPE_OBJECT && subtype == JSVAL_TYPE_NULL) {
         return true;
+    }
     return false;
 }
 
 static bool
 CombineUnboxedTypes(const Value& value, JSValueType* existing)
 {
     JSValueType type = value.isDouble() ? JSVAL_TYPE_DOUBLE : value.extractNonDoubleType();
 
     if (*existing == JSVAL_TYPE_MAGIC || *existing == type || UnboxedTypeIncludes(type, *existing)) {
         *existing = type;
         return true;
     }
-    if (UnboxedTypeIncludes(*existing, type))
+    if (UnboxedTypeIncludes(*existing, type)) {
         return true;
+    }
     return false;
 }
 
 // Return whether the property names and types in layout are a subset of the
 // specified vector.
 static bool
 PropertiesAreSuperset(const UnboxedLayout::PropertyVector& properties, UnboxedLayout* layout)
 {
@@ -1161,18 +1229,19 @@ PropertiesAreSuperset(const UnboxedLayou
         const UnboxedLayout::Property& layoutProperty = layout->properties()[i];
         bool found = false;
         for (size_t j = 0; j < properties.length(); j++) {
             if (layoutProperty.name == properties[j].name) {
                 found = (layoutProperty.type == properties[j].type);
                 break;
             }
         }
-        if (!found)
+        if (!found) {
             return false;
+        }
     }
     return true;
 }
 
 static bool
 CombinePlainObjectProperties(PlainObject* obj, Shape* templateShape,
                              UnboxedLayout::PropertyVector& properties)
 {
@@ -1190,18 +1259,19 @@ CombinePlainObjectProperties(PlainObject
         // the template shape exactly.
         return false;
     }
 
     for (size_t i = 0; i < templateShape->slotSpan(); i++) {
         Value val = obj->getSlot(i);
 
         JSValueType& existing = properties[i].type;
-        if (!CombineUnboxedTypes(val, &existing))
+        if (!CombineUnboxedTypes(val, &existing)) {
             return false;
+        }
     }
 
     return true;
 }
 
 static size_t
 ComputePlainObjectLayout(JSContext* cx, ObjectGroupRealm& realm, Shape* templateShape,
                          UnboxedLayout::PropertyVector& properties)
@@ -1246,18 +1316,19 @@ ComputePlainObjectLayout(JSContext* cx, 
 
     // Order remaining properties from the largest down for the best space
     // utilization.
     static const size_t typeSizes[] = { 8, 4, 1 };
 
     for (size_t i = 0; i < ArrayLength(typeSizes); i++) {
         size_t size = typeSizes[i];
         for (size_t j = 0; j < templateShape->slotSpan(); j++) {
-            if (properties[j].offset != UINT32_MAX)
+            if (properties[j].offset != UINT32_MAX) {
                 continue;
+            }
             JSValueType type = properties[j].type;
             if (UnboxedTypeSize(type) == size) {
                 offset = JS_ROUNDUP(offset, size);
                 properties[j].offset = offset;
                 offset += size;
             }
         }
     }
@@ -1270,38 +1341,41 @@ static bool
 SetLayoutTraceList(JSContext* cx, UnboxedLayout* layout)
 {
     // Figure out the offsets of any objects or string properties.
     Vector<int32_t, 8, SystemAllocPolicy> objectOffsets, stringOffsets;
     for (size_t i = 0; i < layout->properties().length(); i++) {
         const UnboxedLayout::Property& property = layout->properties()[i];
         MOZ_ASSERT(property.offset != UINT32_MAX);
         if (property.type == JSVAL_TYPE_OBJECT) {
-            if (!objectOffsets.append(property.offset))
+            if (!objectOffsets.append(property.offset)) {
                 return false;
+            }
         } else if (property.type == JSVAL_TYPE_STRING) {
-            if (!stringOffsets.append(property.offset))
+            if (!stringOffsets.append(property.offset)) {
                 return false;
+            }
         }
     }
 
     // Construct the layout's trace list.
     if (!objectOffsets.empty() || !stringOffsets.empty()) {
         Vector<int32_t, 8, SystemAllocPolicy> entries;
         if (!entries.appendAll(stringOffsets) ||
             !entries.append(-1) ||
             !entries.appendAll(objectOffsets) ||
             !entries.append(-1) ||
             !entries.append(-1))
         {
             return false;
         }
         int32_t* traceList = cx->zone()->pod_malloc<int32_t>(entries.length());
-        if (!traceList)
+        if (!traceList) {
             return false;
+        }
         PodCopy(traceList, entries.begin(), entries.length());
         layout->setTraceList(traceList);
     }
 
     return true;
 }
 
 static inline Value
@@ -1309,117 +1383,132 @@ NextValue(Handle<GCVector<Value>> values
 {
     return values[(*valueCursor)++];
 }
 
 static bool
 GetValuesFromPreliminaryPlainObject(PlainObject* obj, MutableHandle<GCVector<Value>> values)
 {
     for (size_t i = 0; i < obj->slotSpan(); i++) {
-        if (!values.append(obj->getSlot(i)))
+        if (!values.append(obj->getSlot(i))) {
             return false;
+        }
     }
     return true;
 }
 
 void
 UnboxedPlainObject::fillAfterConvert(JSContext* cx,
                                      Handle<GCVector<Value>> values, size_t* valueCursor)
 {
     initExpando();
     memset(data(), 0, layout().size());
-    for (size_t i = 0; i < layout().properties().length(); i++)
+    for (size_t i = 0; i < layout().properties().length(); i++) {
         MOZ_ALWAYS_TRUE(setValue(cx, layout().properties()[i], NextValue(values, valueCursor)));
+    }
 }
 
 bool
 js::TryConvertToUnboxedLayout(JSContext* cx, AutoEnterAnalysis& enter, Shape* templateShape,
                               ObjectGroup* group, PreliminaryObjectArray* objects)
 {
     MOZ_ASSERT(templateShape);
 
-    if (jit::JitOptions.disableUnboxedObjects)
+    if (jit::JitOptions.disableUnboxedObjects) {
         return true;
+    }
 
     AutoSweepObjectGroup sweep(group);
 
     MOZ_ASSERT(!templateShape->getObjectFlags());
 
-    if (group->runtimeFromAnyThread()->isSelfHostingGlobal(cx->global()))
+    if (group->runtimeFromAnyThread()->isSelfHostingGlobal(cx->global())) {
         return true;
+    }
 
-    if (templateShape->slotSpan() == 0)
+    if (templateShape->slotSpan() == 0) {
         return true;
+    }
 
     UnboxedLayout::PropertyVector properties;
-    if (!properties.appendN(UnboxedLayout::Property(), templateShape->slotSpan()))
+    if (!properties.appendN(UnboxedLayout::Property(), templateShape->slotSpan())) {
         return false;
+    }
 
     size_t objectCount = 0;
     for (size_t i = 0; i < PreliminaryObjectArray::COUNT; i++) {
         JSObject* obj = objects->get(i);
-        if (!obj)
+        if (!obj) {
             continue;
+        }
 
-        if (obj->isSingleton() || obj->group() != group)
+        if (obj->isSingleton() || obj->group() != group) {
             return true;
+        }
 
         objectCount++;
 
-        if (!CombinePlainObjectProperties(&obj->as<PlainObject>(), templateShape, properties))
+        if (!CombinePlainObjectProperties(&obj->as<PlainObject>(), templateShape, properties)) {
             return true;
+        }
     }
 
     size_t layoutSize = 0;
     if (objectCount <= 1) {
         // If only one of the objects has been created, it is more likely
         // to have new properties added later. This heuristic is not used
         // for array objects, where we might want an unboxed representation
         // even if there is only one large array.
         return true;
     }
 
     for (size_t i = 0; i < templateShape->slotSpan(); i++) {
         // We can't use an unboxed representation if e.g. all the objects have
         // a null value for one of the properties, as we can't decide what type
         // it is supposed to have.
-        if (UnboxedTypeSize(properties[i].type) == 0)
+        if (UnboxedTypeSize(properties[i].type) == 0) {
             return true;
+        }
     }
 
     // Make sure that all properties on the template shape are property
     // names, and not indexes.
     for (Shape::Range<NoGC> r(templateShape); !r.empty(); r.popFront()) {
         jsid id = r.front().propid();
         uint32_t dummy;
-        if (!JSID_IS_ATOM(id) || JSID_TO_ATOM(id)->isIndex(&dummy))
+        if (!JSID_IS_ATOM(id) || JSID_TO_ATOM(id)->isIndex(&dummy)) {
             return true;
+        }
     }
 
     ObjectGroupRealm& realm = ObjectGroupRealm::get(group);
     layoutSize = ComputePlainObjectLayout(cx, realm, templateShape, properties);
 
     // The entire object must be allocatable inline.
-    if (UnboxedPlainObject::offsetOfData() + layoutSize > JSObject::MAX_BYTE_SIZE)
+    if (UnboxedPlainObject::offsetOfData() + layoutSize > JSObject::MAX_BYTE_SIZE) {
         return true;
+    }
 
     UniquePtr<UnboxedLayout>& layout = enter.unboxedLayoutToCleanUp;
     MOZ_ASSERT(!layout);
     layout = group->zone()->make_unique<UnboxedLayout>(group->zone());
-    if (!layout)
+    if (!layout) {
         return false;
+    }
 
-    if (!layout->initProperties(properties, layoutSize))
+    if (!layout->initProperties(properties, layoutSize)) {
         return false;
+    }
 
     // The unboxedLayouts list only tracks layouts for plain objects.
     realm.unboxedLayouts.insertFront(layout.get());
 
-    if (!SetLayoutTraceList(cx, layout.get()))
+    if (!SetLayoutTraceList(cx, layout.get())) {
         return false;
+    }
 
     // We've determined that all the preliminary objects can use the new layout
     // just constructed, so convert the existing group to use the unboxed class,
     // and update the preliminary objects to use the new layout. Do the
     // fallible stuff first before modifying any objects.
 
     // Get an empty shape which we can use for the preliminary objects.
     Shape* newShape =
@@ -1429,40 +1518,44 @@ js::TryConvertToUnboxedLayout(JSContext*
         return false;
     }
 
     // Accumulate a list of all the values in each preliminary object, and
     // update their shapes.
     Rooted<GCVector<Value>> values(cx, GCVector<Value>(cx));
     for (size_t i = 0; i < PreliminaryObjectArray::COUNT; i++) {
         JSObject* obj = objects->get(i);
-        if (!obj)
+        if (!obj) {
             continue;
+        }
 
         if (!GetValuesFromPreliminaryPlainObject(&obj->as<PlainObject>(), &values)) {
             cx->recoverFromOutOfMemory();
             return false;
         }
     }
 
-    if (TypeNewScript* newScript = group->newScript(sweep))
+    if (TypeNewScript* newScript = group->newScript(sweep)) {
         layout->setNewScript(newScript);
+    }
 
     for (size_t i = 0; i < PreliminaryObjectArray::COUNT; i++) {
-        if (JSObject* obj = objects->get(i))
+        if (JSObject* obj = objects->get(i)) {
             obj->as<NativeObject>().setLastPropertyMakeNonNative(newShape);
+        }
     }
 
     group->setClasp(&UnboxedPlainObject::class_);
     group->setUnboxedLayout(layout.release());
 
     size_t valueCursor = 0;
     for (size_t i = 0; i < PreliminaryObjectArray::COUNT; i++) {
         JSObject* obj = objects->get(i);
-        if (!obj)
+        if (!obj) {
             continue;
+        }
 
         obj->as<UnboxedPlainObject>().fillAfterConvert(cx, values, &valueCursor);
     }
 
     MOZ_ASSERT(valueCursor == values.length());
     return true;
 }
--- a/js/src/vm/UnboxedObject.h
+++ b/js/src/vm/UnboxedObject.h
@@ -107,18 +107,19 @@ class UnboxedLayout : public mozilla::Li
     JS::Zone* zone() const { return zone_; }
 
     bool initProperties(const PropertyVector& properties, size_t size) {
         size_ = size;
         return properties_.appendAll(properties);
     }
 
     ~UnboxedLayout() {
-        if (newScript_)
+        if (newScript_) {
             newScript_->clear();
+        }
         js_delete(newScript_);
         js_free(traceList_);
 
         nativeGroup_.init(nullptr);
         nativeShape_.init(nullptr);
         replacementGroup_.init(nullptr);
         constructorCode_.init(nullptr);
     }
@@ -153,25 +154,27 @@ class UnboxedLayout : public mozilla::Li
     }
 
     void setTraceList(int32_t* traceList) {
         traceList_ = traceList;
     }
 
     const Property* lookup(JSAtom* atom) const {
         for (size_t i = 0; i < properties_.length(); i++) {
-            if (properties_[i].name == atom)
+            if (properties_[i].name == atom) {
                 return &properties_[i];
+            }
         }
         return nullptr;
     }
 
     const Property* lookup(jsid id) const {
-        if (JSID_IS_STRING(id))
+        if (JSID_IS_STRING(id)) {
             return lookup(JSID_TO_ATOM(id));
+        }
         return nullptr;
     }
 
     size_t size() const {
         return size_;
     }
 
     ObjectGroup* nativeGroup() const {
--- a/js/src/vm/Xdr.cpp
+++ b/js/src/vm/Xdr.cpp
@@ -31,56 +31,62 @@ XDRState<mode>::lifoAlloc() const {
 }
 
 #ifdef DEBUG
 bool
 XDRCoderBase::validateResultCode(JSContext* cx, JS::TranscodeResult code) const
 {
     // NOTE: This function is called to verify that we do not have a pending
     // exception on the JSContext at the same time as a TranscodeResult failure.
-    if (cx->helperThread())
+    if (cx->helperThread()) {
         return true;
+    }
     return cx->isExceptionPending() == bool(code == JS::TranscodeResult_Throw);
 }
 #endif
 
 template<XDRMode mode>
 XDRResult
 XDRState<mode>::codeChars(const Latin1Char* chars, size_t nchars)
 {
     static_assert(sizeof(Latin1Char) == sizeof(uint8_t), "Latin1Char must fit in 1 byte");
 
     MOZ_ASSERT(mode == XDR_ENCODE);
 
-    if (nchars == 0)
+    if (nchars == 0) {
         return Ok();
+    }
     uint8_t* ptr = buf.write(nchars);
-    if (!ptr)
+    if (!ptr) {
         return fail(JS::TranscodeResult_Throw);
+    }
 
     mozilla::PodCopy(ptr, chars, nchars);
     return Ok();
 }
 
 template<XDRMode mode>
 XDRResult
 XDRState<mode>::codeChars(char16_t* chars, size_t nchars)
 {
-    if (nchars == 0)
+    if (nchars == 0) {
         return Ok();
+    }
     size_t nbytes = nchars * sizeof(char16_t);
     if (mode == XDR_ENCODE) {
         uint8_t* ptr = buf.write(nbytes);
-        if (!ptr)
+        if (!ptr) {
             return fail(JS::TranscodeResult_Throw);
+        }
         mozilla::NativeEndian::copyAndSwapToLittleEndian(ptr, chars, nchars);
     } else {
         const uint8_t* ptr = buf.read(nbytes);
-        if (!ptr)
+        if (!ptr) {
             return fail(JS::TranscodeResult_Failure_BadDecode);
+        }
         mozilla::NativeEndian::copyAndSwapFromLittleEndian(chars, ptr, nchars);
     }
     return Ok();
 }
 
 template<XDRMode mode>
 static XDRResult
 VersionCheck(XDRState<mode>* xdr)
@@ -89,41 +95,44 @@ VersionCheck(XDRState<mode>* xdr)
     MOZ_ASSERT(GetBuildId);
     if (!GetBuildId(&buildId)) {
         ReportOutOfMemory(xdr->cx());
         return xdr->fail(JS::TranscodeResult_Throw);
     }
     MOZ_ASSERT(!buildId.empty());
 
     uint32_t buildIdLength;
-    if (mode == XDR_ENCODE)
+    if (mode == XDR_ENCODE) {
         buildIdLength = buildId.length();
+    }
 
     MOZ_TRY(xdr->codeUint32(&buildIdLength));
 
-    if (mode == XDR_DECODE && buildIdLength != buildId.length())
+    if (mode == XDR_DECODE && buildIdLength != buildId.length()) {
         return xdr->fail(JS::TranscodeResult_Failure_BadBuildId);
+    }
 
     if (mode == XDR_ENCODE) {
         MOZ_TRY(xdr->codeBytes(buildId.begin(), buildIdLength));
     } else {
         JS::BuildIdCharVector decodedBuildId;
 
         // buildIdLength is already checked against the length of current
         // buildId.
         if (!decodedBuildId.resize(buildIdLength)) {
             ReportOutOfMemory(xdr->cx());
             return xdr->fail(JS::TranscodeResult_Throw);
         }
 
         MOZ_TRY(xdr->codeBytes(decodedBuildId.begin(), buildIdLength));
 
         // We do not provide binary compatibility with older scripts.
-        if (!ArrayEqual(decodedBuildId.begin(), buildId.begin(), buildIdLength))
+        if (!ArrayEqual(decodedBuildId.begin(), buildId.begin(), buildIdLength)) {
             return xdr->fail(JS::TranscodeResult_Failure_BadBuildId);
+        }
     }
 
     return Ok();
 }
 
 template<XDRMode mode>
 XDRResult
 XDRState<mode>::codeFunction(MutableHandleFunction funp, HandleScriptSourceObject sourceObject)
@@ -176,20 +185,21 @@ XDRState<mode>::codeScript(MutableHandle
 
     // This should be a no-op when encoding, but when decoding it would eat any
     // miss-aligned bytes if when encoding the XDR buffer is appended at the end
     // of an existing buffer, such as in XDRIncrementalEncoder::linearize
     // function.
     MOZ_TRY(codeAlign(sizeof(js::XDRAlignment)));
     AutoXDRTree scriptTree(this, getTopLevelTreeKey());
 
-    if (mode == XDR_DECODE)
+    if (mode == XDR_DECODE) {
         scriptp.set(nullptr);
-    else
+    } else {
         MOZ_ASSERT(!scriptp->enclosingScope());
+    }
 
     MOZ_TRY(VersionCheck(this));
     MOZ_TRY(XDRScript(this, nullptr, nullptr, nullptr, scriptp));
     MOZ_TRY(codeAlign(sizeof(js::XDRAlignment)));
 
     guard.release();
     return Ok();
 }
@@ -199,27 +209,29 @@ template class js::XDRState<XDR_DECODE>;
 
 AutoXDRTree::AutoXDRTree(XDRCoderBase* xdr, AutoXDRTree::Key key)
   : key_(key),
     parent_(this),
     xdr_(xdr)
 {
     // Expect sub-tree to start with the maximum alignment required.
     MOZ_ASSERT(xdr->isAligned(sizeof(js::XDRAlignment)));
-    if (key_ != AutoXDRTree::noKey)
+    if (key_ != AutoXDRTree::noKey) {
         xdr->createOrReplaceSubTree(this);
+    }
 }
 
 AutoXDRTree::~AutoXDRTree()
 {
     // Expect sub-tree to end with the maximum alignment required.
     MOZ_ASSERT_IF(xdr_->resultCode() == JS::TranscodeResult_Ok,
                   xdr_->isAligned(sizeof(js::XDRAlignment)));
-    if (key_ != AutoXDRTree::noKey)
+    if (key_ != AutoXDRTree::noKey) {
         xdr_->endSubTree();
+    }
 }
 
 constexpr AutoXDRTree::Key AutoXDRTree::noKey;
 constexpr AutoXDRTree::Key AutoXDRTree::noSubTree;
 constexpr AutoXDRTree::Key AutoXDRTree::topLevel;
 
 AutoXDRTree::Key
 XDRIncrementalEncoder::getTopLevelTreeKey() const
@@ -248,18 +260,19 @@ XDRIncrementalEncoder::getTreeKey(JSFunc
 }
 
 void
 XDRIncrementalEncoder::createOrReplaceSubTree(AutoXDRTree* child)
 {
     AutoXDRTree* parent = scope_;
     child->parent_ = parent;
     scope_ = child;
-    if (oom_)
+    if (oom_) {
         return;
+    }
 
     size_t cursor = buf.cursor();
 
     // End the parent slice here, set the key to the child.
     if (parent) {
         Slice& last = node_->back();
         last.sliceLength = cursor - last.sliceBegin;
         last.child = child->key_;
@@ -280,28 +293,30 @@ XDRIncrementalEncoder::createOrReplaceSu
     } else {
         // Replace an exisiting sub-tree.
         p->value() = std::move(tmp);
     }
     node_ = &p->value();
 
     // Add content to the root of the new sub-tree,
     // i-e an empty slice with no children.
-    if (!node_->append(Slice { cursor, 0, AutoXDRTree::noSubTree }))
+    if (!node_->append(Slice { cursor, 0, AutoXDRTree::noSubTree })) {
         MOZ_CRASH("SlicesNode have a reserved space of 1.");
+    }
 }
 
 void
 XDRIncrementalEncoder::endSubTree()
 {
     AutoXDRTree* child = scope_;
     AutoXDRTree* parent = child->parent_;
     scope_ = parent;
-    if (oom_)
+    if (oom_) {
         return;
+    }
 
     size_t cursor = buf.cursor();
 
     // End the child sub-tree.
     Slice& last = node_->back();
     last.sliceLength = cursor - last.sliceBegin;
     MOZ_ASSERT(last.child == AutoXDRTree::noSubTree);
 
@@ -357,33 +372,35 @@ XDRIncrementalEncoder::linearize(JS::Tra
     }
 
     while (!depthFirst.empty()) {
         SlicesNode::ConstRange& iter = depthFirst.back();
         Slice slice = iter.popCopyFront();
         // These fields have different meaning, but they should be correlated if
         // the tree is well formatted.
         MOZ_ASSERT_IF(slice.child == AutoXDRTree::noSubTree, iter.empty());
-        if (iter.empty())
+        if (iter.empty()) {
             depthFirst.popBack();
+        }
 
         // Copy the bytes associated with the current slice to the transcode
         // buffer which would be serialized.
         MOZ_ASSERT(slice.sliceBegin <= slices_.length());
         MOZ_ASSERT(slice.sliceBegin + slice.sliceLength <= slices_.length());
         MOZ_ASSERT(buffer.length() % sizeof(XDRAlignment) == 0);
         MOZ_ASSERT(slice.sliceLength % sizeof(XDRAlignment) == 0);
         if (!buffer.append(slices_.begin() + slice.sliceBegin, slice.sliceLength)) {
             ReportOutOfMemory(cx());
             return fail(JS::TranscodeResult_Throw);
         }
 
         // If we are at the end, go to back to the parent script.
-        if (slice.child == AutoXDRTree::noSubTree)
+        if (slice.child == AutoXDRTree::noSubTree) {
             continue;
+        }
 
         // Visit the sub-parts before visiting the rest of the current slice.
         SlicesTree::Ptr p = tree_.lookup(slice.child);
         MOZ_ASSERT(p);
         if (!depthFirst.append(((const SlicesNode&) p->value()).all())) {
             ReportOutOfMemory(cx());
             return fail(JS::TranscodeResult_Throw);
         }
--- a/js/src/vm/Xdr.h
+++ b/js/src/vm/Xdr.h
@@ -121,18 +121,19 @@ class XDRBuffer<XDR_DECODE> : public XDR
 
     const uint8_t* read(size_t n) {
         MOZ_ASSERT(cursor_ < buffer_.length());
         setAligned(false);
         uint8_t* ptr = &buffer_[cursor_];
         cursor_ += n;
 
         // Don't let buggy code read past our buffer
-        if (cursor_ > buffer_.length())
+        if (cursor_ > buffer_.length()) {
             return nullptr;
+        }
 
         return ptr;
     }
 
     uint8_t* write(size_t n) {
         MOZ_CRASH("Should never write in decode mode");
         return nullptr;
     }
@@ -269,18 +270,19 @@ class XDRState : public XDRCoderBase
         MOZ_ASSERT(validateResultCode(cx(), code));
         setResultCode(code);
 #endif
         return mozilla::Err(code);
     }
 
     XDRResult peekData(const uint8_t** pptr, size_t length) {
         const uint8_t* ptr = buf.read(length);
-        if (!ptr)
+        if (!ptr) {
             return fail(JS::TranscodeResult_Failure_BadDecode);
+        }
         *pptr = ptr;
         return Ok();
     }
 
     // Alignment is required when doing memcpy of data which contains element
     // largers than 1 byte.
     bool isAligned(size_t n) override {
         MOZ_ASSERT(mozilla::IsPowerOfTwo(n));
@@ -295,87 +297,98 @@ class XDRState : public XDRCoderBase
         size_t mask = n - 1;
         MOZ_ASSERT_IF(mode == XDR_ENCODE, (buf.uptr() & mask) == (buf.cursor() & mask));
         size_t offset = buf.uptr() & mask;
         if (offset) {
             size_t padding = n - offset;
             MOZ_ASSERT(padding < sizeof(AlignPadding));
             if (mode == XDR_ENCODE) {
                 uint8_t* ptr = buf.write(padding);
-                if (!ptr)
+                if (!ptr) {
                     return fail(JS::TranscodeResult_Throw);
+                }
                 memcpy(ptr, AlignPadding, padding);
             } else {
                 const uint8_t* ptr = buf.read(padding);
-                if (!ptr)
+                if (!ptr) {
                     return fail(JS::TranscodeResult_Failure_BadDecode);
-                if (memcmp(ptr, AlignPadding, padding) != 0)
+                }
+                if (memcmp(ptr, AlignPadding, padding) != 0) {
                     return fail(JS::TranscodeResult_Failure_BadDecode);
+                }
             }
         }
         buf.setAligned(true);
         MOZ_ASSERT(isAligned(n));
         return Ok();
     }
 
     XDRResult codeUint8(uint8_t* n) {
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             *ptr = *n;
         } else {
             const uint8_t* ptr = buf.read(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             *n = *ptr;
         }
         return Ok();
     }
 
     XDRResult codeUint16(uint16_t* n) {
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             mozilla::LittleEndian::writeUint16(ptr, *n);
         } else {
             const uint8_t* ptr = buf.read(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             *n = mozilla::LittleEndian::readUint16(ptr);
         }
         return Ok();
     }
 
     XDRResult codeUint32(uint32_t* n) {
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             mozilla::LittleEndian::writeUint32(ptr, *n);
         } else {
             const uint8_t* ptr = buf.read(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             *n = mozilla::LittleEndian::readUint32(ptr);
         }
         return Ok();
     }
 
     XDRResult codeUint64(uint64_t* n) {
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             mozilla::LittleEndian::writeUint64(ptr, *n);
         } else {
             const uint8_t* ptr = buf.read(sizeof(*n));
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             *n = mozilla::LittleEndian::readUint64(ptr);
         }
         return Ok();
     }
 
     /*
      * Use SFINAE to refuse any specialization which is not an enum.  Uses of
      * this function do not have to specialize the type of the enumerated field
@@ -384,87 +397,97 @@ class XDRState : public XDRCoderBase
     template <typename T>
     XDRResult codeEnum32(T* val, typename mozilla::EnableIf<mozilla::IsEnum<T>::value, T>::Type * = NULL)
     {
         // Mix the enumeration value with a random magic number, such that a
         // corruption with a low-ranged value (like 0) is less likely to cause a
         // miss-interpretation of the XDR content and instead cause a failure.
         const uint32_t MAGIC = 0x21AB218C;
         uint32_t tmp;
-        if (mode == XDR_ENCODE)
+        if (mode == XDR_ENCODE) {
             tmp = uint32_t(*val) ^ MAGIC;
+        }
         MOZ_TRY(codeUint32(&tmp));
-        if (mode == XDR_DECODE)
+        if (mode == XDR_DECODE) {
             *val = T(tmp ^ MAGIC);
+        }
         return Ok();
     }
 
     XDRResult codeDouble(double* dp) {
         union DoublePun {
             double d;
             uint64_t u;
         } pun;
-        if (mode == XDR_ENCODE)
+        if (mode == XDR_ENCODE) {
             pun.d = *dp;
+        }
         MOZ_TRY(codeUint64(&pun.u));
-        if (mode == XDR_DECODE)
+        if (mode == XDR_DECODE) {
             *dp = pun.d;
+        }
         return Ok();
     }
 
     XDRResult codeMarker(uint32_t magic) {
         uint32_t actual = magic;
         MOZ_TRY(codeUint32(&actual));
         if (actual != magic) {
             // Fail in debug, but only soft-fail in release
             MOZ_ASSERT(false, "Bad XDR marker");
             return fail(JS::TranscodeResult_Failure_BadDecode);
         }
         return Ok();
     }
 
     XDRResult codeBytes(void* bytes, size_t len) {
-        if (len == 0)
+        if (len == 0) {
             return Ok();
+        }
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(len);
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             memcpy(ptr, bytes, len);
         } else {
             const uint8_t* ptr = buf.read(len);
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             memcpy(bytes, ptr, len);
         }
         return Ok();
     }
 
     /*
      * During encoding the string is written into the buffer together with its
      * terminating '\0'. During decoding the method returns a pointer into the
      * decoding buffer and the caller must copy the string if it will outlive
      * the decoding buffer.
      */
     XDRResult codeCString(const char** sp) {
         uint64_t len64;
-        if (mode == XDR_ENCODE)
+        if (mode == XDR_ENCODE) {
             len64 = (uint64_t)(strlen(*sp) + 1);
+        }
         MOZ_TRY(codeUint64(&len64));
         size_t len = (size_t) len64;
 
         if (mode == XDR_ENCODE) {
             uint8_t* ptr = buf.write(len);
-            if (!ptr)
+            if (!ptr) {
                 return fail(JS::TranscodeResult_Throw);
+            }
             memcpy(ptr, *sp, len);
         } else {
             const uint8_t* ptr = buf.read(len);
-            if (!ptr || ptr[len] != '\0')
+            if (!ptr || ptr[len] != '\0') {
                 return fail(JS::TranscodeResult_Failure_BadDecode);
+            }
             *sp = reinterpret_cast<const char*>(ptr);
         }
         return Ok();
     }
 
     XDRResult codeChars(const JS::Latin1Char* chars, size_t nchars);
     XDRResult codeChars(char16_t* chars, size_t nchars);