mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 01:59:58 +00:00
commit
069558e438
@ -2392,11 +2392,19 @@ JSTaggedValue BuiltinsArray::Sort(EcmaRuntimeCallInfo *argv)
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
// Array sort
|
||||
#if ENABLE_NEXT_OPTIMIZATION
|
||||
if (thisHandle->IsStableJSArray(thread)) {
|
||||
JSStableArray::Sort(thread, thisHandle, callbackFnHandle);
|
||||
} else {
|
||||
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
||||
}
|
||||
#else
|
||||
if (thisHandle->IsStableJSArray(thread) && callbackFnHandle->IsUndefined()) {
|
||||
JSArray::SortElementsByObject(thread, thisObjHandle, callbackFnHandle);
|
||||
} else {
|
||||
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
||||
}
|
||||
#endif
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return thisObjHandle.GetTaggedValue();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user