Bug 1919246 - Back out D221953 and add tests. r=mgaudet

For now back out D221953 because it was an optional change to improve codegen a bit
for loops that contain an OSR loop, but it's probably not worth the complexity to
try to handle this.

Differential Revision: https://phabricator.services.mozilla.com/D222486
This commit is contained in:
Jan de Mooij 2024-09-17 16:29:02 +00:00
parent dcde9b59c1
commit 3b81464999
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// |jit-test| --fast-warmup
function test() {
var c = [1];
for (var d in c) {
for (var i = 0; i < 30; i++) {
try {
a.push(g);
} catch (e) { }
for (var j = 0; j < 30; j++) { }
}
}
}
test();

View File

@ -0,0 +1,12 @@
// |jit-test| --fast-warmup
function f() {
var i = 0;
while (true) {
for (let a = 2; a;) {
for (c = 0; c < 10;) {
if (i++ > 2500) return;
}
}
}
}
f();

View File

@ -5081,6 +5081,13 @@ bool jit::MakeLoopsContiguous(MIRGraph& graph) {
continue;
}
// If there's an OSR block entering the loop in the middle, it's tricky,
// so don't try to handle it, for now.
if (canOsr) {
UnmarkLoopBlocks(graph, header);
continue;
}
// Move all blocks between header and backedge that aren't marked to
// the end of the loop, making the loop itself contiguous.
MakeLoopContiguous(graph, header, numMarked);