aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-18 10:47:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-18 10:47:52 -0800
commit1c2bf360597108c5a26f05acd1f806bbca55e224 (patch)
treed97798e9457f2527dc71196af7e9242dbe617cf7 /src/jsifier.js
parent846c77ae557699372c7c372ea50135f1f0cb6458 (diff)
further refactoring of phi, and work towards optimized phi
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 604e8b8c..d158a9b9 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -671,7 +671,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
function makeBranch(label, lastLabel, labelIsVariable) {
var pre = '';
- if (lastLabel) {
+ if (!MICRO_OPTS && lastLabel) {
pre = '__lastLabel__ = ' + getLabelId(lastLabel) + '; ';
}
if (label[0] == 'B') {
@@ -819,16 +819,20 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
});
makeFuncLineActor('phi', function(item) {
var params = item.params;
- function makeOne(i) {
- if (i === params.length-1) {
- return finalizeLLVMParameter(params[i].value);
+ if (!MICRO_OPTS) {
+ function makeOne(i) {
+ if (i === params.length-1) {
+ return finalizeLLVMParameter(params[i].value);
+ }
+ return '__lastLabel__ == ' + getLabelId(params[i].label) + ' ? ' +
+ finalizeLLVMParameter(params[i].value) + ' : (' + makeOne(i+1) + ')';
}
- return '__lastLabel__ == ' + getLabelId(params[i].label) + ' ? ' +
- finalizeLLVMParameter(params[i].value) + ' : (' + makeOne(i+1) + ')';
+ var ret = makeOne(0);
+ if (item.postSet) ret += item.postSet;
+ return ret;
+ } else { // MICRO_OPTS == 1
+ assert(0, 'TODO');
}
- var ret = makeOne(0);
- if (item.postSet) ret += item.postSet;
- return ret;
});
makeFuncLineActor('mathop', processMathop);