diff options
author | Alon Zakai <azakai@mozilla.com> | 2010-11-26 23:16:33 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2010-11-26 23:16:33 -0800 |
commit | 64ad6c85cf525d80187bbcc279674a1ba2475558 (patch) | |
tree | dad9ea05f902ea10262b469c1ec0cfbe1a04f246 | |
parent | e3d1e034c6b8774a0da993b8ba82cd30135fb946 (diff) |
return the optimization of dropping function data as soon as possible
-rw-r--r-- | src/jsifier.js | 8 |
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); |