Skip to content

Commit

Permalink
Update Tests cases for Generator Jit
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuanjl committed May 2, 2024
1 parent 7cfa52a commit 673ca8e
Show file tree
Hide file tree
Showing 15 changed files with 465 additions and 45 deletions.
43 changes: 0 additions & 43 deletions test/es6/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,48 +132,6 @@
<tags>exclude_dynapogo</tags>
</default>
</test>
<test>
<default>
<files>generator-jit-bugs.js</files>
<compile-flags>-JitES6Generators -args summary -endargs</compile-flags>
<tags>exclude_nonative</tags>
</default>
</test>
<test>
<default>
<files>generator-jit-bugs.js</files>
<compile-flags>-JitES6Generators -off:simplejit -args summary -endargs</compile-flags>
<tags>exclude_nonative</tags>
</default>
</test>
<test>
<default>
<files>generator-jit-bugs.js</files>
<compile-flags>-JitES6Generators -off:fulljit -args summary -endargs</compile-flags>
<tags>exclude_nonative, exclude_dynapogo</tags>
</default>
</test>
<test>
<default>
<files>async-jit-bugs.js</files>
<compile-flags>-JitES6Generators -args summary -endargs</compile-flags>
<tags>exclude_nonative</tags>
</default>
</test>
<test>
<default>
<files>async-jit-bugs.js</files>
<compile-flags>-JitES6Generators -off:simplejit -args summary -endargs</compile-flags>
<tags>exclude_nonative</tags>
</default>
</test>
<test>
<default>
<files>async-jit-bugs.js</files>
<compile-flags>-JitES6Generators -off:fulljit -args summary -endargs</compile-flags>
<tags>exclude_nonative, exclude_dynapogo</tags>
</default>
</test>
<test>
<default>
<files>proto_basic.js</files>
Expand Down Expand Up @@ -913,7 +871,6 @@
<test>
<default>
<files>generators-functionality.js</files>
<!-- <compile-flags>-ES6Generators -JitES6Generators -args summary -endargs</compile-flags> -->
<compile-flags>-ES6Generators -args summary -endargs</compile-flags>
<tags>exclude_arm</tags>
</default>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand Down
20 changes: 20 additions & 0 deletions test/es6GeneratorJit/jit-async-loop-body-2.baseline
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions test/es6GeneratorJit/jit-async-loop-body.baseline
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions test/es6GeneratorJit/jit-async-loop-body.js
Original file line number Diff line number Diff line change
@@ -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));
13 changes: 13 additions & 0 deletions test/es6GeneratorJit/jit-gen-loop-body-2.baseline
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions test/es6GeneratorJit/jit-gen-loop-body.baseline
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions test/es6GeneratorJit/jit-gen-loop-body.js
Original file line number Diff line number Diff line change
@@ -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);
}
11 changes: 11 additions & 0 deletions test/es6GeneratorJit/jit-module-loop-body-2.baseline
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions test/es6GeneratorJit/jit-module-loop-body.baseline
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions test/es6GeneratorJit/jit-module-loop-body.js
Original file line number Diff line number Diff line change
@@ -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;
}


Loading

0 comments on commit 673ca8e

Please sign in to comment.