Explorar el Código

Add tests exercising weird flow graph configurations.

Derek Morris hace 7 años
padre
commit
bc38c65ed5
Se han modificado 5 ficheros con 199 adiciones y 0 borrados
  1. 85 0
      test/FlowGraph/mic1msjrc1.js
  2. 21 0
      test/FlowGraph/rlexe.xml
  3. 43 0
      test/FlowGraph/weird1.js
  4. 44 0
      test/FlowGraph/weird2.js
  5. 6 0
      test/rlexedirs.xml

+ 85 - 0
test/FlowGraph/mic1msjrc1.js

@@ -0,0 +1,85 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+function test0() {
+    while (undefined) {
+        if (undefined) {
+            continue;
+        }
+        try {
+            continue;
+        } catch (ex) {
+        } finally {
+            break;
+        }
+    }
+}
+test0();
+test0();
+test0();
+
+
+function test1() {
+    try {
+        LABEL2:
+        while (h != d) {
+            try {
+                continue;
+            } catch (ex) {
+                continue;
+            } finally {
+                return -1839801917;
+            }
+        }
+    } catch (ex) {
+    }
+}
+test1();
+test1();
+test1();
+
+
+var _oo1obj = undefined;
+function test2() {
+    var _oo1obj = function () {
+        var _oo1obj = {
+            prop1 : []
+        };
+        for (; ([])[1]; ) {
+        }
+        _oo1obj.f1 = undefined;
+    }();
+}
+test2();
+test2();
+test2();
+
+
+function test3() {
+    var IntArr1 = Array(1);
+    for (var _ of IntArr1) {
+        if (this || 1) {
+            return 1;
+        }
+    }
+}
+test3();
+test3();
+test3();
+
+
+var ary = Array();
+var func4 = function () {
+    for (var _ of ary) {
+        if (undefined || func4) {
+            break;
+        }
+    }
+};
+func4();
+func4();
+func4();
+
+console.log('PASSED');

+ 21 - 0
test/FlowGraph/rlexe.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<regress-exe>
+  <test>
+    <default>
+      <files>mic1msjrc1.js</files>
+      <compile-flags>-mic:1 -msjrc:1 -oopjit- -bgjit- -loopinterpretcount:1</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>weird1.js</files>
+      <compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -werexceptionsupport -oopjit- -off:bailonnoprofile -off:cachedScope</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>weird2.js</files>
+      <compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -werexceptionsupport -bgjit- -loopinterpretcount:1 -oopjit- -off:simplejit -force:inline</compile-flags>
+    </default>
+  </test>
+</regress-exe>

+ 43 - 0
test/FlowGraph/weird1.js

@@ -0,0 +1,43 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+function test0() {
+    var func0 = function () {
+        (function (loopInvariant) {
+            eval('');
+            while (
+                {
+                    prop0: uic8[loopInvariant + 1 & 1],
+                    prop1: (undefined + 11) * Math.floor(--a) + 'method0'
+                }
+            )
+            {
+                if(4) {
+                    break;
+                }
+                strvar1 = 2147483646;
+                ({
+                    prop2: 0,
+                    prop3: undefined,
+                    prop4: (3 & 255, 2)
+                });
+                continue;
+                return 'somestring1';
+                return 'somestring2';
+            }
+        }());
+    };
+    var uic8 = new Uint8ClampedArray();
+    var a = 1;
+    var temp = 0;
+    do {
+        func0();
+    } while (temp++ < 4);
+}
+test0();
+test0();
+test0();
+
+console.log("PASSED");

+ 44 - 0
test/FlowGraph/weird2.js

@@ -0,0 +1,44 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+var shouldBailout = false;
+function test0() {
+    var loopInvariant = 4;
+    var obj1 = {};
+    var i16 = new Int16Array();
+    function _array2iterate(_array2tmp) {
+        for (var _array2i in _array2tmp) {
+            if (_array2i.indexOf('') == 0) {
+            }
+            var __loopvar1 = loopInvariant - 6;
+            for (; obj1.prop0 < ~(shouldBailout ? (Object.defineProperty(obj1, '', {
+                get: function () {
+                },
+                configurable: true
+            }), obj1.prop0) : obj1.prop0); obj1++) {
+                5;
+                if (obj1) {
+                }
+            }
+            _array2iterate(_array2tmp[_array2i]);
+            obj1.prop0 = {
+                prop0: obj1.prop0 >> 'caller',
+                prop1: i16[53 & 255],
+                prop2: obj1.prop0 >> '',
+                prop3: new RegExp('xyz') instanceof (typeof Function == 'function' && Function[Symbol.toStringTag] == 'AsyncFunction' ? Function : Object),
+                prop4: obj1[shouldBailout ? obj1[8] = 'x' : undefined, 8]
+            };
+        }
+    }
+    _array2iterate([
+        [],
+        []
+    ]);
+}
+test0();
+test0();
+test0();
+
+console.log("PASSED");

+ 6 - 0
test/rlexedirs.xml

@@ -356,4 +356,10 @@
     <tags>require_backend</tags>
   </default>
 </dir>
+<dir>
+  <default>
+    <files>FlowGraph</files>
+    <tags>require_backend</tags>
+  </default>
+</dir>
 </regress-exe>