aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/js-optimizer.js2
-rw-r--r--tools/test-js-optimizer-asm-outline1-output.js64
-rw-r--r--tools/test-js-optimizer-asm-outline1.js2
3 files changed, 40 insertions, 28 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index f10d5308..b42164f9 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -3071,7 +3071,7 @@ function outline(ast) {
currSize += size;
if (!isIf) {
var last = part.body;
- last = last[stats.length-1];
+ last = last[last.length-1];
if (last && last[0] === 'block') last = last[1][last[1].length-1];
if (last && last[0] === 'stat') last = last[1];
force = !last || !(last[0] in ALTER_FLOW);
diff --git a/tools/test-js-optimizer-asm-outline1-output.js b/tools/test-js-optimizer-asm-outline1-output.js
index 895004d8..612da16a 100644
--- a/tools/test-js-optimizer-asm-outline1-output.js
+++ b/tools/test-js-optimizer-asm-outline1-output.js
@@ -348,6 +348,15 @@ function switchh() {
HEAP32[sp + 44 >> 2] = 0;
switchh$2(sp);
helper$0 = HEAP32[sp + 8 >> 2] | 0;
+ tempValue = HEAP32[sp + 40 >> 2] | 0;
+ tempInt = HEAP32[sp + 44 >> 2] | 0;
+ tempDouble = +HEAPF32[sp + 44 >> 2];
+ HEAP32[sp + 40 >> 2] = 0;
+ HEAP32[sp + 44 >> 2] = 0;
+ if ((tempValue | 0) == 5) {
+ STACKTOP = sp;
+ return;
+ }
HEAP32[sp + 8 >> 2] = helper$0;
HEAP32[sp + 16 >> 2] = helper$1;
HEAP32[sp + 32 >> 2] = 0;
@@ -749,36 +758,39 @@ function switchh$2(sp) {
var helper$0 = 0, helper$1 = 0;
helper$0 = HEAP32[sp + 8 >> 2] | 0;
helper$1 = HEAP32[sp + 16 >> 2] | 0;
- if (helper$0) {
- helper$0 = 0;
- switch (helper$1 | 0) {
- case 1:
- {
- f(1);
- g();
- break;
- }
- default:
- {
- helper$0 = 1;
+ OL : do {
+ if (helper$0) {
+ helper$0 = 0;
+ switch (helper$1 | 0) {
+ case 1:
+ {
+ f(1);
+ g();
+ HEAP32[sp + 40 >> 2] = 5;
+ break OL;
+ }
+ default:
+ {
+ helper$0 = 1;
+ }
}
}
- }
- if (helper$0) {
- helper$0 = 0;
- switch (helper$1 | 0) {
- case 2:
- {
- f(2);
- g();
- break;
- }
- default:
- {
- helper$0 = 1;
+ if (helper$0) {
+ helper$0 = 0;
+ switch (helper$1 | 0) {
+ case 2:
+ {
+ f(2);
+ g();
+ break;
+ }
+ default:
+ {
+ helper$0 = 1;
+ }
}
}
- }
+ } while (0);
HEAP32[sp + 8 >> 2] = helper$0;
}
diff --git a/tools/test-js-optimizer-asm-outline1.js b/tools/test-js-optimizer-asm-outline1.js
index 3c454182..4282ec8e 100644
--- a/tools/test-js-optimizer-asm-outline1.js
+++ b/tools/test-js-optimizer-asm-outline1.js
@@ -269,7 +269,7 @@ function switchh() {
case 1: {
f(1);
g();
- break;
+ return;
}
case 2: {
f(2);