diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-30 12:49:32 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-06-30 12:49:32 -0700 |
commit | 547b13cf5bbf81ca8946d19e8e45b9c2a870a235 (patch) | |
tree | fdd1eb61940e562c46d0d5453c49995f5f32bce2 /tools/test-js-optimizer-asm-last.js | |
parent | 6e3a916b14d0e101efc2e7880949c81fbfe144c0 (diff) |
do not optimize while into do-while if there are continues; fixes #1337
Diffstat (limited to 'tools/test-js-optimizer-asm-last.js')
-rw-r--r-- | tools/test-js-optimizer-asm-last.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/test-js-optimizer-asm-last.js b/tools/test-js-optimizer-asm-last.js index 6331879e..05e1049e 100644 --- a/tools/test-js-optimizer-asm-last.js +++ b/tools/test-js-optimizer-asm-last.js @@ -51,6 +51,40 @@ function looop() { break; } } + while (1) { + do_it(); + if (a()) continue; // we cannot move to do-while, continue will hit the while check + if (!x()) { + break; + } + } + while (1) { + do_it(); + do { + if (a()) continue; // ok to optimize, continue is not for us + } while (b()); + if (!x()) { + break; + } + } + while (1) { + do_it(); + while (b()) { + if (a()) continue; // also ok to optimize, continue is not for us + } + if (!x()) { + break; + } + } + X: while (1) { + do_it(); + while (b()) { + if (a()) continue X; // not ok to optimize + } + if (!x()) { + break; + } + } } // EMSCRIPTEN_GENERATED_FUNCTIONS: ["finall", "looop"] |