Skip to content

Commit bc38c65

Browse files
Add tests exercising weird flow graph configurations.
1 parent 58efb7f commit bc38c65

File tree

5 files changed

+199
-0
lines changed

5 files changed

+199
-0
lines changed

test/FlowGraph/mic1msjrc1.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0() {
7+
while (undefined) {
8+
if (undefined) {
9+
continue;
10+
}
11+
try {
12+
continue;
13+
} catch (ex) {
14+
} finally {
15+
break;
16+
}
17+
}
18+
}
19+
test0();
20+
test0();
21+
test0();
22+
23+
24+
function test1() {
25+
try {
26+
LABEL2:
27+
while (h != d) {
28+
try {
29+
continue;
30+
} catch (ex) {
31+
continue;
32+
} finally {
33+
return -1839801917;
34+
}
35+
}
36+
} catch (ex) {
37+
}
38+
}
39+
test1();
40+
test1();
41+
test1();
42+
43+
44+
var _oo1obj = undefined;
45+
function test2() {
46+
var _oo1obj = function () {
47+
var _oo1obj = {
48+
prop1 : []
49+
};
50+
for (; ([])[1]; ) {
51+
}
52+
_oo1obj.f1 = undefined;
53+
}();
54+
}
55+
test2();
56+
test2();
57+
test2();
58+
59+
60+
function test3() {
61+
var IntArr1 = Array(1);
62+
for (var _ of IntArr1) {
63+
if (this || 1) {
64+
return 1;
65+
}
66+
}
67+
}
68+
test3();
69+
test3();
70+
test3();
71+
72+
73+
var ary = Array();
74+
var func4 = function () {
75+
for (var _ of ary) {
76+
if (undefined || func4) {
77+
break;
78+
}
79+
}
80+
};
81+
func4();
82+
func4();
83+
func4();
84+
85+
console.log('PASSED');

test/FlowGraph/rlexe.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<regress-exe>
3+
<test>
4+
<default>
5+
<files>mic1msjrc1.js</files>
6+
<compile-flags>-mic:1 -msjrc:1 -oopjit- -bgjit- -loopinterpretcount:1</compile-flags>
7+
</default>
8+
</test>
9+
<test>
10+
<default>
11+
<files>weird1.js</files>
12+
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -werexceptionsupport -oopjit- -off:bailonnoprofile -off:cachedScope</compile-flags>
13+
</default>
14+
</test>
15+
<test>
16+
<default>
17+
<files>weird2.js</files>
18+
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -werexceptionsupport -bgjit- -loopinterpretcount:1 -oopjit- -off:simplejit -force:inline</compile-flags>
19+
</default>
20+
</test>
21+
</regress-exe>

test/FlowGraph/weird1.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0() {
7+
var func0 = function () {
8+
(function (loopInvariant) {
9+
eval('');
10+
while (
11+
{
12+
prop0: uic8[loopInvariant + 1 & 1],
13+
prop1: (undefined + 11) * Math.floor(--a) + 'method0'
14+
}
15+
)
16+
{
17+
if(4) {
18+
break;
19+
}
20+
strvar1 = 2147483646;
21+
({
22+
prop2: 0,
23+
prop3: undefined,
24+
prop4: (3 & 255, 2)
25+
});
26+
continue;
27+
return 'somestring1';
28+
return 'somestring2';
29+
}
30+
}());
31+
};
32+
var uic8 = new Uint8ClampedArray();
33+
var a = 1;
34+
var temp = 0;
35+
do {
36+
func0();
37+
} while (temp++ < 4);
38+
}
39+
test0();
40+
test0();
41+
test0();
42+
43+
console.log("PASSED");

test/FlowGraph/weird2.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
var shouldBailout = false;
7+
function test0() {
8+
var loopInvariant = 4;
9+
var obj1 = {};
10+
var i16 = new Int16Array();
11+
function _array2iterate(_array2tmp) {
12+
for (var _array2i in _array2tmp) {
13+
if (_array2i.indexOf('') == 0) {
14+
}
15+
var __loopvar1 = loopInvariant - 6;
16+
for (; obj1.prop0 < ~(shouldBailout ? (Object.defineProperty(obj1, '', {
17+
get: function () {
18+
},
19+
configurable: true
20+
}), obj1.prop0) : obj1.prop0); obj1++) {
21+
5;
22+
if (obj1) {
23+
}
24+
}
25+
_array2iterate(_array2tmp[_array2i]);
26+
obj1.prop0 = {
27+
prop0: obj1.prop0 >> 'caller',
28+
prop1: i16[53 & 255],
29+
prop2: obj1.prop0 >> '',
30+
prop3: new RegExp('xyz') instanceof (typeof Function == 'function' && Function[Symbol.toStringTag] == 'AsyncFunction' ? Function : Object),
31+
prop4: obj1[shouldBailout ? obj1[8] = 'x' : undefined, 8]
32+
};
33+
}
34+
}
35+
_array2iterate([
36+
[],
37+
[]
38+
]);
39+
}
40+
test0();
41+
test0();
42+
test0();
43+
44+
console.log("PASSED");

test/rlexedirs.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,10 @@
356356
<tags>require_backend</tags>
357357
</default>
358358
</dir>
359+
<dir>
360+
<default>
361+
<files>FlowGraph</files>
362+
<tags>require_backend</tags>
363+
</default>
364+
</dir>
359365
</regress-exe>

0 commit comments

Comments
 (0)