aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-23 18:23:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-23 18:23:52 -0800
commit309659d7b214828841540dd14de217b2058ce96e (patch)
tree36dde00cef133c162b63070f4ac4d3587efa174f /src/jsifier.js
parent8d030228a3a428f2450d4d77651d04347a1211e9 (diff)
replace compiler tricks for one-time loop removal and label removal with a proper pass in the js optimizer
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 49bac511..2869d059 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -495,16 +495,14 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
}
ret += '\n';
} else if (block.type == 'reloop') {
- ret += indent + (block.needBlockId ? block.id + ': ' : '') + 'while(1) { ' + (SHOW_LABELS ? ' /* ' + block.entries + + ' */' : '') + '\n';
+ ret += indent + block.id + ': while(1) { ' + (SHOW_LABELS ? ' /* ' + block.entries + + ' */' : '') + '\n';
ret += walkBlock(block.inner, indent + ' ');
ret += indent + '}\n';
} else if (block.type == 'multiple') {
var first = true;
var multipleIdent = '';
- if (!block.loopless) {
- ret += indent + (block.needBlockId ? block.id + ': ' : '') + 'do { \n';
- multipleIdent = ' ';
- }
+ ret += indent + block.id + ': do { \n';
+ multipleIdent = ' ';
// TODO: Find out cases where the final if/case is not needed - where we know we must be in a specific label at that point
var SWITCH_IN_MULTIPLE = 0; // This appears to never be worth it, for no amount of labels
if (SWITCH_IN_MULTIPLE && block.entryLabels.length >= 2) {
@@ -523,9 +521,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
first = false;
});
}
- if (!block.loopless) {
- ret += indent + '} while(0);\n';
- }
+ ret += indent + '} while(0);\n';
} else {
throw "Walked into an invalid block type: " + block.type;
}