|
|
@@ -4,8 +4,9 @@
|
|
|
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
|
|
|
//-------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-let results = 0;
|
|
|
-let test = 0;
|
|
|
+// Simpler mini-test harness to avoid any complicating factors when testing these jit bugs
|
|
|
+var results = 0;
|
|
|
+var test = 0;
|
|
|
const verbose = WScript.Arguments[0] != "summary";
|
|
|
|
|
|
function check(actual, expected) {
|
|
|
@@ -77,7 +78,7 @@ check(gen3.next().value, 1);
|
|
|
check(gen3.next().value, 2);
|
|
|
|
|
|
// Test 4 - yield* iterator fails to be restored after Bail on No Profile
|
|
|
-title("Bail on no profile losing yield* iterator")
|
|
|
+title("Bail on no profile losing yield* iterator");
|
|
|
function* gf4() {
|
|
|
yield 0;
|
|
|
yield* [1,2,3];
|
|
|
@@ -90,4 +91,66 @@ check(gen4.next().value, 1);
|
|
|
check(gen4.next().value, 2);
|
|
|
check(gen4.next().value, 3);
|
|
|
|
|
|
+// Test 5 - scope slots fail to load inside for-in loop
|
|
|
+title("Load Scope Slots in presence of for-in");
|
|
|
+function* gf5(v1) {
|
|
|
+ for(v0 in v1) {
|
|
|
+ yield undefined;
|
|
|
+ let v2 = {}
|
|
|
+ function v3() { v2;}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const gen5 = gf5([0, 1]);
|
|
|
+
|
|
|
+check(gen5.next().value, undefined);
|
|
|
+check(gen5.next().value, undefined);
|
|
|
+check(gen5.next().value, undefined);
|
|
|
+check(gen5.next().value, undefined);
|
|
|
+
|
|
|
+// Test 6 - scope slots used in loop control have invalid values
|
|
|
+title("Load Scope Slots used in loop control");
|
|
|
+function* gf6 () {
|
|
|
+ for (let v1 = 0; v1 < 1000; ++v1) {
|
|
|
+ function foo() {v1;}
|
|
|
+ yield v1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const gen6 = gf6();
|
|
|
+
|
|
|
+check(gen6.next().value, 0);
|
|
|
+check(gen6.next().value, 1);
|
|
|
+check(gen6.next().value, 2);
|
|
|
+check(gen6.next().value, 3);
|
|
|
+
|
|
|
+// Test 7 - storing scoped slot from loop control in array
|
|
|
+title("Load Scope Slots used in loop control and captured indirectly");
|
|
|
+function* gf7(v1) {
|
|
|
+ for (const v2 in v1) {
|
|
|
+ yield v2;
|
|
|
+ const v4 = [v2];
|
|
|
+ function foo() { v4; }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const gen7 = gf7([0, 1, 2]);
|
|
|
+check(gen7.next().value, 0);
|
|
|
+check(gen7.next().value, 1);
|
|
|
+check(gen7.next().value, 2);
|
|
|
+check(gen7.next().value, undefined);
|
|
|
+
|
|
|
+// Test 8 - copy prop'd sym is counted as two values - hits bookkeeping FailFast
|
|
|
+title("Copy prop sym double counted in unrestorable symbols hits FailFast");
|
|
|
+function* gf8() {
|
|
|
+ var v8 = 1.1;
|
|
|
+ yield* [];
|
|
|
+ yield {v8};
|
|
|
+}
|
|
|
+
|
|
|
+check(gf8().next().value.v8, 1.1);
|
|
|
+check(gf8().next().value.v8, 1.1);
|
|
|
+check(gf8().next().value.v8, 1.1);
|
|
|
+
|
|
|
+
|
|
|
print("pass");
|