OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 if (x === y) return 0; | 735 if (x === y) return 0; |
736 if (%_IsSmi(x) && %_IsSmi(y)) { | 736 if (%_IsSmi(x) && %_IsSmi(y)) { |
737 return %SmiLexicographicCompare(x, y); | 737 return %SmiLexicographicCompare(x, y); |
738 } | 738 } |
739 x = ToString(x); | 739 x = ToString(x); |
740 y = ToString(y); | 740 y = ToString(y); |
741 if (x == y) return 0; | 741 if (x == y) return 0; |
742 else return x < y ? -1 : 1; | 742 else return x < y ? -1 : 1; |
743 }; | 743 }; |
744 } | 744 } |
745 var receiver = | 745 var receiver = %GetDefaultReceiver(comparefn); |
746 %_IsNativeOrStrictMode(comparefn) ? void 0 : %GetGlobalReceiver(); | |
747 | 746 |
748 function InsertionSort(a, from, to) { | 747 function InsertionSort(a, from, to) { |
749 for (var i = from + 1; i < to; i++) { | 748 for (var i = from + 1; i < to; i++) { |
750 var element = a[i]; | 749 var element = a[i]; |
751 for (var j = i - 1; j >= from; j--) { | 750 for (var j = i - 1; j >= from; j--) { |
752 var tmp = a[j]; | 751 var tmp = a[j]; |
753 var order = %_CallFunction(receiver, tmp, element, comparefn); | 752 var order = %_CallFunction(receiver, tmp, element, comparefn); |
754 if (order > 0) { | 753 if (order > 0) { |
755 a[j + 1] = tmp; | 754 a[j + 1] = tmp; |
756 } else { | 755 } else { |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 InternalArray.prototype.join = getFunction("join", ArrayJoin); | 1359 InternalArray.prototype.join = getFunction("join", ArrayJoin); |
1361 InternalArray.prototype.pop = getFunction("pop", ArrayPop); | 1360 InternalArray.prototype.pop = getFunction("pop", ArrayPop); |
1362 InternalArray.prototype.push = getFunction("push", ArrayPush); | 1361 InternalArray.prototype.push = getFunction("push", ArrayPush); |
1363 InternalArray.prototype.toString = function() { | 1362 InternalArray.prototype.toString = function() { |
1364 return "Internal Array, length " + this.length; | 1363 return "Internal Array, length " + this.length; |
1365 }; | 1364 }; |
1366 } | 1365 } |
1367 | 1366 |
1368 | 1367 |
1369 SetupArray(); | 1368 SetupArray(); |
OLD | NEW |