aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-05 14:01:51 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:23 -0800
commitd4907ff69b0b72ee540a237f9b1a5fb949fc3b18 (patch)
tree0565f05516424d886d0a30600703c481f6a869b2
parentcd8d5c1f7f73143894efbfc0ff4c1a83606e57ee (diff)
write tempParam in asm format
-rw-r--r--src/jsifier.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 791f342c..5df6b357 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -586,6 +586,16 @@ function JSify(data, functionsOnly, givenFunctions) {
func.JS += ' var label = 0;\n';
}
+ if (ASM_JS) {
+ var hasByVal = false;
+ func.params.forEach(function(param) {
+ hasByVal = hasByVal = hasByVal || param.byVal;
+ });
+ if (hasByVal) {
+ func.js += ' var tempParam = 0;\n';
+ }
+ }
+
// Prepare the stack, if we need one. If we have other stack allocations, force the stack to be set up.
func.JS += ' ' + RuntimeGenerator.stackEnter(func.initialStack, func.otherStackAllocations) + ';\n';
@@ -600,7 +610,7 @@ function JSify(data, functionsOnly, givenFunctions) {
if (param.byVal) {
var type = removePointing(param.type);
var typeInfo = Types.types[type];
- func.JS += ' var tempParam = ' + param.ident + '; ' + param.ident + ' = ' + RuntimeGenerator.stackAlloc(typeInfo.flatSize) + ';' +
+ func.JS += ' ' + (ASM_JS ? '' : 'var ') + 'tempParam = ' + param.ident + '; ' + param.ident + ' = ' + RuntimeGenerator.stackAlloc(typeInfo.flatSize) + ';' +
makeCopyValues(param.ident, 'tempParam', typeInfo.flatSize, 'null', null, param.byVal) + ';\n';
}
});