summaryrefslogtreecommitdiffstats
path: root/src/array.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/array.js')
-rw-r--r--src/array.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/array.js b/src/array.js
index daa75d57..00a4fee5 100644
--- a/src/array.js
+++ b/src/array.js
@@ -823,7 +823,8 @@ function ArraySort(comparefn) {
var element = a[i];
var order = %_CallFunction(receiver, element, pivot, comparefn);
if (order < 0) {
- %_SwapElements(a, i, low_end);
+ a[i] = a[low_end];
+ a[low_end] = element;
low_end++;
} else if (order > 0) {
do {
@@ -832,9 +833,12 @@ function ArraySort(comparefn) {
var top_elem = a[high_start];
order = %_CallFunction(receiver, top_elem, pivot, comparefn);
} while (order > 0);
- %_SwapElements(a, i, high_start);
+ a[i] = a[high_start];
+ a[high_start] = element;
if (order < 0) {
- %_SwapElements(a, i, low_end);
+ element = a[i];
+ a[i] = a[low_end];
+ a[low_end] = element;
low_end++;
}
}