diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/js-optimizer.js | 6 | ||||
-rw-r--r-- | tools/test-js-optimizer-asm-outline1-output.js | 8 | ||||
-rw-r--r-- | tools/test-js-optimizer-asm-outline2-output.js | 4 |
3 files changed, 12 insertions, 6 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index eec384a4..c361e3f4 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -3124,10 +3124,10 @@ function outline(ast) { var code = stats.slice(start, end+1); var funcSize = measureSize(func); var newIdent = func[1] + '$' + (asmData.splitCounter++); - //printErr(' do outline ' + [func[1], level, 'range:', start, end, 'of', stats.length, newIdent, measureSize(code)]); //dumpSrc(['block', code]);//dumpAst(['block', code]); // analyze variables, and find 'owned' variables - that only appear in the outlined code, and do not need any spill support var codeInfo = analyzeCode(func, asmData, code); var allCodeInfo = analyzeCode(func, asmData, func); + //printErr(' do outline ' + [func[1], level, 'range:', start, end, 'of', stats.length, newIdent, measureSize(code), JSON.stringify(codeInfo.labels), JSON.stringify(codeInfo.breaks), JSON.stringify(codeInfo.continues)]); var owned = { sp: 1 }; // sp is always owned, each has its own keys(setUnion(codeInfo.reads, codeInfo.writes)).forEach(function(v) { if (allCodeInfo.reads[v] === codeInfo.reads[v] && allCodeInfo.writes[v] === codeInfo.writes[v] && !(v in asmData.params)) { @@ -3246,7 +3246,7 @@ function outline(ast) { makeComparison(makeAsmCoercion(makeStackAccess(ASM_INT, asmData.controlStackPos), ASM_INT), '==', ['num', CONTROL_BREAK_LABEL]), [makeSwitch(makeAsmCoercion(makeStackAccess(ASM_INT, asmData.controlDataStackPos), ASM_INT), keys(codeInfo.breaks).map(function(key) { var id = codeInfo.breaks[key]; - return [['num', id], [['stat', ['break', key]]]]; + return [['num', id], [['block', [['stat', ['break', key]]]]]]; }))] )); } @@ -3261,7 +3261,7 @@ function outline(ast) { makeComparison(makeAsmCoercion(makeStackAccess(ASM_INT, asmData.controlStackPos), ASM_INT), '==', ['num', CONTROL_CONTINUE_LABEL]), [makeSwitch(makeAsmCoercion(makeStackAccess(ASM_INT, asmData.controlDataStackPos), ASM_INT), keys(codeInfo.continues).map(function(key) { var id = codeInfo.continues[key]; - return [['num', id], [['stat', ['continue', key]]]]; + return [['num', id], [['block', [['stat', ['continue', key]]]]]]; }))] )); } diff --git a/tools/test-js-optimizer-asm-outline1-output.js b/tools/test-js-optimizer-asm-outline1-output.js index 2e5dfe48..9f4790de 100644 --- a/tools/test-js-optimizer-asm-outline1-output.js +++ b/tools/test-js-optimizer-asm-outline1-output.js @@ -124,7 +124,9 @@ function mix() { if ((HEAP32[sp + 0 >> 2] | 0) == 2) { switch (HEAP32[sp + 8 >> 2] | 0) { case 2: - break main; + { + break main; + } } } if ((HEAP32[sp + 0 >> 2] | 0) == 3) { @@ -133,7 +135,9 @@ function mix() { if ((HEAP32[sp + 0 >> 2] | 0) == 4) { switch (HEAP32[sp + 8 >> 2] | 0) { case 3: - continue main; + { + continue main; + } } } } diff --git a/tools/test-js-optimizer-asm-outline2-output.js b/tools/test-js-optimizer-asm-outline2-output.js index 7de41008..72e219ad 100644 --- a/tools/test-js-optimizer-asm-outline2-output.js +++ b/tools/test-js-optimizer-asm-outline2-output.js @@ -69,7 +69,9 @@ function _free($mem) { if ((HEAP32[sp + 632 >> 2] | 0) == 2) { switch (HEAP32[sp + 640 >> 2] | 0) { case 2: - break L621; + { + break L621; + } } } } else { |