Reviewers: Benedikt Meurer,

Message:
PTAL

Description:
Removing %_CallFunction in GetThirdIndex
By using an InternArray for the pivot calculation we can get rid of yet
another %_CallFunction

BUG=

Please review this at https://codereview.chromium.org/1316673008/

Base URL: https://chromium.googlesource.com/v8/v8.git@2015-09-09_CallFunction_cleanup_1325573004

Affected files (+8, -4 lines):
  M src/array.js


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;
   }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to