aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-17 16:47:47 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-17 16:47:47 -0700
commit3a1a48bb749e7001b8f3eb6bff0f486a4d03a040 (patch)
treecf4988ab23ce708a462a8602ea73144de3f16a17
parent59553016250b4208ab28385933076950cf596998 (diff)
outlining integration in compiler
-rwxr-xr-xemcc4
-rw-r--r--src/settings.js5
2 files changed, 9 insertions, 0 deletions
diff --git a/emcc b/emcc
index 768867bc..bfd97883 100755
--- a/emcc
+++ b/emcc
@@ -1596,6 +1596,10 @@ try:
logging.debug('running post-closure post-opts')
js_optimizer_queue += ['simplifyExpressionsPost']
+ if shared.Settings.OUTLINING_LIMIT > 0:
+ js_optimizer_queue += ['outline']
+ js_optimizer_extra_info['sizeToOutline'] = shared.Settings.OUTLINING_LIMIT
+
if (not closure or shared.Settings.ASM_JS) and shared.Settings.RELOOP and debug_level < 3:
js_optimizer_queue += ['registerize']
diff --git a/src/settings.js b/src/settings.js
index 10e93975..b33ea7b3 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -125,6 +125,11 @@ var INLINING_LIMIT = 0; // A limit on inlining. If 0, we will inline normally i
// we will prevent inlining of functions of this size or larger
// in closure. 50 is a reasonable setting if you do not want
// inlining
+var OUTLINING_LIMIT = 0; // A function size above which we try to automatically break up
+ // functions into smaller ones, to avoid the downsides of very
+ // large functions (JS engines often compile them very slowly,
+ // compile them with lower optimizations, or do not optimize them
+ // at all). If 0, we do not perform outlining at all.
// Generated code debugging options
var SAFE_HEAP = 0; // Check each write to the heap, for example, this will give a clear