diff options
author | Alon Zakai <azakai@mozilla.com> | 2010-11-14 16:46:16 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2010-11-14 16:46:16 -0800 |
commit | 9e467f4b1d113315bd18aad25af8ccac4ace077c (patch) | |
tree | 988c40e869c17fde79f0db2135d4d4fd5b0b8082 | |
parent | 4ab5f3fae94f94ccdb754706c0c65cdf832ab90c (diff) |
clean up function lines early to save RAM
-rw-r--r-- | src/jsifier.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index bc54e991..bac2038d 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -9,16 +9,15 @@ 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; + FUNCTIONS[func.ident] = true; }); - var unparsedCounter = 0; - data.unparsedFunctions.forEach(function(func) { - dprint('unparsedFunctions', 'processing |' + func.ident + '|, ' + unparsedCounter + '/' + data.unparsedFunctions.length); - unparsedCounter++; + for (var i = 0; i < data.unparsedFunctions.length; i++) { + var func = data.unparsedFunctions[i]; + dprint('unparsedFunctions', 'processing |' + func.ident + '|, ' + i + '/' + data.unparsedFunctions.length); func.JS = JSify(analyzer(intertyper(func.lines, true), TYPES), true, TYPES, FUNCTIONS); - // TODO: unlink all other fields of func, to allow GC to work. Also do not do | = func|! do | = true|. - }); + delete func.lines; // clean up memory as much as possible + } // type substrate.addZyme('Type', { |