Bug 1259877 - Remove jsarray.cpp's now-unused SortComparatorFunction. r=mrrrgn
authorJeff Walden <jwalden@mit.edu>
Mon, 21 Mar 2016 15:51:01 -0700
changeset 290946 61f736c678a3e18794c219e71f10b785ed3225ce
parent 290945 de7e03fdff65b86744f8ce59b036ea86caf6df8d
child 290947 6a930fcdf2851da9aee3e042b29f85225eea6535
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrrrgn
bugs1259877
milestone48.0a1
Bug 1259877 - Remove jsarray.cpp's now-unused SortComparatorFunction. r=mrrrgn
js/src/jsarray.cpp
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1509,66 +1509,16 @@ struct SortComparatorStringifiedElements
         }
 
         return CompareSubStringValues(cx, sb.rawTwoByteBegin() + a.charsBegin, lenA,
                                       sb.rawTwoByteBegin() + b.charsBegin, lenB,
                                       lessOrEqualp);
     }
 };
 
-struct SortComparatorFunction
-{
-    JSContext*         const cx;
-    const Value&       fval;
-    FastInvokeGuard&   fig;
-
-    SortComparatorFunction(JSContext* cx, const Value& fval, FastInvokeGuard& fig)
-      : cx(cx), fval(fval), fig(fig) { }
-
-    bool operator()(const Value& a, const Value& b, bool* lessOrEqualp);
-};
-
-bool
-SortComparatorFunction::operator()(const Value& a, const Value& b, bool* lessOrEqualp)
-{
-    /*
-     * array_sort deals with holes and undefs on its own and they should not
-     * come here.
-     */
-    MOZ_ASSERT(!a.isMagic() && !a.isUndefined());
-    MOZ_ASSERT(!a.isMagic() && !b.isUndefined());
-
-    if (!CheckForInterrupt(cx))
-        return false;
-
-    InvokeArgs& args = fig.args();
-    if (!args.init(2))
-        return false;
-
-    args.setCallee(fval);
-    args.setThis(UndefinedValue());
-    args[0].set(a);
-    args[1].set(b);
-
-    if (!fig.invoke(cx))
-        return false;
-
-    double cmp;
-    if (!ToNumber(cx, args.rval(), &cmp))
-        return false;
-
-    /*
-     * XXX eport some kind of error here if cmp is NaN? ECMA talks about
-     * 'consistent compare functions' that don't return NaN, but is silent
-     * about what the result should be. So we currently ignore it.
-     */
-    *lessOrEqualp = (IsNaN(cmp) || cmp <= 0);
-    return true;
-}
-
 struct NumericElement
 {
     double dv;
     size_t elementIndex;
 };
 
 static bool
 ComparatorNumericLeftMinusRight(const NumericElement& a, const NumericElement& b,