mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 01:59:58 +00:00
Array.sort 增加开关
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IB5ZD1?from=project-issue Signed-off-by: 刘智杰 <liuzhijie9@huawei.com> Change-Id: I6b961a1fa6afe04ed02887b56f5d89115043bfe6
This commit is contained in:
parent
732cc7d079
commit
a990cdf41d
@ -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