diff --git a/test/es6/rlexe.xml b/test/es6/rlexe.xml index 1ff8919fd9a..a1c7fbab7ea 100644 --- a/test/es6/rlexe.xml +++ b/test/es6/rlexe.xml @@ -132,48 +132,6 @@ exclude_dynapogo - - - generator-jit-bugs.js - -JitES6Generators -args summary -endargs - exclude_nonative - - - - - generator-jit-bugs.js - -JitES6Generators -off:simplejit -args summary -endargs - exclude_nonative - - - - - generator-jit-bugs.js - -JitES6Generators -off:fulljit -args summary -endargs - exclude_nonative, exclude_dynapogo - - - - - async-jit-bugs.js - -JitES6Generators -args summary -endargs - exclude_nonative - - - - - async-jit-bugs.js - -JitES6Generators -off:simplejit -args summary -endargs - exclude_nonative - - - - - async-jit-bugs.js - -JitES6Generators -off:fulljit -args summary -endargs - exclude_nonative, exclude_dynapogo - - proto_basic.js @@ -913,7 +871,6 @@ generators-functionality.js - -ES6Generators -args summary -endargs exclude_arm diff --git a/test/es6/async-jit-bugs.js b/test/es6GeneratorJit/async-jit-bugs.js similarity index 94% rename from test/es6/async-jit-bugs.js rename to test/es6GeneratorJit/async-jit-bugs.js index 6dee055cc71..6b27e1817d8 100644 --- a/test/es6/async-jit-bugs.js +++ b/test/es6GeneratorJit/async-jit-bugs.js @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. -// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- diff --git a/test/es6/generator-jit-bugs.js b/test/es6GeneratorJit/generator-jit-bugs.js similarity index 98% rename from test/es6/generator-jit-bugs.js rename to test/es6GeneratorJit/generator-jit-bugs.js index 2594cc92d4f..96e0be58665 100644 --- a/test/es6/generator-jit-bugs.js +++ b/test/es6GeneratorJit/generator-jit-bugs.js @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. -// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- diff --git a/test/es6GeneratorJit/jit-async-loop-body-2.baseline b/test/es6GeneratorJit/jit-async-loop-body-2.baseline new file mode 100644 index 00000000000..cebabd52a99 --- /dev/null +++ b/test/es6GeneratorJit/jit-async-loop-body-2.baseline @@ -0,0 +1,20 @@ +Beginning basicAsync +basicAsync Loop 0 a = 80 +basicAsync Loop 0 arguments[0] = 80 +basicAsync Loop 0 a = 160 +basicAsync Loop 0 arguments[0] = 160 +Loop 3 completed +Loop 4 k = 160 +Loop 4 k = 80 +Loop 4 k = 0 +Loop 4 completed +Beginning basicAsync +basicAsync Loop 0 a = 80 +basicAsync Loop 0 arguments[0] = 80 +basicAsync Loop 0 a = 160 +basicAsync Loop 0 arguments[0] = 160 +Loop 3 completed +Loop 4 k = 160 +Loop 4 k = 80 +Loop 4 k = 0 +Loop 4 completed diff --git a/test/es6GeneratorJit/jit-async-loop-body.baseline b/test/es6GeneratorJit/jit-async-loop-body.baseline new file mode 100644 index 00000000000..d9e00f69d6b --- /dev/null +++ b/test/es6GeneratorJit/jit-async-loop-body.baseline @@ -0,0 +1,42 @@ +Beginning basicAsync +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: basicAsync, loop:1--- +---EndBackEnd--- +basicAsync Loop 0 a = 80 +basicAsync Loop 0 arguments[0] = 80 +---BeginBackEnd: function: basicAsync, loop:0--- +---EndBackEnd--- +basicAsync Loop 0 a = 160 +basicAsync Loop 0 arguments[0] = 160 +Loop 3 completed +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +Loop 4 k = 160 +---BeginBackEnd: function: basicAsync, loop:4--- +---EndBackEnd--- +Loop 4 k = 80 +Loop 4 k = 0 +Loop 4 completed +Beginning basicAsync +basicAsync Loop 0 a = 80 +basicAsync Loop 0 arguments[0] = 80 +basicAsync Loop 0 a = 160 +basicAsync Loop 0 arguments[0] = 160 +Loop 3 completed +---BeginBackEnd: function: Array.prototype.values--- +---EndBackEnd--- +---BeginBackEnd: function: Anonymous function--- +---EndBackEnd--- +---BeginBackEnd: function: Anonymous function--- +---EndBackEnd--- +Loop 4 k = 160 +Loop 4 k = 80 +Loop 4 k = 0 +Loop 4 completed diff --git a/test/es6GeneratorJit/jit-async-loop-body.js b/test/es6GeneratorJit/jit-async-loop-body.js new file mode 100644 index 00000000000..097174a1501 --- /dev/null +++ b/test/es6GeneratorJit/jit-async-loop-body.js @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------------------------------- +// Copyright (C) Microsoft. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +//------------------------------------------------------------------------------------------------------- + +let bar = []; +let j = 0; + +function printif (text, x, mod) { + if (x % mod == 0) { + print (text + x); + } +} + +async function basicAsync(a, b) { + print("Beginning basicAsync") + await b; + var foo = [0.1, 0.2, 0.3, 0.4, 0]; + while (a < 200) { // Loop 0 - should be jitted + foo[a] = Math.random(); + printif(arguments.callee.name + " Loop 0 a = ", a, 80); + printif(arguments.callee.name + " Loop 0 arguments[0] = ", arguments[0], 80); + for (let k in foo) { bar[k] = a - k;} // Loop 1 - shuld be jitted + ++a; + } + while (true){ // Loop 2 - should not be jitted + for (j = 0; j < 100; ++j) { // Loop 3 - should not be jitted + await j; + foo[j] = j; + } + print("Loop 3 completed"); + for (let k of bar) { // Loop 4 - should be jitted + printif("Loop 4 k = ", k, 80); + foo[0] = foo[1] + 1; + } + print("Loop 4 completed"); + return j; + } +} + +basicAsync(4, 3).then(x => basicAsync(3, 2)); diff --git a/test/es6GeneratorJit/jit-gen-loop-body-2.baseline b/test/es6GeneratorJit/jit-gen-loop-body-2.baseline new file mode 100644 index 00000000000..69d659a198e --- /dev/null +++ b/test/es6GeneratorJit/jit-gen-loop-body-2.baseline @@ -0,0 +1,13 @@ +Beginning test of basicGenerator +basicGenerator Loop 0 a = 40 +basicGenerator Loop 0 arguments[0] = 40 +basicGenerator Loop 0 a = 80 +basicGenerator Loop 0 arguments[0] = 80 +Loop 3 completed +Loop 4 k = 80 +Loop 4 k = 40 +Loop 4 k = 0 +Loop 4 completed +yielded value = 80 +yielded value = 40 +yielded value = 0 diff --git a/test/es6GeneratorJit/jit-gen-loop-body.baseline b/test/es6GeneratorJit/jit-gen-loop-body.baseline new file mode 100644 index 00000000000..be92f4a3d28 --- /dev/null +++ b/test/es6GeneratorJit/jit-gen-loop-body.baseline @@ -0,0 +1,35 @@ +Beginning test of basicGenerator +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: basicGenerator, loop:1--- +---EndBackEnd--- +basicGenerator Loop 0 a = 40 +basicGenerator Loop 0 arguments[0] = 40 +---BeginBackEnd: function: basicGenerator, loop:0--- +---EndBackEnd--- +basicGenerator Loop 0 a = 80 +basicGenerator Loop 0 arguments[0] = 80 +Loop 3 completed +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +Loop 4 k = 80 +---BeginBackEnd: function: basicGenerator, loop:4--- +---EndBackEnd--- +Loop 4 k = 40 +Loop 4 k = 0 +Loop 4 completed +---BeginBackEnd: function: Array.prototype.values--- +---EndBackEnd--- +---BeginBackEnd: function: Anonymous function--- +---EndBackEnd--- +---BeginBackEnd: function: Anonymous function--- +---EndBackEnd--- +yielded value = 80 +yielded value = 40 +yielded value = 0 diff --git a/test/es6GeneratorJit/jit-gen-loop-body.js b/test/es6GeneratorJit/jit-gen-loop-body.js new file mode 100644 index 00000000000..f72fcf8ddbf --- /dev/null +++ b/test/es6GeneratorJit/jit-gen-loop-body.js @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------------------------------- +// Copyright (C) Microsoft. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +//------------------------------------------------------------------------------------------------------- + +let bar = []; +let j = 0; + +function printif (text, x, mod) { + if (x % mod == 0) { + print (text + x); + } +} + +function* basicGenerator(a, b) { + print("Beginning test of " + arguments.callee.name); + yield "yield 2nd param b =" + b; + var foo = [0.1, 0.2, 0.3, 0.4, 0]; + while (a < 100) { // Loop 0 - should be jitted + foo[a] = Math.random(); + printif(arguments.callee.name + " Loop 0 a = ", a, 40); + printif(arguments.callee.name + " Loop 0 arguments[0] = ", arguments[0], 40); + for (let k in foo) { bar[k] = a - k;} // Loop 1 - shuld be jitted + ++a; + } + while (true){ // Loop 2 - should not be jitted + for (j = 0; j < 100; ++j) { // Loop 3 - should not be jitted + if (j % 40 == 1) + yield j; + + foo[j] = j; + } + print("Loop 3 completed"); + for (let k of bar) { // Loop 4 - should be jitted + printif("Loop 4 k = ", k, 40); + foo[0] = foo[1] + 1; + } + print("Loop 4 completed"); + yield* bar; // Loop 5 - should not be jitted + return j; + } +} + +const gen = basicGenerator(5, 1); +for (let x = gen.next(); !x.done; x = gen.next() ) { + printif("yielded value = ", x.value, 40); +} diff --git a/test/es6GeneratorJit/jit-module-loop-body-2.baseline b/test/es6GeneratorJit/jit-module-loop-body-2.baseline new file mode 100644 index 00000000000..1d8802ac915 --- /dev/null +++ b/test/es6GeneratorJit/jit-module-loop-body-2.baseline @@ -0,0 +1,11 @@ +Loop 0 a = 40 +Loop 0 a = 80 +Loop 0 a = 120 +Loop 0 a = 160 +Loop 3 completed +Loop 4 k = 160 +Loop 4 k = 120 +Loop 4 k = 80 +Loop 4 k = 40 +Loop 4 k = 0 +Loop 4 completed diff --git a/test/es6GeneratorJit/jit-module-loop-body.baseline b/test/es6GeneratorJit/jit-module-loop-body.baseline new file mode 100644 index 00000000000..320dc2690cf --- /dev/null +++ b/test/es6GeneratorJit/jit-module-loop-body.baseline @@ -0,0 +1,27 @@ +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: printif--- +---EndBackEnd--- +---BeginBackEnd: function: Module code, loop:1--- +---EndBackEnd--- +Loop 0 a = 40 +Loop 0 a = 80 +Loop 0 a = 120 +---BeginBackEnd: function: Module code, loop:0--- +---EndBackEnd--- +Loop 0 a = 160 +Loop 3 completed +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +---BeginBackEnd: function: value--- +---EndBackEnd--- +Loop 4 k = 160 +---BeginBackEnd: function: Module code, loop:4--- +---EndBackEnd--- +Loop 4 k = 120 +Loop 4 k = 80 +Loop 4 k = 40 +Loop 4 k = 0 +Loop 4 completed diff --git a/test/es6GeneratorJit/jit-module-loop-body.js b/test/es6GeneratorJit/jit-module-loop-body.js new file mode 100644 index 00000000000..9ec92be8db3 --- /dev/null +++ b/test/es6GeneratorJit/jit-module-loop-body.js @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------------------------------- +// Copyright (C) Microsoft. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +//------------------------------------------------------------------------------------------------------- + +let bar = []; +let j = 0, a = 3, b = 2; + +function printif (text, x, mod) { + if (x % mod == 0) { + print (text + x); + } +} + + +await b; +var foo = [0.1, 0.2, 0.3, 0.4, 0]; +while (a < 200) { // Loop 0 - should be jitted + foo[a] = Math.random(); + printif("Loop 0 a = ", a, 40); + for (let k in foo) { bar[k] = a - k;} // Loop 1 - shuld be jitted + ++a; +} +while (true){ // Loop 2 - should not be jitted + for (j = 0; j < 100; ++j) { // Loop 3 - should not be jitted + await j; + + foo[j] = j; + } + print("Loop 3 completed"); + for (let k of bar) { // Loop 4 - should be jitted + printif("Loop 4 k = ", k, 40); + foo[0] = foo[1] + 1; + } + print("Loop 4 completed"); + await j; + break; +} + + diff --git a/test/es6GeneratorJit/newtest.js b/test/es6GeneratorJit/newtest.js new file mode 100644 index 00000000000..797036cff90 --- /dev/null +++ b/test/es6GeneratorJit/newtest.js @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------------------------------- +// Copyright (C) Microsoft. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +//------------------------------------------------------------------------------------------------------- + +// 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) { + if (actual != expected) + throw new Error("Generator produced " + actual + " instead of " + expected); + if (verbose) + print('Result ' + ++results + ' Generator correctly produced ' + actual); +} + +function title (name) { + if (verbose) { + print("Beginning Test " + ++test + ": " + name); + results = 0; + } +} + + +// Test 1 - Construction after self-reference in loop control +title("Construction after self-reference in loop control"); + +function testOne() +{ + function* foo(a1,a2) { + + for (let i = a1; i < foo; i = i + a2) + { + yield 0; + } + + function bar() {} + var b = new bar(); + } + + foo().next() + return true; +} + + +for (var i = 0; i < 30 ;++i){ + testOne(); +} + +print('pass') diff --git a/test/es6GeneratorJit/rlexe.xml b/test/es6GeneratorJit/rlexe.xml new file mode 100644 index 00000000000..7b7e4c2dde8 --- /dev/null +++ b/test/es6GeneratorJit/rlexe.xml @@ -0,0 +1,126 @@ + + + + + generator-jit-bugs.js + -JitES6Generators -args summary -endargs + exclude_nonative + + + + + generator-jit-bugs.js + -JitES6Generators -off:simplejit -args summary -endargs + exclude_nonative + + + + + generator-jit-bugs.js + -JitES6Generators -off:fulljit -args summary -endargs + exclude_nonative, exclude_dynapogo + + + + + async-jit-bugs.js + -JitES6Generators -args summary -endargs + exclude_nonative + + + + + async-jit-bugs.js + -JitES6Generators -off:simplejit -args summary -endargs + exclude_nonative + + + + + async-jit-bugs.js + -JitES6Generators -off:fulljit -args summary -endargs + exclude_nonative, exclude_dynapogo + + + + + async-jit-bugs.js + -off:fulljit -args summary -endargs + exclude_nonative, exclude_dynapogo + + + + + newTest.js + -args summary -endargs + exclude_nonative + + + + + newTest.js + -off:simplejit -args summary -endargs + exclude_nonative + + + + + newTest.js + -off:fulljit -args summary -endargs + exclude_nonative, exclude_dynapogo + + + + + newTest.js + -off:fulljit -args summary -endargs + exclude_nonative, exclude_dynapogo + + + + + jit-gen-loop-body.js + -testtrace:Backend + jit-gen-loop-body.baseline + exclude_nonative, exclude_dynapogo + + + + + jit-gen-loop-body.js + jit-gen-loop-body-2.baseline + exclude_nonative + + + + + jit-async-loop-body.js + -testtrace:Backend + jit-async-loop-body.baseline + exclude_nonative, exclude_dynapogo + + + + + jit-async-loop-body.js + jit-async-loop-body-2.baseline + exclude_nonative + + + + + jit-module-loop-body.js + -testtrace:Backend -module + jit-module-loop-body.baseline + exclude_nonative, exclude_dynapogo + + + + + jit-module-loop-body.js + -module + jit-module-loop-body-2.baseline + exclude_nonative + + + diff --git a/test/rlexedirs.xml b/test/rlexedirs.xml index 3c1782b1d19..5b61668f4c1 100644 --- a/test/rlexedirs.xml +++ b/test/rlexedirs.xml @@ -262,6 +262,12 @@ es6 + + + es6GeneratorJit + require_backend + + es6module