aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-13 16:00:17 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-13 16:00:17 -0700
commitdf16c302a90998f4daf1b9f2e71ef0e8e1b26dda (patch)
tree86bc05fda3b96ff9a6ac5215edd816afe4c15e65
parentce965a4e68540009cfe9d047a55cfe54f6e5605d (diff)
exit outlining when we are done, as early as possible
-rw-r--r--tools/js-optimizer.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index ff6aee67..f15b2fe1 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -3475,6 +3475,9 @@ function outline(ast) {
}
}
}
+ function done() {
+ return asmData.splitCounter >= asmData.maxOutlinings || measureSize(func) <= extraInfo.sizeToOutline;
+ }
while (1) {
i--;
calcMinIndex(); // TODO: optimize
@@ -3530,7 +3533,7 @@ function outline(ast) {
if (ret.length > pre) {
// we outlined recursively, reset our state here
//printErr('successful outline in recursion ' + func[1] + ' due to recursive in level ' + level);
- if (measureSize(func) <= extraInfo.sizeToOutline) break;
+ if (done()) break;
end = i-1;
sizeSeen = 0;
canRestart = true;
@@ -3570,7 +3573,7 @@ function outline(ast) {
if (newFuncs.length) {
ret.push.apply(ret, newFuncs);
}
- if (measureSize(func) <= extraInfo.sizeToOutline) break;
+ if (done()) break;
sizeSeen = 0;
end = i-1;
canRestart = true;