diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-08-21 16:27:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-08-21 17:09:49 -0700 |
commit | 8b2ebb29c5fe656137f3f82c85197423dc29fcdd (patch) | |
tree | cda67ddd6d164e13b5b17acad4790b1c115381b5 | |
parent | 9275eafe6d7c40302ca3f600e39634e16e8718c3 (diff) |
tweak switch heuristics
-rw-r--r-- | src/jsifier.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 9bc6eb9c..f0a184b1 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1136,7 +1136,7 @@ function JSify(data, functionsOnly, givenFunctions) { item.switchLabels.forEach(function(switchLabel) { maxx = Math.max(maxx, Math.abs(parseInt(switchLabel.value))); }); - var useIfs = !(maxx <= 2*1024*1024 && (maxx/item.switchLabels.length) < 10*1024); + var useIfs = (item.switchLabels.length+1) < 8 || maxx > 2*1024*1024 || (maxx/item.switchLabels.length) > 10*1024; // heuristics if (VERBOSE && useIfs && item.switchLabels.length > 2) { warn('not optimizing llvm switch into js switch because ' + [maxx, maxx/item.switchLabels.length]); } |