Bug 1509010 - Fix some clang-format comment issues in js/public. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 21 Nov 2018 18:12:57 +0000
changeset 504048 834b61114235c7a2f2413d135ad11e5b4148c09b
parent 504047 52072aea049989476355bf06e4a1be4106cc052f
child 504049 4563b979582b601a929eed63ef4e6162973e5c73
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1509010
milestone65.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 1509010 - Fix some clang-format comment issues in js/public. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D12535
js/public/CallNonGenericMethod.h
js/public/Class.h
js/public/Conversions.h
js/public/Debug.h
js/public/MemoryMetrics.h
js/public/ProtoKey.h
js/public/UbiNode.h
js/public/UbiNodeDominatorTree.h
js/public/Value.h
--- a/js/public/CallNonGenericMethod.h
+++ b/js/public/CallNonGenericMethod.h
@@ -69,17 +69,18 @@ CallMethodIfWrapped(JSContext* cx, IsAcc
 //
 // Now to implement the actual method, write a JSNative that calls the method
 // declared below, passing the appropriate template and runtime arguments.
 //
 //   static bool
 //   answer_getAnswer(JSContext* cx, unsigned argc, JS::Value* vp)
 //   {
 //       JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-//       return JS::CallNonGenericMethod<IsAnswerObject, answer_getAnswer_impl>(cx, args);
+//       return JS::CallNonGenericMethod<IsAnswerObject,
+//                                       answer_getAnswer_impl>(cx, args);
 //   }
 //
 // Note that, because they are used as template arguments, the predicate
 // and implementation functions must have external linkage. (This is
 // unfortunate, but GCC wasn't inlining things as one would hope when we
 // passed them as function arguments.)
 //
 // JS::CallNonGenericMethod will test whether |args.thisv()| is acceptable.  If
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -656,17 +656,20 @@ struct MOZ_STATIC_CLASS ClassOps
     JSHasInstanceOp     hasInstance;
     JSNative            construct;
     JSTraceOp           trace;
 };
 
 /** Callback for the creation of constructor and prototype objects. */
 typedef JSObject* (*ClassObjectCreationOp)(JSContext* cx, JSProtoKey key);
 
-/** Callback for custom post-processing after class initialization via ClassSpec. */
+/**
+ * Callback for custom post-processing after class initialization via
+ * ClassSpec.
+ */
 typedef bool (*FinishClassInitOp)(JSContext* cx, JS::HandleObject ctor,
                                   JS::HandleObject proto);
 
 const size_t JSCLASS_CACHED_PROTO_WIDTH = 6;
 
 struct MOZ_STATIC_CLASS ClassSpec
 {
     ClassObjectCreationOp createConstructor;
--- a/js/public/Conversions.h
+++ b/js/public/Conversions.h
@@ -413,35 +413,37 @@ ToSignedInteger<int32_t>(double d)
     uint32_t    tmp2;
     asm (
     // We use a pure integer solution here. In the 'softfp' ABI, the argument
     // will start in r0 and r1, and VFP can't do all of the necessary ECMA
     // conversions by itself so some integer code will be required anyway. A
     // hybrid solution is faster on A9, but this pure integer solution is
     // notably faster for A8.
 
-    // %0 is the result register, and may alias either of the %[QR]1 registers.
+    // %0 is the result register, and may alias either of the %[QR]1
+    //    registers.
     // %Q4 holds the lower part of the mantissa.
     // %R4 holds the sign, exponent, and the upper part of the mantissa.
     // %1, %2 and %3 are used as temporary values.
 
     // Extract the exponent.
 "   mov     %1, %R4, LSR #20\n"
 "   bic     %1, %1, #(1 << 11)\n"  // Clear the sign.
 
     // Set the implicit top bit of the mantissa. This clobbers a bit of the
     // exponent, but we have already extracted that.
 "   orr     %R4, %R4, #(1 << 20)\n"
 
     // Special Cases
     //   We should return zero in the following special cases:
     //    - Exponent is 0x000 - 1023: +/-0 or subnormal.
     //    - Exponent is 0x7ff - 1023: +/-INFINITY or NaN
-    //      - This case is implicitly handled by the standard code path anyway,
-    //        as shifting the mantissa up by the exponent will result in '0'.
+    //      - This case is implicitly handled by the standard code path
+    //        anyway, as shifting the mantissa up by the exponent will
+    //        result in '0'.
     //
     // The result is composed of the mantissa, prepended with '1' and
     // bit-shifted left by the (decoded) exponent. Note that because the r1[20]
     // is the bit with value '1', r1 is effectively already shifted (left) by
     // 20 bits, and r0 is already shifted by 52 bits.
 
     // Adjust the exponent to remove the encoding offset. If the decoded
     // exponent is negative, quickly bail out with '0' as such values round to
--- a/js/public/Debug.h
+++ b/js/public/Debug.h
@@ -97,17 +97,18 @@ namespace dbg {
 //                                 Builder::Object& result)
 //    {
 //        JSObject* eventObject = ... obtain debuggee event object somehow ...;
 //        if (!eventObject) {
 //            return false;
 //        }
 //        result = builder.newObject(cx);
 //        return result &&
-//               result.defineProperty(cx, "eventType", SafelyFetchType(eventObject)) &&
+//               result.defineProperty(cx, "eventType",
+//                                     SafelyFetchType(eventObject)) &&
 //               result.defineProperty(cx, "event", eventObject);
 //    }
 //
 //
 // Object::defineProperty also accepts an Object as the value to store on the
 // property. By its type, we know that the value is trusted, so we set it
 // directly as the property's value, without interposing a Debugger.Object
 // wrapper. This allows the embedding to builted nested structures of trusted
--- a/js/public/MemoryMetrics.h
+++ b/js/public/MemoryMetrics.h
@@ -934,26 +934,29 @@ struct RuntimeStats
         currZoneStats(nullptr),
         mallocSizeOf_(mallocSizeOf)
     {}
 
     // Here's a useful breakdown of the GC heap.
     //
     // - rtStats.gcHeapChunkTotal
     //   - decommitted bytes
-    //     - rtStats.gcHeapDecommittedArenas (decommitted arenas in non-empty chunks)
+    //     - rtStats.gcHeapDecommittedArenas
+    //         (decommitted arenas in non-empty chunks)
     //   - unused bytes
     //     - rtStats.gcHeapUnusedChunks (empty chunks)
     //     - rtStats.gcHeapUnusedArenas (empty arenas within non-empty chunks)
-    //     - rtStats.zTotals.unusedGCThings.totalSize() (empty GC thing slots within non-empty arenas)
+    //     - rtStats.zTotals.unusedGCThings.totalSize()
+    //         (empty GC thing slots within non-empty arenas)
     //   - used bytes
     //     - rtStats.gcHeapChunkAdmin
     //     - rtStats.zTotals.gcHeapArenaAdmin
     //     - rtStats.gcHeapGCThings (in-use GC things)
-    //       == rtStats.zTotals.sizeOfLiveGCThings() + rtStats.cTotals.sizeOfLiveGCThings()
+    //       == (rtStats.zTotals.sizeOfLiveGCThings() +
+    //           rtStats.cTotals.sizeOfLiveGCThings())
     //
     // It's possible that some arenas in empty chunks may be decommitted, but
     // we don't count those under rtStats.gcHeapDecommittedArenas because (a)
     // it's rare, and (b) this means that rtStats.gcHeapUnusedChunks is a
     // multiple of the chunk size, which is good.
 
     void addToServoSizes(ServoSizes *sizes) const {
         FOR_EACH_SIZE(ADD_TO_SERVO_SIZES)
--- a/js/public/ProtoKey.h
+++ b/js/public/ProtoKey.h
@@ -7,18 +7,18 @@
 #ifndef js_ProtoKey_h
 #define js_ProtoKey_h
 
 /* A higher-order macro for enumerating all JSProtoKey values. */
 /*
  * Consumers define macros as follows:
  * MACRO(name, init, clasp)
  *   name:    The canonical name of the class.
- *   init:    Initialization function. These are |extern "C";|, and clients should use
- *            |extern "C" {}| as appropriate when using this macro.
+ *   init:    Initialization function. These are |extern "C";|, and clients
+ *            should use |extern "C" {}| as appropriate when using this macro.
  *   clasp:   The JSClass for this object, or "dummy" if it doesn't exist.
  *
  *
  * Consumers wishing to iterate over all the JSProtoKey values, can use
  * JS_FOR_EACH_PROTOTYPE. However, there are certain values that don't correspond
  * to real constructors, like Null or constructors that are disabled via
  * preprocessor directives. We still need to include these in the JSProtoKey list
  * in order to maintain binary XDR compatibility, but we need to provide a tool
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -178,17 +178,17 @@ namespace ubi {
 
 using mozilla::Maybe;
 using mozilla::RangedPtr;
 using mozilla::Variant;
 
 template <typename T>
 using Vector = mozilla::Vector<T, 0, js::SystemAllocPolicy>;
 
-/*** ubi::StackFrame ******************************************************************************/
+/*** ubi::StackFrame **********************************************************/
 
 // Concrete JS::ubi::StackFrame instances backed by a live SavedFrame object
 // store their strings as JSAtom*, while deserialized stack frames from offline
 // heap snapshots store their strings as const char16_t*. In order to provide
 // zero-cost accessors to these strings in a single interface that works with
 // both cases, we use this variant type.
 class JS_PUBLIC_API AtomOrTwoByteChars : public Variant<JSAtom*, const char16_t*> {
     using Base = Variant<JSAtom*, const char16_t*>;
@@ -837,17 +837,17 @@ class Node {
         static bool match(const Node& k, const Lookup& l) { return k == l; }
         static void rekey(Node& k, const Node& newKey) { k = newKey; }
     };
 };
 
 using NodeSet = js::HashSet<Node, js::DefaultHasher<Node>, js::SystemAllocPolicy>;
 using NodeSetPtr = mozilla::UniquePtr<NodeSet, JS::DeletePolicy<NodeSet>>;
 
-/*** Edge and EdgeRange ***************************************************************************/
+/*** Edge and EdgeRange *******************************************************/
 
 using EdgeName = UniqueTwoByteChars;
 
 // An outgoing edge to a referent node.
 class Edge {
   public:
     Edge() : name(nullptr), referent() { }
 
@@ -950,17 +950,17 @@ class PreComputedEdgeRange : public Edge
 
     void popFront() override {
         MOZ_ASSERT(!empty());
         i++;
         settle();
     }
 };
 
-/*** RootList *************************************************************************************/
+/*** RootList *****************************************************************/
 
 // RootList is a class that can be pointed to by a |ubi::Node|, creating a
 // fictional root-of-roots which has edges to every GC root in the JS
 // runtime. Having a single root |ubi::Node| is useful for algorithms written
 // with the assumption that there aren't multiple roots (such as computing
 // dominator trees) and you want a single point of entry. It also ensures that
 // the roots themselves get visited by |ubi::BreadthFirst| (they would otherwise
 // only be used as starting points).
@@ -1013,17 +1013,17 @@ class MOZ_STACK_CLASS JS_PUBLIC_API Root
 
     // Explicitly add the given Node as a root in this RootList. If wantNames is
     // true, you must pass an edgeName. The RootList does not take ownership of
     // edgeName.
     MOZ_MUST_USE bool addRoot(Node node, const char16_t* edgeName = nullptr);
 };
 
 
-/*** Concrete classes for ubi::Node referent types ************************************************/
+/*** Concrete classes for ubi::Node referent types ****************************/
 
 template<>
 class JS_PUBLIC_API Concrete<RootList> : public Base {
   protected:
     explicit Concrete(RootList* ptr) : Base(ptr) { }
     RootList& get() const { return *static_cast<RootList*>(ptr); }
 
   public:
--- a/js/public/UbiNodeDominatorTree.h
+++ b/js/public/UbiNodeDominatorTree.h
@@ -144,17 +144,18 @@ class JS_PUBLIC_API DominatorTree
             return endPtr - beginPtr;
         }
 
         /**
          * Safely skip ahead `n` dominators in the range, in O(1) time.
          *
          * Example usage:
          *
-         *     mozilla::Maybe<DominatedSetRange> range = myDominatorTree.getDominatedSet(myNode);
+         *     mozilla::Maybe<DominatedSetRange> range =
+         *         myDominatorTree.getDominatedSet(myNode);
          *     if (range.isNothing()) {
          *         // Handle unknown nodes however you see fit...
          *         return false;
          *     }
          *
          *     // Don't care about the first ten, for whatever reason.
          *     range->skip(10);
          *     for (const JS::ubi::Node& dominatedNode : *range) {
@@ -635,17 +636,18 @@ class JS_PUBLIC_API DominatorTree
     }
 
     /**
      * Get the set of nodes immediately dominated by the given `node`. If `node`
      * is not a member of this dominator tree, return `Nothing`.
      *
      * Example usage:
      *
-     *     mozilla::Maybe<DominatedSetRange> range = myDominatorTree.getDominatedSet(myNode);
+     *     mozilla::Maybe<DominatedSetRange> range =
+     *         myDominatorTree.getDominatedSet(myNode);
      *     if (range.isNothing()) {
      *         // Handle unknown node however you see fit...
      *         return false;
      *     }
      *
      *     for (const JS::ubi::Node& dominatedNode : *range) {
      *         // Do something with each immediately dominated node...
      *     }
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -59,17 +59,18 @@ enum JSValueType : uint8_t
     JSVAL_TYPE_STRING              = 0x06,
     JSVAL_TYPE_SYMBOL              = 0x07,
     JSVAL_TYPE_PRIVATE_GCTHING     = 0x08,
 #ifdef ENABLE_BIGINT
     JSVAL_TYPE_BIGINT              = 0x09,
 #endif
     JSVAL_TYPE_OBJECT              = 0x0c,
 
-    /* These never appear in a jsval; they are only provided as an out-of-band value. */
+    // These never appear in a jsval; they are only provided as an out-of-band
+    // value.
     JSVAL_TYPE_UNKNOWN             = 0x20,
     JSVAL_TYPE_MISSING             = 0x21
 };
 
 static_assert(sizeof(JSValueType) == 1,
               "compiler typed enum support is apparently buggy");
 
 #if defined(JS_NUNBOX32)
@@ -274,26 +275,27 @@ CanonicalizeNaN(double d)
 /**
  * [SMDOC] JS::Value type
  *
  * JS::Value is the interface for a single JavaScript Engine value.  A few
  * general notes on JS::Value:
  *
  * - JS::Value has setX() and isX() members for X in
  *
- *     { Int32, Double, String, Symbol, BigInt, Boolean, Undefined, Null, Object, Magic }
+ *     { Int32, Double, String, Symbol, BigInt, Boolean, Undefined, Null,
+ *       Object, Magic }
  *
  *   JS::Value also contains toX() for each of the non-singleton types.
  *
- * - Magic is a singleton type whose payload contains either a JSWhyMagic "reason" for
- *   the magic value or a uint32_t value. By providing JSWhyMagic values when
- *   creating and checking for magic values, it is possible to assert, at
- *   runtime, that only magic values with the expected reason flow through a
- *   particular value. For example, if cx->exception has a magic value, the
- *   reason must be JS_GENERATOR_CLOSING.
+ * - Magic is a singleton type whose payload contains either a JSWhyMagic
+ *   "reason" for the magic value or a uint32_t value. By providing JSWhyMagic
+ *   values when creating and checking for magic values, it is possible to
+ *   assert, at runtime, that only magic values with the expected reason flow
+ *   through a particular value. For example, if cx->exception has a magic
+ *   value, the reason must be JS_GENERATOR_CLOSING.
  *
  * - The JS::Value operations are preferred.  The JSVAL_* operations remain for
  *   compatibility; they may be removed at some point.  These operations mostly
  *   provide similar functionality.  But there are a few key differences.  One
  *   is that JS::Value gives null a separate type.
  *   Also, to help prevent mistakenly boxing a nullable JSObject* as an object,
  *   Value::setObject takes a JSObject&. (Conversely, Value::toObject returns a
  *   JSObject&.)  A convenience member Value::setObjectOrNull is provided.