aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-21 18:42:06 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-21 18:46:30 -0800
commitb8c670c705279fae14ca7742531950b4f84c849d (patch)
tree11868af881e3da31897a524881870a87db2fa312 /tools
parentbf7b435983d2e891297e76ce3dd80ef635b7e2c1 (diff)
do not outline the entire stack prelude, including STACKTOP = ..
Diffstat (limited to 'tools')
-rw-r--r--tools/js-optimizer.js11
-rw-r--r--tools/test-js-optimizer-asm-outline1-output.js48
-rw-r--r--tools/test-js-optimizer-asm-outline1.js37
3 files changed, 95 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index fc195e03..21fce2c2 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -4775,7 +4775,16 @@ function outline(ast) {
for (var i = minIndex; i < stats.length; i++) {
var stat = stats[i];
if (stat[0] == 'stat') stat = stat[1];
- if (stat[0] == 'assign' && stat[2][0] == 'name' && stat[2][1] == 'sp') minIndex = i+1; // cannot outline |sp = |
+ if (stat[0] == 'assign' && stat[2][0] == 'name' && stat[2][1] == 'sp') {
+ // cannot outline |sp = |
+ minIndex = i+1;
+ // When followed by a STACKTOP bump, preserve that too (we may need to replace it later)
+ stat = stats[i+1];
+ if (stat[0] == 'stat') stat = stat[1];
+ if (stat && stat[0] == 'assign' && stat[2][0] == 'name' && stat[2][1] == 'STACKTOP') {
+ minIndex = i+2;
+ }
+ }
}
}
}
diff --git a/tools/test-js-optimizer-asm-outline1-output.js b/tools/test-js-optimizer-asm-outline1-output.js
index 27f93d8a..c4792c51 100644
--- a/tools/test-js-optimizer-asm-outline1-output.js
+++ b/tools/test-js-optimizer-asm-outline1-output.js
@@ -423,6 +423,32 @@ function switchh2() {
}
STACKTOP = sp;
}
+function stackSet(x1, x2, x3, x4, x5) {
+ x1 = x1 | 0;
+ x2 = x2 | 0;
+ x3 = x3 | 0;
+ x4 = x4 | 0;
+ x5 = x5 | 0;
+ var sp = 0;
+ sp = STACKTOP;
+ STACKTOP = STACKTOP + 282 | 0;
+ c(1);
+ c(2);
+ c(3);
+ c(4);
+ c(5);
+ c(6);
+ c(7);
+ c(8);
+ c(9);
+ c(10);
+ HEAP32[sp + 66 >> 2] = 0;
+ HEAP32[sp + 70 >> 2] = 0;
+ stackSet$1(sp);
+ HEAP32[sp + 58 >> 2] = 0;
+ HEAP32[sp + 62 >> 2] = 0;
+ stackSet$0(sp);
+}
function lin$0(sp) {
sp = sp | 0;
c(14);
@@ -926,4 +952,26 @@ function switchh2$2(sp) {
} while (0);
HEAP32[sp + 8 >> 2] = helper$0;
}
+function stackSet$0(sp) {
+ sp = sp | 0;
+ c(7);
+ c(8);
+ c(9);
+ c(10);
+ c(11);
+ c(12);
+ c(13);
+}
+function stackSet$1(sp) {
+ sp = sp | 0;
+ c(11);
+ c(12);
+ c(13);
+ c(1);
+ c(2);
+ c(3);
+ c(4);
+ c(5);
+ c(6);
+}
diff --git a/tools/test-js-optimizer-asm-outline1.js b/tools/test-js-optimizer-asm-outline1.js
index b7ec9011..f640d11d 100644
--- a/tools/test-js-optimizer-asm-outline1.js
+++ b/tools/test-js-optimizer-asm-outline1.js
@@ -347,5 +347,42 @@ function switchh2() {
print(9);
}
}
+function stackSet(x1, x2, x3, x4, x5) {
+ x1 = x1 | 0;
+ x2 = x2 | 0;
+ x3 = x3 | 0;
+ x4 = x4 | 0;
+ x5 = x5 | 0;
+ var sp = 0, a = 0, b = 0, cc = 0, d = 0, e = 0, f = 0, g = 0;
+ var sp1 = 0, a1 = 0, b1 = 0, c1 = 0, d1 = 0, e1 = 0, f1 = 0, g1 = 0;
+ sp = STACKTOP;
+ STACKTOP = STACKTOP + 10 | 0;
+ c(1);
+ c(2);
+ c(3);
+ c(4);
+ c(5);
+ c(6);
+ c(7);
+ c(8);
+ c(9);
+ c(10);
+ c(11);
+ c(12);
+ c(13);
+ c(1);
+ c(2);
+ c(3);
+ c(4);
+ c(5);
+ c(6);
+ c(7);
+ c(8);
+ c(9);
+ c(10);
+ c(11);
+ c(12);
+ c(13);
+}
// EMSCRIPTEN_GENERATED_FUNCTIONS
// EXTRA_INFO: { "sizeToOutline": 30, "allowCostlyOutlines": 1 }