blob: a93e66fe09801969e8c7155b1b63c5fe4a7dab06 [file] [log] [blame]
mark.lam@apple.com7cf9d292018-11-16 05:12:25 +00001function assertEq(actual, expected) {
2 if (actual != expected)
3 throw ("Expected: " + expected + ", actual: " + actual);
4}
5
6function foo(arr, regexp, str) {
7 regexp[Symbol.match](str);
8 arr[1] = 3.54484805889626e-310;
9 return arr[0];
10}
11
12let arr = [1.1, 2.2, 3.3];
13let regexp = /a/y;
14
15for (let i = 0; i < 10000; i++)
16 foo(arr, regexp, "abcd");
17
18regexp.lastIndex = {
19 valueOf: () => {
20 arr[0] = arr;
21 return 0;
22 }
23};
24let result = foo(arr, regexp, "abcd");
25
26assertEq(arr[1], "3.54484805889626e-310");
27assertEq(result, ",3.54484805889626e-310,3.3");