Bug 1530879 - Update the test262 import to upstream rev 9280e1f872151f68cac99bc0c674527813a91cf9. r=jorendorff
authorJeff Walden <jwalden@mit.edu>
Tue, 26 Feb 2019 17:06:49 -0800
changeset 461667 846ec57d36ae0ad549c704809baaac59849cf47c
parent 461666 4f433cf2ba16e7a9521a2f27a7f25537c6fc44bc
child 461668 96045963f36cb3fab9eb79ef550aaa260735b540
push id35626
push usercsabou@mozilla.com
push dateThu, 28 Feb 2019 11:31:08 +0000
treeherdermozilla-central@2ea0c1db7e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1530879
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530879 - Update the test262 import to upstream rev 9280e1f872151f68cac99bc0c674527813a91cf9. r=jorendorff
js/src/tests/test262/GIT-INFO
js/src/tests/test262/built-ins/TypedArray/stability.js
--- a/js/src/tests/test262/GIT-INFO
+++ b/js/src/tests/test262/GIT-INFO
@@ -1,5 +1,7 @@
-commit e39604fa41b1ad0effdcf586e4d554ff2d8c3eb7
-Author: Timothy Gu <timothygu99@gmail.com>
-Date:   Thu Jan 31 09:49:27 2019 -0800
+commit 9280e1f872151f68cac99bc0c674527813a91cf9
+Author: Mathias Bynens <mathias@qiwi.be>
+Date:   Mon Feb 4 11:58:05 2019 -0700
 
-    Fix missing ) (#2059)
+    Add tests for %TypedArray%.prototype.sort stability (#2062)
+    
+    https://github.com/tc39/ecma262/pull/1433
new file mode 100644
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/stability.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2019 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Stability of %TypedArray%.prototype.sort.
+info: |
+  https://github.com/tc39/ecma262/pull/1433
+includes: [testTypedArray.js, compareArray.js]
+features: [TypedArray]
+---*/
+
+// Treat 0..3, 4..7, etc. as equal.
+const compare = (a, b) => (a / 4 | 0) - (b / 4 | 0);
+
+testWithTypedArrayConstructors((TA) => {
+  // Create an array of the form `[0, 1, …, 126, 127]`.
+  const array = Array.from({ length: 128 }, (_, i) => i);
+
+  const typedArray1 = new TA(array);
+  assert(compareArray(
+    typedArray1.sort(compare),
+    array
+  ), 'pre-sorted');
+
+  // Reverse `array` in-place so it becomes `[127, 126, …, 1, 0]`.
+  array.reverse();
+
+  const typedArray2 = new TA(array);
+  assert(compareArray(
+    typedArray2.sort(compare),
+    [
+        3,   2,   1,   0,     7,   6,   5,   4,    11,  10,   9,   8,
+       15,  14,  13,  12,    19,  18,  17,  16,    23,  22,  21,  20,
+       27,  26,  25,  24,    31,  30,  29,  28,    35,  34,  33,  32,
+       39,  38,  37,  36,    43,  42,  41,  40,    47,  46,  45,  44,
+       51,  50,  49,  48,    55,  54,  53,  52,    59,  58,  57,  56,
+       63,  62,  61,  60,    67,  66,  65,  64,    71,  70,  69,  68,
+       75,  74,  73,  72,    79,  78,  77,  76,    83,  82,  81,  80,
+       87,  86,  85,  84,    91,  90,  89,  88,    95,  94,  93,  92,
+       99,  98,  97,  96,   103, 102, 101, 100,   107, 106, 105, 104,
+      111, 110, 109, 108,   115, 114, 113, 112,   119, 118, 117, 116,
+      123, 122, 121, 120,   127, 126, 125, 124,
+    ]
+  ), 'not presorted');
+});
+
+reportCompare(0, 0);