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.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 7bb0b403..435a64de 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -497,7 +497,8 @@ function optimizeShifts(ast) {
more = false;
traverse(fun, function(node, type) {
if (node[0] == 'binary' && node[1] in SIMPLE_SHIFTS && node[2][0] == 'binary' && node[2][1] in SIMPLE_SHIFTS &&
- node[3][0] == 'num' && node[2][3][0] == 'num') { // do not turn a << b << c into a << b + c; while logically identical, it is slower
+ node[3][0] == 'num' && node[2][3][0] == 'num' && // do not turn a << b << c into a << b + c; while logically identical, it is slower
+ Math.abs(node[3][1]) < 8 && Math.abs(node[2][3][1]) < 8) { // do not modify things like x << 24 >> 24 (which removes some bits)
more = true;
var combinedShift = '>>';
var sign1 = node[1] == '>>' ? 1 : -1;