aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-18 18:44:33 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-18 18:44:33 -0700
commit6e6807b4ce0448b00d8e10a222c44829bb3b60c7 (patch)
treebd47e6bdb455ba1ef9d6ee2433dd18344c73a36b /tools/js-optimizer.js
parent9f8c0f7512499408c93feaee3766a962e066e021 (diff)
wipe out control flow variable before calling outlined code
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index a807b9cc..91e2928e 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -3131,8 +3131,11 @@ function outline(ast) {
owned[v] = 1;
}
});
- // add spills and reads before and after the call to the outlined code, and in the outlined code itself
var reps = [];
+ // wipe out control variable
+ reps.push(['stat', makeAssign(makeStackAccess(ASM_INT, asmData.controlStackPos), ['num', 0])]);
+ reps.push(['stat', makeAssign(makeStackAccess(ASM_INT, asmData.controlDataStackPos), ['num', 0])]); // XXX not really needed
+ // add spills and reads before and after the call to the outlined code, and in the outlined code itself
keys(setUnion(codeInfo.reads, codeInfo.writes)).forEach(function(v) {
if (!(v in owned)) {
reps.push(['stat', ['assign', true, ['sub', ['name', getAsmType(v, asmData) == ASM_INT ? 'HEAP32' : 'HEAPF32'], ['binary', '>>', ['binary', '+', ['name', 'sp'], ['num', asmData.stackPos[v]]], ['num', '2']]], ['name', v]]]);