diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 10:32:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 11:04:45 -0800 |
commit | 8060c58d107a76d78526714e81c18e1344793620 (patch) | |
tree | d731c9b1246062474b4c8183679e45957146b190 /tools/test-js-optimizer.js | |
parent | 2f3cb58579bbca6645b144de339b73c19f37abed (diff) |
hoist multiples into branchings right before them
Diffstat (limited to 'tools/test-js-optimizer.js')
-rw-r--r-- | tools/test-js-optimizer.js | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/tools/test-js-optimizer.js b/tools/test-js-optimizer.js index 0665462b..8c2ad183 100644 --- a/tools/test-js-optimizer.js +++ b/tools/test-js-optimizer.js @@ -88,5 +88,76 @@ function maths() { check(90+3+2); __ZN6b2Vec2C1Ev(((((((($this1 + 20 | 0 | 0) + 8 | 0) + 8 | 0) + 8 | 0) + 8 | 0) + 8 | 0) + 8 | 0) + 8 | 0); } -// EMSCRIPTEN_GENERATED_FUNCTIONS: ["abc", "xyz", "xyz2", "expr", "loopy", "bits", "maths"] - +function hoisting() { + if ($i < $N) { + __label__ = 2; + } + if (__label__ == 2) { + callOther(); + } +// ok /* + pause(1); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + $for_body3$$for_end$5 : do { + if (__label__ == 2) { + while(true) { break $for_body3$$for_end$5 } + callOther(); + } + } while (0); + pause(2); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + cheez: do { + if (__label__ == 2) { + if (callOther()) break cheez; + } + } while (0); + pause(3); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + if (__label__ == 2) { + callOther(); + } + pause(4); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + if (__label__ == 2) { + callOther(); + } else if (__label__ == 3) { + somethingElse(); + } + pause(5); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + if (__label__ == 55) { + callOther(); + } else if (__label__ == 3) { + somethingElse(); + } + pause(6); + if ($i < $N) { + __label__ = 2; + } else { + __label__ = 3; + } + if (__label__ == 3) { + somethingElse(); + } +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["abc", "xyz", "xyz2", "expr", "loopy", "bits", "maths", "hoisting"] |