Skip to content

Commit 98557fd

Browse files
authored
Merge branch 'master' into proxyenumerator
2 parents 5a373d5 + 04dc49a commit 98557fd

File tree

6 files changed

+12
-117
lines changed

6 files changed

+12
-117
lines changed

lib/Backend/SwitchIRBuilder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
44
//-------------------------------------------------------------------------------------------------------
55
#include "Backend.h"
6-
#include "DataStructures/quicksort.h"
76

87
///----------------------------------------------------------------------------
98
///

lib/Common/Core/ProfileMemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "CommonCorePch.h"
66

77
#ifdef PROFILE_MEM
8-
#include "DataStructures/quicksort.h"
98
#include "Memory/AutoPtr.h"
109
#include "Core/ProfileMemory.h"
1110

@@ -308,7 +307,8 @@ int MemoryProfiler::CreateArenaUsageSummary(ArenaAllocator * alloc, bool liveOnl
308307
{
309308
name[i++] = key;
310309
});
311-
JsUtil::QuickSort<LPWSTR, DefaultComparer<LPWSTR>>::Sort(name, name + (count - 1));
310+
311+
qsort_s(name, count, sizeof(LPWSTR), [](void*, const void* a, const void* b) { return DefaultComparer<LPWSTR>::Compare(*(LPWSTR*)a, *(LPWSTR*)b); }, nullptr);
312312

313313
summaries = AnewArray(alloc, ArenaMemoryDataSummary *, count);
314314

lib/Common/DataStructures/Chakra.Common.DataStructures.vcxproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
<ClInclude Include="KeyValuePair.h" />
8181
<ClInclude Include="LargeStack.h" />
8282
<ClInclude Include="List.h" />
83-
<ClInclude Include="quicksort.h" />
8483
<ClInclude Include="SimpleHashTable.h" />
8584
<ClInclude Include="SList.h" />
8685
<ClInclude Include="SparseArray.h" />
@@ -99,4 +98,4 @@
9998
</ItemGroup>
10099
<Import Project="$(BuildConfigPropsPath)Chakra.Build.targets" Condition="exists('$(BuildConfigPropsPath)Chakra.Build.targets')" />
101100
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
102-
</Project>
101+
</Project>

lib/Common/DataStructures/ImmutableList.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,9 @@ namespace regex
704704
return this;
705705
}
706706
auto arr = ToReferenceArrayInHeap(size);
707-
QuickSort<T *, true>::Sort(arr, arr+(size-1), comparer);
707+
qsort_s(arr, size, sizeof(T*), [](void* comparer, const void* a, const void* b) {
708+
return ((regex::Comparer<T *> *)comparer)->Compare(*(T**)a, *(T**)b);
709+
}, comparer);
708710

709711
// Convert the reference Array into the List
710712
auto result = (ImmutableList<T>*)(arr[0] - offsetof(ImmutableList<T>, value));
@@ -729,7 +731,9 @@ namespace regex
729731
return this;
730732
}
731733
auto arr = ToReferenceArrayInHeap(size);
732-
QuickSort<T *, true>::Sort(arr, arr+(size-1), comparer);
734+
qsort_s(arr, size, sizeof(T*), [](void* comparer, const void* a, const void* b) {
735+
return ((regex::Comparer<T *> *)comparer)->Compare(*(T**)a, *(T**)b);
736+
}, comparer);
733737

734738
// Convert the reference Array into the List
735739
auto result = (ImmutableList<T>*)(arr[0] - offsetof(ImmutableList<T>, value));

lib/Common/DataStructures/List.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,9 @@ namespace JsUtil
479479

480480
void Sort()
481481
{
482-
// We can call QSort only if the remove policy for this list is CopyRemovePolicy
483-
CompileAssert((IsSame<TRemovePolicyType, Js::CopyRemovePolicy<TListType, false> >::IsTrue) ||
484-
(IsSame<TRemovePolicyType, Js::CopyRemovePolicy<TListType, true> >::IsTrue));
485-
if(this->count)
486-
{
487-
JsUtil::QuickSort<T, TComparerType>::Sort(this->buffer, this->buffer + (this->count - 1));
488-
}
482+
Sort([](void *, const void * a, const void * b) {
483+
return TComparerType::Compare(*(T*)a, *(T*)b);
484+
}, nullptr);
489485
}
490486

491487
void Sort(int(__cdecl * _PtFuncCompare)(void *, const void *, const void *), void *_Context)

lib/Common/DataStructures/quicksort.h

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)