#include "config.h"
#include "ArrayPrototype.h"
+#include "CodeBlock.h"
#include "Interpreter.h"
#include "ObjectPrototype.h"
#include "Lookup.h"
namespace JSC {
+static inline bool isNumericCompareFunction(CallType callType, const CallData& callData)
+{
+ if (callType != CallTypeJS)
+ return false;
+
+ return callData.js.functionBody->bytecode(callData.js.scopeChain).isNumericCompareFunction();
+}
+
// ------------------------------ ArrayPrototype ----------------------------
const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::arrayTable};
CallType callType = function.getCallData(callData);
if (thisObj->classInfo() == &JSArray::info) {
- if (callType != CallTypeNone)
+ if (isNumericCompareFunction(callType, callData))
+ asArray(thisObj)->sortNumeric(exec, function, callType, callData);
+ else if (callType != CallTypeNone)
asArray(thisObj)->sort(exec, function, callType, callData);
else
asArray(thisObj)->sort(exec);