Bug 1259877 - Remove jsarray.cpp's now-unused SortComparatorFunction. r=mrrrgn
--- 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,