Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: src/array.js

Issue 1316673008: [builtins] Removing %_CallFunction in GetThirdIndex. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-09-09_CallFunction_cleanup_1325573004
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index 26f050d71065f8489a20815b1db74edb2f99e32f..0c4985ed86aed8e22a9ee3b7fa055da761778743 100644
--- a/src/array.js
+++ b/src/array.js
@@ -915,15 +915,19 @@ function InnerArraySort(array, length, comparefn) {
};
var GetThirdIndex = function(a, from, to) {
- var t_array = [];
+ var t_array = new InternalArray();
// Use both 'from' and 'to' to determine the pivot candidates.
var increment = 200 + ((to - from) & 15);
- for (var i = from + 1, j = 0; i < to - 1; i += increment, j++) {
+ var j = 0;
+ from += 1;
+ to -= 1;
+ for (var i = from; i < to; i += increment) {
t_array[j] = [i, a[i]];
+ j++;
}
- %_CallFunction(t_array, function(a, b) {
+ t_array.sort(function(a, b) {
return comparefn(a[1], b[1]);
- }, ArraySort);
+ });
var third_index = t_array[t_array.length >> 1][0];
return third_index;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698