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

Unified Diff: src/js/typedarray.js

Issue 2693043009: [typedarrays] sort in C++ for undefined comparefn (Closed)
Patch Set: [typedarrays] sort in C++ for no comparison function Created 3 years, 10 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 | « src/builtins/builtins-typedarray.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index 3777507235ef603a74c655a6f52560d4259d510f..ef1c1d29e711981220eb97b439b0e1ae0286f5a1 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -517,25 +517,6 @@ function TypedArrayReverse() {
return PackedArrayReverse(this, length);
}
-
-function TypedArrayComparefn(x, y) {
- if (x === 0 && x === y) {
- x = 1 / x;
- y = 1 / y;
- }
- if (x < y) {
- return -1;
- } else if (x > y) {
- return 1;
- } else if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) {
- return NUMBER_IS_NAN(y) ? 0 : 1;
- } else if (NUMBER_IS_NAN(x)) {
- return 1;
- }
- return 0;
-}
-
-
// ES6 draft 05-18-15, section 22.2.3.25
function TypedArraySort(comparefn) {
if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray);
@@ -543,7 +524,7 @@ function TypedArraySort(comparefn) {
var length = %_TypedArrayGetLength(this);
if (IS_UNDEFINED(comparefn)) {
- comparefn = TypedArrayComparefn;
+ return %TypedArraySortFast(this);
}
return InnerArraySort(this, length, comparefn);
« no previous file with comments | « src/builtins/builtins-typedarray.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698