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

Unified Diff: test/mjsunit/es6/typedarray-sort.js

Issue 2733393002: [typedarrays] check byte offset for fast typedarray sort (Closed)
Patch Set: Use DataPtr Created 3 years, 9 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/runtime/runtime-typedarray.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/typedarray-sort.js
diff --git a/test/mjsunit/es6/typedarray-sort.js b/test/mjsunit/es6/typedarray-sort.js
index 4fb84690756c00cdd85a75423b448dae1ab141b3..9051a775d00d53548a39e99aee7fe1ff159f1072 100644
--- a/test/mjsunit/es6/typedarray-sort.js
+++ b/test/mjsunit/es6/typedarray-sort.js
@@ -52,4 +52,12 @@ for (var constructor of typedArrayConstructors) {
assertEquals(a.length, 1);
// Method doesn't work on other objects
assertThrows(function() { a.sort.call([]); }, TypeError);
+
+ // Do not touch elements out of byte offset
+ var buf = new ArrayBuffer(constructor.BYTES_PER_ELEMENT * 3);
+ var a = new constructor(buf, constructor.BYTES_PER_ELEMENT);
+ var b = new constructor(buf);
+ b[0] = 3; b[1] = 2; b[2] = 1;
+ a.sort();
+ assertArrayLikeEquals(a, [1, 2], constructor);
}
« no previous file with comments | « src/runtime/runtime-typedarray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698