aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index ff6aee67..7d72b7b8 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -3001,7 +3001,7 @@ function outline(ast) {
// Try to flatten out code as much as possible, to make outlining more feasible.
function flatten(func, asmData) {
- var minSize = sizeToOutline;
+ var minSize = extraInfo.sizeToOutline/4;
var helperId = 0;
function getHelper() {
while (1) {
@@ -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;