aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-11-26 23:16:33 -0800
committerAlon Zakai <azakai@mozilla.com>2010-11-26 23:16:33 -0800
commit64ad6c85cf525d80187bbcc279674a1ba2475558 (patch)
treedad9ea05f902ea10262b469c1ec0cfbe1a04f246 /src
parente3d1e034c6b8774a0da993b8ba82cd30135fb946 (diff)
return the optimization of dropping function data as soon as possible
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 5ad3f939..e465647c 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -9,7 +9,11 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
// Now that analysis has completed, we can get around to handling unparsedFunctions
(functionsOnly ? data.functions : data.unparsedFunctions.concat(data.functions)).forEach(function(func) {
- FUNCTIONS[func.ident] = func;
+ // XXX Save just what we need, to save memory - whether there are varargs, and the # of parameters
+ FUNCTIONS[func.ident] = {
+ hasVarArgs: func.hasVarArgs,
+ numParams: func.params.length,
+ };
});
for (var i = 0; i < data.unparsedFunctions.length; i++) {
@@ -920,7 +924,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
} else {
val = toNiceIdent(param.ident);
}
- if (!func || !func.hasVarArgs || i < func.params.length-1) { // unrecognized functions (like library ones) cannot have varargs
+ if (!func || !func.hasVarArgs || i < func.numParams-1) { // unrecognized functions (like library ones) cannot have varargs
args.push(val);
} else {
varargs.push(val);