diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-10 13:59:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-10 13:59:40 -0700 |
commit | 8be82c04408cab6519d3ed58305465ae97ca9da3 (patch) | |
tree | 8cc33c4bfd17d305ae19fa417d105ab5816c8e2f /src/preamble.js | |
parent | b1240603040c53bbedb3f2ac08063532a96bcd0e (diff) |
pgo for unused function detection
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 9bc68d8f..7538b19c 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -848,5 +848,22 @@ Module['removeRunDependency'] = removeRunDependency; Module["preloadedImages"] = {}; // maps url to image data Module["preloadedAudios"] = {}; // maps url to audio data +#if PGO +var PGOMonitor = { + called: {}, + dump: function() { + var dead = []; + for (var i = 0; i < this.allGenerated.length; i++) { + var func = this.allGenerated[i]; + if (!this.called[func]) dead.push(func); + } + Module.print('-s DEAD_FUNCTIONS=\'' + JSON.stringify(dead) + '\'\n'); + } +}; +__ATEXIT__.push({ func: function() { PGOMonitor.dump() } }); +if (!Module.preRun) Module.preRun = []; +Module.preRun.push(function() { addRunDependency('pgo') }); +#endif + // === Body === |