aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-28 14:41:46 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-28 14:41:46 -0800
commitab12dc1380d89298f289215087ee94a65e37acca (patch)
tree42e7d5000fd36056cef88f0d91aa8ef9a67fbc63 /tools/js-optimizer.js
parent6b83482d32375fb6852cd34150890e57460d8645 (diff)
fix optimizeShifts bug
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 150b1c37..6cd1fbcc 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -527,6 +527,10 @@ function optimizeShifts(ast) {
var total = 0;
if (node[3][0] == 'num' && node[2][3][0] == 'num') {
total = ['num', sign1*node[3][1] + sign2*node[2][3][1]];
+ if (total[1] < 0) {
+ combinedShift = '<<';
+ total[1] *= -1;
+ }
if (total[1] == 0) {
// XXX this may be wrong, if we removed a |0 that assumed we had this >> which |0's anyhow!
return node[2][2];