diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/ion/recover-newstringiterator.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/jit-test/tests/ion/recover-newstringiterator.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/recover-newstringiterator.js b/js/src/jit-test/tests/ion/recover-newstringiterator.js new file mode 100644 index 0000000000..14a7d46b6e --- /dev/null +++ b/js/src/jit-test/tests/ion/recover-newstringiterator.js @@ -0,0 +1,66 @@ +var max = 40; +setJitCompilerOption("ion.warmup.trigger", max - 10); + +// Prevent the GC from cancelling Ion compilations, when we expect them to succeed +gczeal(0); + +function selfhosted() { + if (typeof getSelfHostedValue === "undefined") + return; + + var NewStringIterator = getSelfHostedValue("NewStringIterator"); + var iter = NewStringIterator(); + bailout(); + // assertRecoveredOnBailout(iter, true); +} + +function iterator(i) { + var string = String.fromCharCode(0x41, i); + var iter = string[Symbol.iterator](); + assertEq(iter.next().value, 'A'); + bailout(); + // This sometimes fails + // assertRecoveredOnBailout(iter, true); + var result = iter.next(); + assertEq(result.value, String.fromCharCode(i)); + assertEq(result.done, false); + assertEq(iter.next().done, true); +} + +function forof(i) { + var string = String.fromCharCode(0x41, i); + var first = true; + + for (var x of string) { + if (first) { + assertEq(x, 'A'); + bailout(); + first = false; + } else { + assertEq(x, String.fromCharCode(i)); + } + } +} + +var data = { + a: 'foo', + b: {c: 'd'}, + str: 'ABC' +}; + +function fn() { + var {a, b:{c:b}, str:[, c]} = data; + return c; +} + +function destructuring() { + for (var i = 0; i < max; i++) + assertEq(fn(), 'B'); +} + +for (var i = 0; i < max; i++) { + selfhosted(); + iterator(i); + forof(i); + destructuring(); +} |