Bug 1054334 - SpiderMonkey: Use static and internal name linkage for more symbols r=nbp
authorDan Gohman <sunfish@mozilla.com>
Mon, 18 Aug 2014 12:20:41 -0700
changeset 200215 b01844af31c986f08379e826d745a525e19d20c4
parent 200214 c9b218c047fa70bd8872f5f77c54f47b85422035
child 200216 3074b8e53bc6948a9d956fb28054c305e16a342e
push id8272
push useremorley@mozilla.com
push dateTue, 19 Aug 2014 14:17:45 +0000
treeherderfx-team@a955e211bfde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1054334
milestone34.0a1
Bug 1054334 - SpiderMonkey: Use static and internal name linkage for more symbols r=nbp
js/src/jsarray.cpp
js/src/jsweakmap.cpp
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1412,19 +1412,17 @@ array_reverse(JSContext *cx, unsigned ar
         } else {
             // No action required.
         }
     }
     args.rval().setObject(*obj);
     return true;
 }
 
-namespace {
-
-inline bool
+static inline bool
 CompareStringValues(JSContext *cx, const Value &a, const Value &b, bool *lessOrEqualp)
 {
     if (!CheckForInterrupt(cx))
         return false;
 
     JSString *astr = a.toString();
     JSString *bstr = b.toString();
     int32_t result;
@@ -1508,16 +1506,18 @@ CompareSubStringValues(JSContext *cx, co
     if (!s1 || !s2)
         return false;
 
     int32_t result = CompareChars(s1, len1, s2, len2);
     *lessOrEqualp = (result <= 0);
     return true;
 }
 
+namespace {
+
 struct SortComparatorStrings
 {
     JSContext   *const cx;
 
     explicit SortComparatorStrings(JSContext *cx)
       : cx(cx) {}
 
     bool operator()(const Value &a, const Value &b, bool *lessOrEqualp) {
@@ -1614,25 +1614,25 @@ SortComparatorFunction::operator()(const
 }
 
 struct NumericElement
 {
     double dv;
     size_t elementIndex;
 };
 
-bool
+static bool
 ComparatorNumericLeftMinusRight(const NumericElement &a, const NumericElement &b,
                                 bool *lessOrEqualp)
 {
     *lessOrEqualp = (a.dv <= b.dv);
     return true;
 }
 
-bool
+static bool
 ComparatorNumericRightMinusLeft(const NumericElement &a, const NumericElement &b,
                                 bool *lessOrEqualp)
 {
     *lessOrEqualp = (b.dv <= a.dv);
     return true;
 }
 
 typedef bool (*ComparatorNumeric)(const NumericElement &a, const NumericElement &b,
@@ -1640,24 +1640,24 @@ typedef bool (*ComparatorNumeric)(const 
 
 ComparatorNumeric SortComparatorNumerics[] = {
     nullptr,
     nullptr,
     ComparatorNumericLeftMinusRight,
     ComparatorNumericRightMinusLeft
 };
 
-bool
+static bool
 ComparatorInt32LeftMinusRight(const Value &a, const Value &b, bool *lessOrEqualp)
 {
     *lessOrEqualp = (a.toInt32() <= b.toInt32());
     return true;
 }
 
-bool
+static bool
 ComparatorInt32RightMinusLeft(const Value &a, const Value &b, bool *lessOrEqualp)
 {
     *lessOrEqualp = (b.toInt32() <= a.toInt32());
     return true;
 }
 
 typedef bool (*ComparatorInt32)(const Value &a, const Value &b, bool *lessOrEqualp);
 
@@ -1672,21 +1672,23 @@ ComparatorInt32 SortComparatorInt32s[] =
 // and SortComparatorInt32s.
 enum ComparatorMatchResult {
     Match_Failure = 0,
     Match_None,
     Match_LeftMinusRight,
     Match_RightMinusLeft
 };
 
+} /* namespace anonymous */
+
 /*
  * Specialize behavior for comparator functions with particular common bytecode
  * patterns: namely, |return x - y| and |return y - x|.
  */
-ComparatorMatchResult
+static ComparatorMatchResult
 MatchNumericComparator(JSContext *cx, const Value &v)
 {
     if (!v.isObject())
         return Match_None;
 
     JSObject &obj = v.toObject();
     if (!obj.is<JSFunction>())
         return Match_None;
@@ -1774,17 +1776,17 @@ MergeSortByKey(K keys, size_t len, K scr
 }
 
 /*
  * Sort Values as strings.
  *
  * To minimize #conversions, SortLexicographically() first converts all Values
  * to strings at once, then sorts the elements by these cached strings.
  */
-bool
+static bool
 SortLexicographically(JSContext *cx, AutoValueVector *vec, size_t len)
 {
     JS_ASSERT(vec->length() >= len);
 
     StringBuffer sb(cx);
     Vector<StringifiedElement, 0, TempAllocPolicy> strElements(cx);
 
     /* MergeSort uses the upper half as scratch space. */
@@ -1814,17 +1816,17 @@ SortLexicographically(JSContext *cx, Aut
 }
 
 /*
  * Sort Values as numbers.
  *
  * To minimize #conversions, SortNumerically first converts all Values to
  * numerics at once, then sorts the elements by these cached numerics.
  */
-bool
+static bool
 SortNumerically(JSContext *cx, AutoValueVector *vec, size_t len, ComparatorMatchResult comp)
 {
     JS_ASSERT(vec->length() >= len);
 
     Vector<NumericElement, 0, TempAllocPolicy> numElements(cx);
 
     /* MergeSort uses the upper half as scratch space. */
     if (!numElements.reserve(2 * len))
@@ -1846,18 +1848,16 @@ SortNumerically(JSContext *cx, AutoValue
     /* Resize strElements so we can perform MergeSort. */
     JS_ALWAYS_TRUE(numElements.resize(2 * len));
 
     /* Sort Values in vec numerically. */
     return MergeSortByKey(numElements.begin(), len, numElements.begin() + len,
                           SortComparatorNumerics[comp], vec);
 }
 
-} /* namespace anonymous */
-
 bool
 js::array_sort(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedValue fvalRoot(cx);
     Value &fval = fvalRoot.get();
 
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -363,17 +363,17 @@ WeakMapPostWriteBarrier(JSRuntime *rt, O
     UnbarrieredMap *unbarrieredMap = reinterpret_cast<UnbarrieredMap *>(baseHashMap);
 
     typedef HashKeyRef<UnbarrieredMap, JSObject *> Ref;
     if (key && IsInsideNursery(key))
         rt->gc.storeBuffer.putGeneric(Ref((unbarrieredMap), key));
 #endif
 }
 
-MOZ_ALWAYS_INLINE bool
+static MOZ_ALWAYS_INLINE bool
 SetWeakMapEntryInternal(JSContext *cx, Handle<WeakMapObject*> mapObj,
                         HandleObject key, HandleValue value)
 {
     ObjectValueMap *map = mapObj->getMap();
     if (!map) {
         map = cx->new_<ObjectValueMap>(cx, mapObj.get());
         if (!map)
             return false;