Bug 1015663 - Fix more bad implicit conversion constructors in the JS engine; r=jorendorff
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 04 Jun 2014 18:22:10 -0400
changeset 207019 86195553d5e7ac9050514262562df8118c591d88
parent 207018 fa44003a40408cb8ee8be5826dac297a71f54315
child 207020 d9a7b9a18ab4759a96e7a726e4a403ebda6ca0f0
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1015663
milestone32.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 1015663 - Fix more bad implicit conversion constructors in the JS engine; r=jorendorff
js/src/gc/Marking.cpp
js/src/gc/Statistics.h
js/src/jit/LIR-Common.h
js/src/jit/MIR.h
js/src/jit/shared/CodeGenerator-shared.cpp
js/src/jsapi.h
js/src/jsgc.cpp
js/src/jsgc.h
js/src/shell/jsheaptools.cpp
js/src/vm/HelperThreads.h
js/src/vm/RegExpObject.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -1623,17 +1623,17 @@ GCMarker::processMarkStackTop(SliceBudge
 bool
 GCMarker::drainMarkStack(SliceBudget &budget)
 {
 #ifdef DEBUG
     JSRuntime *rt = runtime();
 
     struct AutoCheckCompartment {
         JSRuntime *runtime;
-        AutoCheckCompartment(JSRuntime *rt) : runtime(rt) {
+        explicit AutoCheckCompartment(JSRuntime *rt) : runtime(rt) {
             JS_ASSERT(!rt->gc.strictCompartmentChecking);
             runtime->gc.strictCompartmentChecking = true;
         }
         ~AutoCheckCompartment() { runtime->gc.strictCompartmentChecking = false; }
     } acc(rt);
 #endif
 
     if (budget.isOverBudget())
--- a/js/src/gc/Statistics.h
+++ b/js/src/gc/Statistics.h
@@ -202,17 +202,17 @@ struct AutoPhase
 
     Statistics &stats;
     Phase phase;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 struct MaybeAutoPhase
 {
-    MaybeAutoPhase(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
+    explicit MaybeAutoPhase(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
       : stats(nullptr)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     void construct(Statistics &statsArg, Phase phaseArg)
     {
         JS_ASSERT(!stats);
         stats = &statsArg;
--- a/js/src/jit/LIR-Common.h
+++ b/js/src/jit/LIR-Common.h
@@ -4801,28 +4801,28 @@ class LFloorF : public LInstructionHelpe
 };
 
 // Take the ceiling of a double precision number. Implements Math.ceil().
 class LCeil : public LInstructionHelper<1, 1, 0>
 {
   public:
     LIR_HEADER(Ceil)
 
-    LCeil(const LAllocation &num) {
+    explicit LCeil(const LAllocation &num) {
         setOperand(0, num);
     }
 };
 
 // Take the ceiling of a single precision number. Implements Math.ceil().
 class LCeilF : public LInstructionHelper<1, 1, 0>
 {
   public:
     LIR_HEADER(CeilF)
 
-    LCeilF(const LAllocation &num) {
+    explicit LCeilF(const LAllocation &num) {
         setOperand(0, num);
     }
 };
 
 // Round a double precision number. Implements Math.round().
 class LRound : public LInstructionHelper<1, 1, 1>
 {
   public:
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -8812,17 +8812,17 @@ class MFloor
     void computeRange(TempAllocator &alloc);
 };
 
 // Inlined version of Math.ceil().
 class MCeil
   : public MUnaryInstruction,
     public FloatingPointPolicy<0>
 {
-    MCeil(MDefinition *num)
+    explicit MCeil(MDefinition *num)
       : MUnaryInstruction(num)
     {
         setResultType(MIRType_Int32);
         setPolicyType(MIRType_Double);
         setMovable();
     }
 
   public:
--- a/js/src/jit/shared/CodeGenerator-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-shared.cpp
@@ -463,17 +463,17 @@ HandleRegisterDump(Op op, MacroAssembler
     }
 }
 
 class StoreOp
 {
     MacroAssembler &masm;
 
   public:
-    StoreOp(MacroAssembler &masm)
+    explicit StoreOp(MacroAssembler &masm)
       : masm(masm)
     {}
 
     void operator()(Register reg, Address dump) {
         masm.storePtr(reg, dump);
     }
     void operator()(FloatRegister reg, Address dump) {
         masm.storeDouble(reg, dump);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -40,18 +40,18 @@ class Latin1CharsZ;
 class TwoByteChars;
 
 #if defined JS_THREADSAFE && defined JS_DEBUG
 
 class JS_PUBLIC_API(AutoCheckRequestDepth)
 {
     JSContext *cx;
   public:
-    AutoCheckRequestDepth(JSContext *cx);
-    AutoCheckRequestDepth(js::ContextFriendFields *cx);
+    explicit AutoCheckRequestDepth(JSContext *cx);
+    explicit AutoCheckRequestDepth(js::ContextFriendFields *cx);
     ~AutoCheckRequestDepth();
 };
 
 # define CHECK_REQUEST(cx) \
     JS::AutoCheckRequestDepth _autoCheckRequestDepth(cx)
 
 #else
 
@@ -4279,17 +4279,17 @@ class JSAutoByteString
     JSAutoByteString(JSContext *cx, JSString *str
                      MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : mBytes(JS_EncodeString(cx, str))
     {
         JS_ASSERT(cx);
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
-    JSAutoByteString(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
+    explicit JSAutoByteString(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
       : mBytes(nullptr)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     ~JSAutoByteString() {
         js_free(mBytes);
     }
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -3141,17 +3141,17 @@ void
 GCRuntime::markAllGrayReferences()
 {
     markGrayReferences<GCZonesIter, GCCompartmentsIter>();
 }
 
 class js::gc::MarkingValidator
 {
   public:
-    MarkingValidator(GCRuntime *gc);
+    explicit MarkingValidator(GCRuntime *gc);
     ~MarkingValidator();
     void nonIncrementalMark();
     void validate();
 
   private:
     GCRuntime *gc;
     bool initialized;
 
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -1268,18 +1268,18 @@ class AutoEnterOOMUnsafeRegion {};
 #ifdef DEBUG
 /* Use this to avoid assertions when manipulating the wrapper map. */
 class AutoDisableProxyCheck
 {
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
     uintptr_t &count;
 
   public:
-    AutoDisableProxyCheck(JSRuntime *rt
-                          MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
+    explicit AutoDisableProxyCheck(JSRuntime *rt
+                                   MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
 
     ~AutoDisableProxyCheck() {
         count--;
     }
 };
 #else
 struct AutoDisableProxyCheck
 {
--- a/js/src/shell/jsheaptools.cpp
+++ b/js/src/shell/jsheaptools.cpp
@@ -61,17 +61,17 @@ class HeapReverser : public JSTracer, pu
 {
   public:
     struct Edge;
 
     /* Metadata for a given Cell we have visited. */
     class Node {
       public:
         Node() { }
-        Node(JSGCTraceKind kind)
+        explicit Node(JSGCTraceKind kind)
           : kind(kind), incoming(), marked(false) { }
 
         /*
          * Move constructor and move assignment. These allow us to store our
          * incoming edge Vector in the hash table: Vectors support moves, but
          * not assignments or copy construction.
          */
         Node(Node &&rhs)
@@ -148,17 +148,17 @@ class HeapReverser : public JSTracer, pu
     /*
      * The result of a reversal is a map from Cells' addresses to Node
      * structures describing their incoming edges.
      */
     typedef HashMap<void *, Node, DefaultHasher<void *>, SystemAllocPolicy> Map;
     Map map;
 
     /* Construct a HeapReverser for |context|'s heap. */
-    HeapReverser(JSContext *cx)
+    explicit HeapReverser(JSContext *cx)
       : JSTracer(cx->runtime(), traverseEdgeWithThis),
         JS::CustomAutoRooter(cx),
         noggc(JS_GetRuntime(cx)),
         runtime(JS_GetRuntime(cx)),
         parent(nullptr)
     {
     }
 
@@ -366,17 +366,17 @@ class ReferenceFinder {
         char *computeName(JSContext *cx);
 
       private:
         const HeapReverser::Edge &edge;
         Path *next;
     };
 
     struct AutoNodeMarker {
-        AutoNodeMarker(HeapReverser::Node *node) : node(node) { node->marked = true; }
+        explicit AutoNodeMarker(HeapReverser::Node *node) : node(node) { node->marked = true; }
         ~AutoNodeMarker() { node->marked = false; }
       private:
         HeapReverser::Node *node;
     };
 
     /*
      * Given that we've reached |cell| via |path|, with all Nodes along that
      * path marked, add paths from all reportable objects reachable from cell
--- a/js/src/vm/HelperThreads.h
+++ b/js/src/vm/HelperThreads.h
@@ -328,17 +328,17 @@ bool
 StartOffThreadCompression(ExclusiveContext *cx, SourceCompressionTask *task);
 
 class AutoLockHelperThreadState
 {
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
 #ifdef JS_THREADSAFE
   public:
-    AutoLockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
+    explicit AutoLockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         HelperThreadState().lock();
     }
 
     ~AutoLockHelperThreadState() {
         HelperThreadState().unlock();
     }
@@ -352,17 +352,17 @@ class AutoLockHelperThreadState
 };
 
 class AutoUnlockHelperThreadState
 {
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
   public:
 
-    AutoUnlockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
+    explicit AutoUnlockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 #ifdef JS_THREADSAFE
         HelperThreadState().unlock();
 #endif
     }
 
     ~AutoUnlockHelperThreadState()
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -310,17 +310,17 @@ class RegExpCompartment
     struct Key {
         JSAtom *atom;
         uint16_t flag;
 
         Key() {}
         Key(JSAtom *atom, RegExpFlag flag)
           : atom(atom), flag(flag)
         { }
-        Key(RegExpShared *shared)
+        MOZ_IMPLICIT Key(RegExpShared *shared)
           : atom(shared->getSource()), flag(shared->getFlags())
         { }
 
         typedef Key Lookup;
         static HashNumber hash(const Lookup &l) {
             return DefaultHasher<JSAtom *>::hash(l.atom) ^ (l.flag << 1);
         }
         static bool match(Key l, Key r) {