Bug 1054334 - SpiderMonkey: Eliminate unnecessary parentheses around return values r=nbp
authorDan Gohman <sunfish@mozilla.com>
Mon, 18 Aug 2014 12:20:40 -0700
changeset 200192 c9b218c047fa70bd8872f5f77c54f47b85422035
parent 200191 80db0e307d6d9f4eb42fd26e3e4236d9040edf68
child 200193 b01844af31c986f08379e826d745a525e19d20c4
push id27337
push useremorley@mozilla.com
push dateTue, 19 Aug 2014 12:40:34 +0000
treeherdermozilla-central@a38daccaa557 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1054334
milestone34.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 1054334 - SpiderMonkey: Eliminate unnecessary parentheses around return values r=nbp
js/public/Id.h
js/public/Value.h
js/src/jit/BaselineDebugModeOSR.cpp
js/src/jit/BaselineIC.cpp
js/src/jit/BaselineIC.h
js/src/jit/IonBuilder.cpp
js/src/jit/IonCaches.cpp
js/src/jit/LiveRangeAllocator.h
js/src/jit/MIR.h
js/src/jit/ParallelFunctions.cpp
js/src/jsapi.cpp
js/src/vm/Probes-inl.h
js/xpconnect/src/XPCMaps.cpp
--- a/js/public/Id.h
+++ b/js/public/Id.h
@@ -145,23 +145,23 @@ JSID_TO_GCTHING(jsid id)
     return (void *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK);
 }
 
 static MOZ_ALWAYS_INLINE bool
 JSID_IS_VOID(const jsid id)
 {
     MOZ_ASSERT_IF(((size_t)JSID_BITS(id) & JSID_TYPE_MASK) == JSID_TYPE_VOID,
                  JSID_BITS(id) == JSID_TYPE_VOID);
-    return ((size_t)JSID_BITS(id) == JSID_TYPE_VOID);
+    return (size_t)JSID_BITS(id) == JSID_TYPE_VOID;
 }
 
 static MOZ_ALWAYS_INLINE bool
 JSID_IS_EMPTY(const jsid id)
 {
-    return ((size_t)JSID_BITS(id) == JSID_TYPE_SYMBOL);
+    return (size_t)JSID_BITS(id) == JSID_TYPE_SYMBOL;
 }
 
 extern JS_PUBLIC_DATA(const jsid) JSID_VOID;
 extern JS_PUBLIC_DATA(const jsid) JSID_EMPTY;
 
 extern JS_PUBLIC_DATA(const JS::HandleId) JSID_VOIDHANDLE;
 extern JS_PUBLIC_DATA(const JS::HandleId) JSID_EMPTYHANDLE;
 
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1940,19 +1940,19 @@ DOUBLE_TO_JSVAL(double d)
         l.asDouble = d;
     return IMPL_TO_JSVAL(l);
 #endif
 }
 
 static inline JS_VALUE_CONSTEXPR jsval
 UINT_TO_JSVAL(uint32_t i)
 {
-    return (i <= JSVAL_INT_MAX
-            ? INT_TO_JSVAL((int32_t)i)
-            : DOUBLE_TO_JSVAL((double)i));
+    return i <= JSVAL_INT_MAX
+           ? INT_TO_JSVAL((int32_t)i)
+           : DOUBLE_TO_JSVAL((double)i);
 }
 
 static inline jsval
 STRING_TO_JSVAL(JSString *str)
 {
     return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
 }
 
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -82,20 +82,20 @@ struct DebugModeOSREntry
     ~DebugModeOSREntry() {
         // Note that this is nulled out when the recompInfo is taken by the
         // frame. The frame then has the responsibility of freeing the
         // recompInfo.
         js_delete(recompInfo);
     }
 
     bool needsRecompileInfo() const {
-        return (frameKind == ICEntry::Kind_CallVM ||
-                frameKind == ICEntry::Kind_DebugTrap ||
-                frameKind == ICEntry::Kind_DebugPrologue ||
-                frameKind == ICEntry::Kind_DebugEpilogue);
+        return frameKind == ICEntry::Kind_CallVM ||
+               frameKind == ICEntry::Kind_DebugTrap ||
+               frameKind == ICEntry::Kind_DebugPrologue ||
+               frameKind == ICEntry::Kind_DebugEpilogue;
     }
 
     bool recompiled() const {
         return oldBaselineScript != script->baselineScript();
     }
 
     BaselineDebugModeOSRInfo *takeRecompInfo() {
         MOZ_ASSERT(needsRecompileInfo() && recompInfo);
@@ -800,19 +800,19 @@ JitRuntime::getBaselineDebugModeOSRHandl
     return baselineDebugModeOSRHandler_;
 }
 
 void *
 JitRuntime::getBaselineDebugModeOSRHandlerAddress(JSContext *cx, bool popFrameReg)
 {
     if (!getBaselineDebugModeOSRHandler(cx))
         return nullptr;
-    return (popFrameReg
-            ? baselineDebugModeOSRHandler_->raw()
-            : baselineDebugModeOSRHandlerNoFrameRegPopAddr_);
+    return popFrameReg
+           ? baselineDebugModeOSRHandler_->raw()
+           : baselineDebugModeOSRHandlerNoFrameRegPopAddr_;
 }
 
 JitCode *
 JitRuntime::generateBaselineDebugModeOSRHandler(JSContext *cx, uint32_t *noFrameRegPopOffsetOut)
 {
     MacroAssembler masm(cx);
 
     GeneralRegisterSet regs(GeneralRegisterSet::All());
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -3885,19 +3885,19 @@ static bool TryAttachNativeGetElemStub(J
 
     return true;
 }
 
 static bool
 TypedArrayRequiresFloatingPoint(TypedArrayObject *tarr)
 {
     uint32_t type = tarr->type();
-    return (type == Scalar::Uint32 ||
-            type == Scalar::Float32 ||
-            type == Scalar::Float64);
+    return type == Scalar::Uint32 ||
+           type == Scalar::Float32 ||
+           type == Scalar::Float64;
 }
 
 static bool
 TryAttachGetElemStub(JSContext *cx, JSScript *script, jsbytecode *pc, ICGetElem_Fallback *stub,
                      HandleValue lhs, HandleValue rhs, HandleValue res)
 {
     bool isCallElem = (JSOp(*pc) == JSOP_CALLELEM);
 
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -2250,18 +2250,18 @@ class ICCompare_Int32WithBoolean : publi
     // Compiler for this stub kind.
     class Compiler : public ICStubCompiler {
       protected:
         JSOp op_;
         bool lhsIsInt32_;
         bool generateStubCode(MacroAssembler &masm);
 
         virtual int32_t getKey() const {
-            return (static_cast<int32_t>(kind) | (static_cast<int32_t>(op_) << 16) |
-                    (static_cast<int32_t>(lhsIsInt32_) << 24));
+            return static_cast<int32_t>(kind) | (static_cast<int32_t>(op_) << 16) |
+                   (static_cast<int32_t>(lhsIsInt32_) << 24);
         }
 
       public:
         Compiler(JSContext *cx, JSOp op, bool lhsIsInt32)
           : ICStubCompiler(cx, ICStub::Compare_Int32WithBoolean),
             op_(op),
             lhsIsInt32_(lhsIsInt32)
         {}
@@ -2563,18 +2563,18 @@ class ICBinaryArith_Int32 : public ICStu
       protected:
         JSOp op_;
         bool allowDouble_;
 
         bool generateStubCode(MacroAssembler &masm);
 
         // Stub keys shift-stubs need to encode the kind, the JSOp and if we allow doubles.
         virtual int32_t getKey() const {
-            return (static_cast<int32_t>(kind) | (static_cast<int32_t>(op_) << 16) |
-                    (static_cast<int32_t>(allowDouble_) << 24));
+            return static_cast<int32_t>(kind) | (static_cast<int32_t>(op_) << 16) |
+                   (static_cast<int32_t>(allowDouble_) << 24);
         }
 
       public:
         Compiler(JSContext *cx, JSOp op, bool allowDouble)
           : ICStubCompiler(cx, ICStub::BinaryArith_Int32),
             op_(op), allowDouble_(allowDouble) {}
 
         ICStub *getStub(ICStubSpace *space) {
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -9245,18 +9245,18 @@ IonBuilder::getPropTryInnerize(bool *emi
 
 bool
 IonBuilder::needsToMonitorMissingProperties(types::TemporaryTypeSet *types)
 {
     // GetPropertyParIC and GetElementParIC cannot safely call
     // TypeScript::Monitor to ensure that the observed type set contains
     // undefined. To account for possible missing properties, which property
     // types do not track, we must always insert a type barrier.
-    return (info().executionMode() == ParallelExecution &&
-            !types->hasType(types::Type::UndefinedType()));
+    return info().executionMode() == ParallelExecution &&
+           !types->hasType(types::Type::UndefinedType());
 }
 
 bool
 IonBuilder::jsop_setprop(PropertyName *name)
 {
     MDefinition *value = current->pop();
     MDefinition *obj = current->pop();
 
--- a/js/src/jit/IonCaches.cpp
+++ b/js/src/jit/IonCaches.cpp
@@ -2981,20 +2981,20 @@ SetPropertyParIC::attachAddSlot(LockedJS
 }
 
 const size_t GetElementIC::MAX_FAILED_UPDATES = 16;
 
 /* static */ bool
 GetElementIC::canAttachGetProp(JSObject *obj, const Value &idval, jsid id)
 {
     uint32_t dummy;
-    return (obj->isNative() &&
-            idval.isString() &&
-            JSID_IS_ATOM(id) &&
-            !JSID_TO_ATOM(id)->isIndex(&dummy));
+    return obj->isNative() &&
+           idval.isString() &&
+           JSID_IS_ATOM(id) &&
+           !JSID_TO_ATOM(id)->isIndex(&dummy);
 }
 
 static bool
 EqualStringsHelper(JSString *str1, JSString *str2)
 {
     JS_ASSERT(str1->isAtom());
     JS_ASSERT(!str2->isAtom());
     JS_ASSERT(str1->length() == str2->length());
@@ -3557,18 +3557,18 @@ IsDenseElementSetInlineable(JSObject *ob
 
     return true;
 }
 
 static bool
 IsTypedArrayElementSetInlineable(JSObject *obj, const Value &idval, const Value &value)
 {
     // Don't bother attaching stubs for assigning strings and objects.
-    return (obj->is<TypedArrayObject>() && idval.isInt32() &&
-            !value.isString() && !value.isObject());
+    return obj->is<TypedArrayObject>() && idval.isInt32() &&
+           !value.isString() && !value.isObject();
 }
 
 static void
 StoreDenseElement(MacroAssembler &masm, ConstantOrRegister value, Register elements,
                   BaseIndex target)
 {
     // If the ObjectElements::CONVERT_DOUBLE_ELEMENTS flag is set, int32 values
     // have to be converted to double first. If the value is not int32, it can
--- a/js/src/jit/LiveRangeAllocator.h
+++ b/js/src/jit/LiveRangeAllocator.h
@@ -563,18 +563,18 @@ class VirtualRegisterMap
         return vregs_.length();
     }
 };
 
 static inline bool
 IsNunbox(VirtualRegister *vreg)
 {
 #ifdef JS_NUNBOX32
-    return (vreg->type() == LDefinition::TYPE ||
-            vreg->type() == LDefinition::PAYLOAD);
+    return vreg->type() == LDefinition::TYPE ||
+           vreg->type() == LDefinition::PAYLOAD;
 #else
     return false;
 #endif
 }
 
 static inline bool
 IsSlotsOrElements(VirtualRegister *vreg)
 {
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -7554,23 +7554,23 @@ class MStoreTypedArrayElement
     {
         return new(alloc) MStoreTypedArrayElement(elements, index, value, arrayType);
     }
 
     Scalar::Type arrayType() const {
         return arrayType_;
     }
     bool isByteArray() const {
-        return (arrayType_ == Scalar::Int8 ||
-                arrayType_ == Scalar::Uint8 ||
-                arrayType_ == Scalar::Uint8Clamped);
+        return arrayType_ == Scalar::Int8 ||
+               arrayType_ == Scalar::Uint8 ||
+               arrayType_ == Scalar::Uint8Clamped;
     }
     bool isFloatArray() const {
-        return (arrayType_ == Scalar::Float32 ||
-                arrayType_ == Scalar::Float64);
+        return arrayType_ == Scalar::Float32 ||
+               arrayType_ == Scalar::Float64;
     }
     TypePolicy *typePolicy() {
         return this;
     }
     MDefinition *elements() const {
         return getOperand(0);
     }
     MDefinition *index() const {
@@ -7627,23 +7627,23 @@ class MStoreTypedArrayElementHole
     {
         return new(alloc) MStoreTypedArrayElementHole(elements, length, index, value, arrayType);
     }
 
     Scalar::Type arrayType() const {
         return arrayType_;
     }
     bool isByteArray() const {
-        return (arrayType_ == Scalar::Int8 ||
-                arrayType_ == Scalar::Uint8 ||
-                arrayType_ == Scalar::Uint8Clamped);
+        return arrayType_ == Scalar::Int8 ||
+               arrayType_ == Scalar::Uint8 ||
+               arrayType_ == Scalar::Uint8Clamped;
     }
     bool isFloatArray() const {
-        return (arrayType_ == Scalar::Float32 ||
-                arrayType_ == Scalar::Float64);
+        return arrayType_ == Scalar::Float32 ||
+               arrayType_ == Scalar::Float64;
     }
     TypePolicy *typePolicy() {
         return this;
     }
     MDefinition *elements() const {
         return getOperand(0);
     }
     MDefinition *length() const {
@@ -7690,18 +7690,18 @@ class MStoreTypedArrayElementStatic :
     TypePolicy *typePolicy() {
         return this;
     }
 
     Scalar::Type viewType() const {
         return typedArray_->type();
     }
     bool isFloatArray() const {
-        return (viewType() == Scalar::Float32 ||
-                viewType() == Scalar::Float64);
+        return viewType() == Scalar::Float32 ||
+               viewType() == Scalar::Float64;
     }
 
     void *base() const;
     size_t length() const;
 
     MDefinition *ptr() const { return getOperand(0); }
     MDefinition *value() const { return getOperand(1); }
     AliasSet getAliasSet() const {
--- a/js/src/jit/ParallelFunctions.cpp
+++ b/js/src/jit/ParallelFunctions.cpp
@@ -118,18 +118,18 @@ jit::ParallelWriteGuard(ForkJoinContext 
 // without, but not straddling the target region nor encompassing
 // it. This invariant is maintained by the PJS APIs, where the target
 // region and handles are always elements of the same output array.
 bool
 jit::IsInTargetRegion(ForkJoinContext *cx, TypedObject *typedObj)
 {
     JS_ASSERT(typedObj->is<TypedObject>()); // in case JIT supplies something bogus
     uint8_t *typedMem = typedObj->typedMem();
-    return (typedMem >= cx->targetRegionStart &&
-            typedMem <  cx->targetRegionEnd);
+    return typedMem >= cx->targetRegionStart &&
+           typedMem <  cx->targetRegionEnd;
 }
 
 bool
 jit::CheckOverRecursedPar(ForkJoinContext *cx)
 {
     JS_ASSERT(ForkJoinContext::current() == cx);
     int stackDummy_;
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4327,19 +4327,19 @@ JS::OwningCompileOptions::copy(JSContext
 {
     copyPODOptions(rhs);
 
     setOriginPrincipals(rhs.originPrincipals(cx));
     setElement(rhs.element());
     setElementAttributeName(rhs.elementAttributeName());
     setIntroductionScript(rhs.introductionScript());
 
-    return (setFileAndLine(cx, rhs.filename(), rhs.lineno) &&
-            setSourceMapURL(cx, rhs.sourceMapURL()) &&
-            setIntroducerFilename(cx, rhs.introducerFilename()));
+    return setFileAndLine(cx, rhs.filename(), rhs.lineno) &&
+           setSourceMapURL(cx, rhs.sourceMapURL()) &&
+           setIntroducerFilename(cx, rhs.introducerFilename());
 }
 
 bool
 JS::OwningCompileOptions::setFile(JSContext *cx, const char *f)
 {
     char *copy = nullptr;
     if (f) {
         copy = JS_strdup(cx, f);
--- a/js/src/vm/Probes-inl.h
+++ b/js/src/vm/Probes-inl.h
@@ -30,18 +30,18 @@ probes::CallTrackingActive(JSContext *cx
         return true;
 #endif
     return false;
 }
 
 inline bool
 probes::WantNativeAddressInfo(JSContext *cx)
 {
-    return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
-            JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION);
+    return cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
+           JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION;
 }
 
 inline bool
 probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
                     InterpreterFrame *fp)
 {
 #ifdef INCLUDE_MOZILLA_DTRACE
     if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
--- a/js/xpconnect/src/XPCMaps.cpp
+++ b/js/xpconnect/src/XPCMaps.cpp
@@ -370,20 +370,20 @@ NativeSetMap::Entry::Match(PLDHashTable 
         // "All sets have exactly one nsISupports interface and it comes first."
         // See XPCNativeSet::NewInstance for details.
         //
         // Though we might have a key that represents only one interface, we
         // know that if that one interface were contructed into a set then
         // it would end up really being a set with two interfaces (except for
         // the case where the one interface happened to be nsISupports).
 
-        return ((SetInTable->GetInterfaceCount() == 1 &&
-                 SetInTable->GetInterfaceAt(0) == Addition) ||
-                (SetInTable->GetInterfaceCount() == 2 &&
-                 SetInTable->GetInterfaceAt(1) == Addition));
+        return (SetInTable->GetInterfaceCount() == 1 &&
+                SetInTable->GetInterfaceAt(0) == Addition) ||
+               (SetInTable->GetInterfaceCount() == 2 &&
+                SetInTable->GetInterfaceAt(1) == Addition);
     }
 
     if (!Addition && Set == SetInTable)
         return true;
 
     uint16_t count = Set->GetInterfaceCount() + (Addition ? 1 : 0);
     if (count != SetInTable->GetInterfaceCount())
         return false;