aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-06 19:46:05 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-07 10:09:03 -0700
commit2c51c1eeb9b761e99ae37a5fcd1cdc40b121f746 (patch)
treeb016d9f6a56617a302548717220489c15ce3cc1f /tools/eliminator
parentb970a019bfcf5413dec74f944a25cef633927f1c (diff)
eliminate loop helper variables
Diffstat (limited to 'tools/eliminator')
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js70
-rw-r--r--tools/eliminator/asm-eliminator-test.js79
2 files changed, 148 insertions, 1 deletions
diff --git a/tools/eliminator/asm-eliminator-test-output.js b/tools/eliminator/asm-eliminator-test-output.js
index 41a2c2b6..8cd11541 100644
--- a/tools/eliminator/asm-eliminator-test-output.js
+++ b/tools/eliminator/asm-eliminator-test-output.js
@@ -4961,4 +4961,74 @@ function _java_nio_charset_Charset_forNameInternal___java_lang_String($n1) {
break;
}
}
+function looop2() {
+ var i = 0;
+ while (1) {
+ do_it();
+ i = i + 1 | 0;
+ if (condition(i)) {
+ break;
+ }
+ }
+}
+function looop3() {
+ var i = 0;
+ while (1) {
+ do_it();
+ i = i + 1 | 0;
+ if (!condition(i)) {
+ break;
+ }
+ }
+}
+function looop4() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = i + 1 | 0;
+ f(i, helper);
+ if (condition()) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+}
+function looop4b() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = i + 1 | 0;
+ g(helper);
+ if (condition(i)) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+}
+function looop5() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = i + 1 | 0;
+ if (condition(helper)) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+ moar(i);
+}
+function looop6() {
+ var i = 0;
+ while (1) {
+ do_it();
+ i = i + 1 | 0;
+ if (!condition(i)) {
+ break;
+ }
+ }
+ moar(i);
+}
diff --git a/tools/eliminator/asm-eliminator-test.js b/tools/eliminator/asm-eliminator-test.js
index 9b9cd3f7..6f881654 100644
--- a/tools/eliminator/asm-eliminator-test.js
+++ b/tools/eliminator/asm-eliminator-test.js
@@ -6678,5 +6678,82 @@ function _java_nio_charset_Charset_forNameInternal___java_lang_String($n1) {
__THREW__ = threwValue = 0;
break;
}
-}// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion", "tempDouble", "_org_apache_harmony_luni_util_NumberConverter_freeFormat__", "__ZN23b2EdgeAndPolygonContact8EvaluateEP10b2ManifoldRK11b2TransformS4_", "_java_nio_charset_Charset_forNameInternal___java_lang_String"]
+}
+function looop2() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ if (condition(helper)) {
+ break;
+ } else {
+ i = helper;
+ }
+ }
+}
+function looop3() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ if (condition(helper)) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+}
+function looop4() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ f(i, helper); // i is used, cannot optimize!
+ if (condition()) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+}
+function looop4b() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ g(helper);
+ if (condition(i)) { // i is used, cannot optimize!
+ i = helper;
+ } else {
+ break;
+ }
+ }
+}
+function looop5() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ if (condition(helper)) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+ moar(i); // i is still needed, cannot optimize!
+}
+function looop6() {
+ var i = 0, helper = 0;
+ while (1) {
+ do_it();
+ helper = (i + 1)|0;
+ if (condition(helper)) {
+ i = helper;
+ } else {
+ break;
+ }
+ }
+ moar(helper); // this is cool
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion", "tempDouble", "_org_apache_harmony_luni_util_NumberConverter_freeFormat__", "__ZN23b2EdgeAndPolygonContact8EvaluateEP10b2ManifoldRK11b2TransformS4_", "_java_nio_charset_Charset_forNameInternal___java_lang_String", "looop2", "looop3", "looop4", "looop5", "looop6"]