diff --git a/JSTests/microbenchmarks/double-to-string.js b/JSTests/microbenchmarks/double-to-string.js new file mode 100644 index 0000000000000..e25fa6998df35 --- /dev/null +++ b/JSTests/microbenchmarks/double-to-string.js @@ -0,0 +1,7 @@ +function test(num) { + return num + 'px'; +} +noInline(test); + +for (var i = 0; i < 1e6; ++i) + test(i + 30.4); diff --git a/JSTests/microbenchmarks/js-map-get-int-no-dfg-no-inline.js b/JSTests/microbenchmarks/js-map-get-int-no-dfg-no-inline.js new file mode 100644 index 0000000000000..4dd9502c017c9 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-get-int-no-dfg-no-inline.js @@ -0,0 +1,24 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} +noDFG(testSet); +noInline(testSet); + +function testGet(m, k) { + m.get(k); +} +noDFG(testGet); +noInline(testGet); + +let count = 1e4; +for (let i = 0; i < count; ++i) { + testSet(m, i, i); +} + +for (let i = 0; i < count; ++i) { + for (let j = 0; j < 20; j++) { + testGet(m, i, i); + } +} \ No newline at end of file diff --git a/JSTests/microbenchmarks/js-map-get-int.js b/JSTests/microbenchmarks/js-map-get-int.js new file mode 100644 index 0000000000000..9928776705bd8 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-get-int.js @@ -0,0 +1,21 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} + +function testGet(m, k) { + m.get(k); +} + +let count = 1e4; +for (let i = 0; i < count; ++i) { + testSet(m, i, i); +} + +for (let i = 0; i < count; ++i) { + for (let j = 0; j < 20; j++) { + testGet(m, i, i); + } +} + diff --git a/JSTests/microbenchmarks/js-map-get-string-no-dfg-no-inline.js b/JSTests/microbenchmarks/js-map-get-string-no-dfg-no-inline.js new file mode 100644 index 0000000000000..c853f874c82ad --- /dev/null +++ b/JSTests/microbenchmarks/js-map-get-string-no-dfg-no-inline.js @@ -0,0 +1,27 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} +noDFG(testSet); +noInline(testSet); + +function testGet(m, k) { + m.get(k); +} +noDFG(testGet); +noInline(testGet); + +let count = 1e4; +for (let i = 0; i < count; ++i) { + let s = i.toString(); + testSet(m, s, s); +} + +for (let i = 0; i < count; ++i) { + let s = i.toString(); + for (let j = 0; j < 20; j++) { + testGet(m, s); + } +} + diff --git a/JSTests/microbenchmarks/js-map-get-string.js b/JSTests/microbenchmarks/js-map-get-string.js new file mode 100644 index 0000000000000..1786e2e9c0f88 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-get-string.js @@ -0,0 +1,22 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} + +function testGet(m, k) { + m.get(k); +} + +let count = 1e4; +for (let i = 0; i < count; ++i) { + let s = i.toString(); + testSet(m, s, s); +} + +for (let i = 0; i < count; ++i) { + let s = i.toString(); + for (let j = 0; j < 20; j++) { + testGet(m, s); + } +} \ No newline at end of file diff --git a/JSTests/microbenchmarks/js-map-set-int-no-dfg-no-inline.js b/JSTests/microbenchmarks/js-map-set-int-no-dfg-no-inline.js new file mode 100644 index 0000000000000..dacec966a85c2 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-set-int-no-dfg-no-inline.js @@ -0,0 +1,12 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} +noDFG(testSet); +noInline(testSet); + +let count = 1e4; +for (let i = 0; i < count; ++i) { + testSet(m, i, i); +} diff --git a/JSTests/microbenchmarks/js-map-set-int.js b/JSTests/microbenchmarks/js-map-set-int.js new file mode 100644 index 0000000000000..5c306d1f335e4 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-set-int.js @@ -0,0 +1,10 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} + +let count = 1e4; +for (let i = 0; i < count; ++i) { + testSet(m, i, i); +} diff --git a/JSTests/microbenchmarks/js-map-set-string-no-dfg-no-inline.js b/JSTests/microbenchmarks/js-map-set-string-no-dfg-no-inline.js new file mode 100644 index 0000000000000..12f321047cc04 --- /dev/null +++ b/JSTests/microbenchmarks/js-map-set-string-no-dfg-no-inline.js @@ -0,0 +1,13 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} +noDFG(testSet); +noInline(testSet); + +let count = 1e4; +for (let i = 0; i < count; ++i) { + let s = i.toString(); + testSet(m, s, s); +} diff --git a/JSTests/microbenchmarks/js-map-set-string.js b/JSTests/microbenchmarks/js-map-set-string.js new file mode 100644 index 0000000000000..2a4b4252fe26f --- /dev/null +++ b/JSTests/microbenchmarks/js-map-set-string.js @@ -0,0 +1,11 @@ +let m = new Map(); + +function testSet(m, k, v) { + m.set(k, v); +} + +let count = 1e4; +for (let i = 0; i < count; ++i) { + let s = i.toString(); + testSet(m, s, s); +} diff --git a/JSTests/microbenchmarks/to-hex.js b/JSTests/microbenchmarks/to-hex.js new file mode 100644 index 0000000000000..4db16e3a0906e --- /dev/null +++ b/JSTests/microbenchmarks/to-hex.js @@ -0,0 +1,14 @@ +//@ requireOptions("--useUint8ArrayBase64Methods=1") + +function test(buffer) +{ + return buffer.toHex(); +} +noInline(test); + +let buffer = new Uint8Array(16 * 1024); +for (let i = 0; i < buffer.length; ++i) + buffer[i] = i & 0xff; + +for (let i = 0; i < 1e4; ++i) + test(buffer); diff --git a/JSTests/stress/double-to-string.js b/JSTests/stress/double-to-string.js new file mode 100644 index 0000000000000..a412dff3d8ee2 --- /dev/null +++ b/JSTests/stress/double-to-string.js @@ -0,0 +1,12 @@ +function shouldBe(actual, expected) { + if (actual !== expected) + throw new Error('bad value: ' + actual); +} + +function test(num) { + return num + 'px'; +} +noInline(test); + +for (var i = 0; i < 1e6; ++i) + shouldBe(test(i + 30.4), (i + 30.4) + 'px'); diff --git a/JSTests/stress/map-iterators-next-2.js b/JSTests/stress/map-iterators-next-2.js new file mode 100644 index 0000000000000..654403fd43bd9 --- /dev/null +++ b/JSTests/stress/map-iterators-next-2.js @@ -0,0 +1,110 @@ +function assert(b) { + if (!b) + throw new Error("Bad result!"); +} +noInline(assert); + +let item1 = [1, 2]; +let item2 = [3, 4]; + +{ + let map = new Map(); + let iterator = map[Symbol.iterator](); + map.set(item1[0], item1[1]); + let element = iterator.next(); + + assert(element.done == false); + assert(element.value[0] == item1[0]); +} + +{ + let map = new Map([item1]); + let iterator = map[Symbol.iterator](); + map.set(item2[0], item2[1]); + let element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item1[0]); + + element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item2[0]); +} + +{ + let map = new Map([item1]); + let iterator = map[Symbol.iterator](); + map.delete(item1[0]); + + let element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let map = new Map([item1, item2]); + let iterator = map[Symbol.iterator](); + map.delete(item2[0]); + + let element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item1[0]); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let map = new Map([item1, item2]); + let iterator = map[Symbol.iterator](); + + let element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item1[0]); + + element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item2[0]); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let map = new Map([item1]); + let iterator = map[Symbol.iterator](); + map.clear(); + + let element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + map.set(item1[0], item1[1]); + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let map = new Map([item1]); + let iterator = map[Symbol.iterator](); + map.clear(); + + map.set(item1[0], item1[1]); + element = iterator.next(); + assert(element.done == false); + assert(element.value[0] == item1[0]); +} diff --git a/JSTests/stress/set-iterators-next-2.js b/JSTests/stress/set-iterators-next-2.js new file mode 100644 index 0000000000000..cbb35f8668ce2 --- /dev/null +++ b/JSTests/stress/set-iterators-next-2.js @@ -0,0 +1,110 @@ +function assert(b) { + if (!b) + throw new Error("Bad result!"); +} +noInline(assert); + +let item1 = 1; +let item2 = 2; + +{ + let set = new Set(); + let iterator = set[Symbol.iterator](); + set.add(item1); + let element = iterator.next(); + + assert(element.done == false); + assert(element.value == item1); +} + +{ + let set = new Set([item1]); + let iterator = set[Symbol.iterator](); + set.add(item2); + let element = iterator.next(); + assert(element.done == false); + assert(element.value == item1); + + element = iterator.next(); + assert(element.done == false); + assert(element.value == item2); +} + +{ + let set = new Set([item1]); + let iterator = set[Symbol.iterator](); + set.delete(item1); + + let element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let set = new Set([item1, item2]); + let iterator = set[Symbol.iterator](); + set.delete(item2); + + let element = iterator.next(); + assert(element.done == false); + assert(element.value == item1); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let set = new Set([item1, item2]); + let iterator = set[Symbol.iterator](); + + let element = iterator.next(); + assert(element.done == false); + assert(element.value == item1); + + element = iterator.next(); + assert(element.done == false); + assert(element.value == item2); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let set = new Set([item1]); + let iterator = set[Symbol.iterator](); + set.clear(); + + let element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); + + set.add(item1); + element = iterator.next(); + assert(element.done == true); + assert(element.value == undefined); +} + +{ + let set = new Set([item1]); + let iterator = set[Symbol.iterator](); + set.clear(); + + set.add(item1); + element = iterator.next(); + assert(element.done == false); + assert(element.value == item1); +} diff --git a/JSTests/stress/uint8array-toBase64.js b/JSTests/stress/uint8array-toBase64.js new file mode 100644 index 0000000000000..0cc55819d5824 --- /dev/null +++ b/JSTests/stress/uint8array-toBase64.js @@ -0,0 +1,258 @@ +//@ requireOptions("--useUint8ArrayBase64Methods=1") + +function shouldBe(actual, expected) { + if (actual !== expected) + throw new Error(`FAIL: expected '${expected}' actual '${actual}'`); +} + +shouldBe((new Uint8Array([])).toBase64(), ""); +shouldBe((new Uint8Array([0])).toBase64(), "AA=="); +shouldBe((new Uint8Array([1])).toBase64(), "AQ=="); +shouldBe((new Uint8Array([128])).toBase64(), "gA=="); +shouldBe((new Uint8Array([254])).toBase64(), "/g=="); +shouldBe((new Uint8Array([255])).toBase64(), "/w=="); +shouldBe((new Uint8Array([0, 1])).toBase64(), "AAE="); +shouldBe((new Uint8Array([254, 255])).toBase64(), "/v8="); +shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64(), "AAGA/v8="); + +shouldBe((new Uint8Array([])).toBase64({}), ""); +shouldBe((new Uint8Array([0])).toBase64({}), "AA=="); +shouldBe((new Uint8Array([1])).toBase64({}), "AQ=="); +shouldBe((new Uint8Array([128])).toBase64({}), "gA=="); +shouldBe((new Uint8Array([254])).toBase64({}), "/g=="); +shouldBe((new Uint8Array([255])).toBase64({}), "/w=="); +shouldBe((new Uint8Array([0, 1])).toBase64({}), "AAE="); +shouldBe((new Uint8Array([254, 255])).toBase64({}), "/v8="); +shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({}), "AAGA/v8="); + +for (let omitPadding of [undefined, null, false, 0, ""]) { + shouldBe((new Uint8Array([])).toBase64({omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({omitPadding}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({omitPadding}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({omitPadding}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({omitPadding}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({omitPadding}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({omitPadding}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({omitPadding}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({omitPadding}), "AAGA/v8="); + + shouldBe((new Uint8Array([])).toBase64({get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get omitPadding() { return omitPadding; }}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({get omitPadding() { return omitPadding; }}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({get omitPadding() { return omitPadding; }}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({get omitPadding() { return omitPadding; }}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({get omitPadding() { return omitPadding; }}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({get omitPadding() { return omitPadding; }}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({get omitPadding() { return omitPadding; }}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get omitPadding() { return omitPadding; }}), "AAGA/v8="); +} + +for (let omitPadding of [true, 42, "test", [], {}]) { + shouldBe((new Uint8Array([])).toBase64({omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({omitPadding}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({omitPadding}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({omitPadding}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({omitPadding}), "/g"); + shouldBe((new Uint8Array([255])).toBase64({omitPadding}), "/w"); + shouldBe((new Uint8Array([0, 1])).toBase64({omitPadding}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({omitPadding}), "/v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({omitPadding}), "AAGA/v8"); + + shouldBe((new Uint8Array([])).toBase64({get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get omitPadding() { return omitPadding; }}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({get omitPadding() { return omitPadding; }}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({get omitPadding() { return omitPadding; }}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({get omitPadding() { return omitPadding; }}), "/g"); + shouldBe((new Uint8Array([255])).toBase64({get omitPadding() { return omitPadding; }}), "/w"); + shouldBe((new Uint8Array([0, 1])).toBase64({get omitPadding() { return omitPadding; }}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({get omitPadding() { return omitPadding; }}), "/v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get omitPadding() { return omitPadding; }}), "AAGA/v8"); +} + +for (let alphabet of [undefined, "base64"]) { + shouldBe((new Uint8Array([])).toBase64({alphabet}), ""); + shouldBe((new Uint8Array([0])).toBase64({alphabet}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({alphabet}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({alphabet}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({alphabet}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({alphabet}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({alphabet}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({alphabet}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet}), "AAGA/v8="); + + shouldBe((new Uint8Array([])).toBase64({get alphabet() { return alphabet; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return alphabet; }}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return alphabet; }}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return alphabet; }}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return alphabet; }}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return alphabet; }}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return alphabet; }}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return alphabet; }}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return alphabet; }}), "AAGA/v8="); + + for (let omitPadding of [undefined, null, false, 0, ""]) { + shouldBe((new Uint8Array([])).toBase64({alphabet, omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({alphabet, omitPadding}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({alphabet, omitPadding}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({alphabet, omitPadding}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({alphabet, omitPadding}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({alphabet, omitPadding}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({alphabet, omitPadding}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({alphabet, omitPadding}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet, omitPadding}), "AAGA/v8="); + + shouldBe((new Uint8Array([])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/g=="); + shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AAGA/v8="); + } + + for (let omitPadding of [true, 42, "test", [], {}]) { + shouldBe((new Uint8Array([])).toBase64({alphabet, omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({alphabet, omitPadding}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({alphabet, omitPadding}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({alphabet, omitPadding}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({alphabet, omitPadding}), "/g"); + shouldBe((new Uint8Array([255])).toBase64({alphabet, omitPadding}), "/w"); + shouldBe((new Uint8Array([0, 1])).toBase64({alphabet, omitPadding}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({alphabet, omitPadding}), "/v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet, omitPadding}), "AAGA/v8"); + + shouldBe((new Uint8Array([])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/g"); + shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/w"); + shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "/v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return alphabet; }, get omitPadding() { return omitPadding; }}), "AAGA/v8"); + } +} + +shouldBe((new Uint8Array([])).toBase64({alphabet: "base64url"}), ""); +shouldBe((new Uint8Array([0])).toBase64({alphabet: "base64url"}), "AA=="); +shouldBe((new Uint8Array([1])).toBase64({alphabet: "base64url"}), "AQ=="); +shouldBe((new Uint8Array([128])).toBase64({alphabet: "base64url"}), "gA=="); +shouldBe((new Uint8Array([254])).toBase64({alphabet: "base64url"}), "_g=="); +shouldBe((new Uint8Array([255])).toBase64({alphabet: "base64url"}), "_w=="); +shouldBe((new Uint8Array([0, 1])).toBase64({alphabet: "base64url"}), "AAE="); +shouldBe((new Uint8Array([254, 255])).toBase64({alphabet: "base64url"}), "_v8="); +shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet: "base64url"}), "AAGA_v8="); + +shouldBe((new Uint8Array([])).toBase64({get alphabet() { return "base64url"; }}), ""); +shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return "base64url"; }}), "AA=="); +shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return "base64url"; }}), "AQ=="); +shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return "base64url"; }}), "gA=="); +shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return "base64url"; }}), "_g=="); +shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return "base64url"; }}), "_w=="); +shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return "base64url"; }}), "AAE="); +shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return "base64url"; }}), "_v8="); +shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return "base64url"; }}), "AAGA_v8="); + +for (let omitPadding of [undefined, null, false, 0, ""]) { + shouldBe((new Uint8Array([])).toBase64({alphabet: "base64url", omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({alphabet: "base64url", omitPadding}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({alphabet: "base64url", omitPadding}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({alphabet: "base64url", omitPadding}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({alphabet: "base64url", omitPadding}), "_g=="); + shouldBe((new Uint8Array([255])).toBase64({alphabet: "base64url", omitPadding}), "_w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({alphabet: "base64url", omitPadding}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({alphabet: "base64url", omitPadding}), "_v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet: "base64url", omitPadding}), "AAGA_v8="); + + shouldBe((new Uint8Array([])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AA=="); + shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AQ=="); + shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "gA=="); + shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_g=="); + shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_w=="); + shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AAE="); + shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_v8="); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AAGA_v8="); +} + +for (let omitPadding of [true, 42, "test", [], {}]) { + shouldBe((new Uint8Array([])).toBase64({alphabet: "base64url", omitPadding}), ""); + shouldBe((new Uint8Array([0])).toBase64({alphabet: "base64url", omitPadding}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({alphabet: "base64url", omitPadding}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({alphabet: "base64url", omitPadding}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({alphabet: "base64url", omitPadding}), "_g"); + shouldBe((new Uint8Array([255])).toBase64({alphabet: "base64url", omitPadding}), "_w"); + shouldBe((new Uint8Array([0, 1])).toBase64({alphabet: "base64url", omitPadding}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({alphabet: "base64url", omitPadding}), "_v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({alphabet: "base64url", omitPadding}), "AAGA_v8"); + + shouldBe((new Uint8Array([])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), ""); + shouldBe((new Uint8Array([0])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AA"); + shouldBe((new Uint8Array([1])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AQ"); + shouldBe((new Uint8Array([128])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "gA"); + shouldBe((new Uint8Array([254])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_g"); + shouldBe((new Uint8Array([255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_w"); + shouldBe((new Uint8Array([0, 1])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AAE"); + shouldBe((new Uint8Array([254, 255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "_v8"); + shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toBase64({get alphabet() { return "base64url"; }, get omitPadding() { return omitPadding; }}), "AAGA_v8"); +} + +try { + let uint8array = new Uint8Array; + $.detachArrayBuffer(uint8array.buffer); + uint8array.toBase64(); +} catch (e) { + shouldBe(e instanceof TypeError, true); +} + +for (let alphabet of [undefined, "base64", "base64url"]) { + try { + let uint8array = new Uint8Array; + uint8array.toBase64({ + get alphabet() { + $.detachArrayBuffer(uint8array.buffer); + return alphabet; + }, + }); + } catch (e) { + shouldBe(e instanceof TypeError, true); + } + + try { + (new Uint8Array).toBase64({ + alphabet: { + toString() { + return alphabet; + }, + }, + }); + } catch (e) { + shouldBe(e instanceof TypeError, true); + } +} + +for (let options of [undefined, null, false, true, 42, "test", []]) { + try { + (new Uint8Array).toBase64(options); + } catch (e) { + shouldBe(e instanceof TypeError, true); + } +} + +for (let alphabet of [null, false, true, 42, "invalid", {}, []]) { + try { + (new Uint8Array).toBase64({alphabet}); + } catch (e) { + shouldBe(e instanceof TypeError, true); + } + + try { + (new Uint8Array).toBase64({ + get alphabet() { return alphabet; }, + }); + } catch (e) { + shouldBe(e instanceof TypeError, true); + } +} diff --git a/JSTests/stress/uint8array-toHex.js b/JSTests/stress/uint8array-toHex.js new file mode 100644 index 0000000000000..6a6fdabf1aecb --- /dev/null +++ b/JSTests/stress/uint8array-toHex.js @@ -0,0 +1,43 @@ +//@ requireOptions("--useUint8ArrayBase64Methods=1") + +function shouldBe(actual, expected) { + if (actual !== expected) + throw new Error(`FAIL: expected '${expected}' actual '${actual}'`); +} + +shouldBe((new Uint8Array([])).toHex(), ""); +shouldBe((new Uint8Array([0])).toHex(), "00"); +shouldBe((new Uint8Array([1])).toHex(), "01"); +shouldBe((new Uint8Array([128])).toHex(), "80"); +shouldBe((new Uint8Array([254])).toHex(), "fe"); +shouldBe((new Uint8Array([255])).toHex(), "ff"); +shouldBe((new Uint8Array([0, 1])).toHex(), "0001"); +shouldBe((new Uint8Array([254, 255])).toHex(), "feff"); +shouldBe((new Uint8Array([0, 1, 128, 254, 255])).toHex(), "000180feff"); + +{ + let expected = '' + let buffer = new Uint8Array(16 * 1024); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = i & 0xff; + expected += (i & 0xff).toString(16).padStart(2, '0'); + } + shouldBe(buffer.toHex(), expected); +} +{ + let expected = '' + let buffer = new Uint8Array(15); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = i & 0xff; + expected += (i & 0xff).toString(16).padStart(2, '0'); + } + shouldBe(buffer.toHex(), expected); +} + +try { + let uint8array = new Uint8Array; + $.detachArrayBuffer(uint8array.buffer); + uint8array.toHex(); +} catch (e) { + shouldBe(e instanceof TypeError, true); +} diff --git a/JSTests/test262/expectations.yaml b/JSTests/test262/expectations.yaml index eef4ff6f5d9a9..ecb2363f32c67 100644 --- a/JSTests/test262/expectations.yaml +++ b/JSTests/test262/expectations.yaml @@ -895,9 +895,6 @@ test/built-ins/TypedArray/prototype/includes/index-compared-against-initial-leng test/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js: default: 'Test262Error: Expected SameValue(«NaN», «2») to be true (Testing with Float64Array.)' strict mode: 'Test262Error: Expected SameValue(«NaN», «2») to be true (Testing with Float64Array.)' -test/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-with-modified-array-iterator.js: - default: 'Test262Error: Expected SameValue(«1», «4») to be true (Testing with Float64Array.)' - strict mode: 'Test262Error: Expected SameValue(«1», «4») to be true (Testing with Float64Array.)' test/harness/temporalHelpers-sample-time-zones.js: default: "TypeError: realTz.getOffsetNanosecondsFor is not a function. (In 'realTz.getOffsetNanosecondsFor(shiftInstant)', 'realTz.getOffsetNanosecondsFor' is undefined)" strict mode: "TypeError: realTz.getOffsetNanosecondsFor is not a function. (In 'realTz.getOffsetNanosecondsFor(shiftInstant)', 'realTz.getOffsetNanosecondsFor' is undefined)" @@ -949,6 +946,9 @@ test/intl402/Locale/prototype/firstDayOfWeek/valid-options.js: test/intl402/Locale/prototype/getWeekInfo/firstDay-by-option.js: default: 'Test262Error: new Intl.Locale("en", { firstDayOfWeek: mon }).getWeekInfo().firstDay returns "1" Expected SameValue(«7», «1») to be true' strict mode: 'Test262Error: new Intl.Locale("en", { firstDayOfWeek: mon }).getWeekInfo().firstDay returns "1" Expected SameValue(«7», «1») to be true' +test/intl402/NumberFormat/prototype/format/useGrouping-extended-en-IN.js: + default: 'Test262Error: notation: "compact" Expected SameValue(«1K», «1T») to be true' + strict mode: 'Test262Error: notation: "compact" Expected SameValue(«1K», «1T») to be true' test/intl402/Temporal/Duration/compare/relativeto-sub-minute-offset.js: default: 'RangeError: Cannot compare a duration of years, months, or weeks without a relativeTo option' strict mode: 'RangeError: Cannot compare a duration of years, months, or weeks without a relativeTo option' @@ -1109,8 +1109,6 @@ test/language/expressions/yield/star-rhs-iter-rtrn-res-done-no-value.js: test/language/expressions/yield/star-rhs-iter-thrw-res-done-no-value.js: default: 'Test262Error: access count (second iteration) Expected SameValue(«1», «0») to be true' strict mode: 'Test262Error: access count (second iteration) Expected SameValue(«1», «0») to be true' -test/language/global-code/script-decl-lex-var-declared-via-eval.js: - default: "SyntaxError: Can't create duplicate variable: 'test262Var'" test/language/identifier-resolution/assign-to-global-undefined.js: strict mode: Expected uncaught exception with name 'ReferenceError' but none was thrown test/language/import/import-assertions/json-extensibility-array.js: diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations index ec6a397daf9ef..f3747a183c7ae 100644 --- a/LayoutTests/TestExpectations +++ b/LayoutTests/TestExpectations @@ -2120,6 +2120,7 @@ fast/webgpu/regression/repro_275108.html [ Pass Failure Timeout ] [ Debug ] fast/webgpu/nocrash [ Skip ] [ Release ] fast/webgpu/nocrash [ Pass Failure Timeout ] [ Debug ] fast/webgpu/regression/repro_275624.html [ Skip ] +[ Debug ] fast/webgpu/texture-supports-blending.html [ Pass Crash ] # Imported W3C HTML/DOM ref tests that are failing. imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir_auto-textarea-script-N-between-Rs.html [ ImageOnlyFailure ] @@ -4976,6 +4977,7 @@ http/tests/media/video-canplaythrough-webm.html [ Skip ] media/media-session/mock-coordinator.html [ Skip ] media/track/track-description-cue.html [ Skip ] media/track/track-extended-descriptions.html [ Skip ] +fast/canvas/canvas-drawImage-hdr-video.html [ Skip ] # Soon Cocoa-only (currently only macOS) fast/forms/switch/ [ Skip ] @@ -7043,6 +7045,7 @@ imported/w3c/web-platform-tests/css/css-view-transitions/scroller-child.html [ I imported/w3c/web-platform-tests/css/css-view-transitions/scroller.html [ ImageOnlyFailure ] imported/w3c/web-platform-tests/css/css-view-transitions/iframe-and-main-frame-transition-old-main-new-iframe.html [ ImageOnlyFailure ] imported/w3c/web-platform-tests/css/css-view-transitions/iframe-and-main-frame-transition-old-main-old-iframe.html [ ImageOnlyFailure ] +imported/w3c/web-platform-tests/css/css-view-transitions/paint-holding-in-iframe.html [ ImageOnlyFailure ] # Timeouts imported/w3c/web-platform-tests/css/css-view-transitions/iframe-transition.sub.html [ Skip ] @@ -7542,11 +7545,6 @@ imported/w3c/web-platform-tests/svg/painting/reftests/markers-orient-002.svg [ I imported/w3c/web-platform-tests/svg/painting/reftests/paint-context-001.svg [ ImageOnlyFailure ] imported/w3c/web-platform-tests/svg/painting/reftests/paint-context-002.svg [ ImageOnlyFailure ] -# tests added with webkit.org/b/272414 -webkit.org/b/272415 imported/w3c/web-platform-tests/svg/path/property/marker-path.svg [ ImageOnlyFailure ] -webkit.org/b/272416 imported/w3c/web-platform-tests/svg/path/property/mpath.svg [ ImageOnlyFailure ] -webkit.org/b/272417 imported/w3c/web-platform-tests/svg/path/property/priority.svg [ ImageOnlyFailure ] - # re-import css/css-align WPT failure webkit.org/b/271692 imported/w3c/web-platform-tests/css/css-align/blocks/align-content-block-break-overflow-020.html [ ImageOnlyFailure ] diff --git a/LayoutTests/accessibility/mac/textmarker-routines.html b/LayoutTests/accessibility/mac/textmarker-routines.html index 2b14708cd7773..94a51ffb705aa 100644 --- a/LayoutTests/accessibility/mac/textmarker-routines.html +++ b/LayoutTests/accessibility/mac/textmarker-routines.html @@ -13,7 +13,6 @@
- -