aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-04 11:54:12 -0500
committerAlon Zakai <alonzakai@gmail.com>2014-02-04 11:54:12 -0500
commit71c8f19c6e63539565641b5d992ba69d27e55475 (patch)
tree6c6bad04664f37ae8e938285e61090f2d9780d65 /tools/js-optimizer.js
parent3136112a0000d94024851347b3fc03e178481add (diff)
do not apply de-morgan's laws on floats, nans break them
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 905e80fc..6724e77f 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -1143,7 +1143,9 @@ function optimizeShiftsAggressive(ast) {
// or such. Simplifying these saves space and time.
function simplifyNotCompsDirect(node) {
if (node[0] === 'unary-prefix' && node[1] === '!') {
- if (node[2][0] === 'binary') {
+ // de-morgan's laws do not work on floats, due to nans >:(
+ if (node[2][0] === 'binary' && (!asm || (((node[2][2][0] === 'binary' && node[2][2][1] === '|') || node[2][2][0] === 'num') &&
+ ((node[2][3][0] === 'binary' && node[2][3][1] === '|') || node[2][3][0] === 'num')))) {
switch(node[2][1]) {
case '<': return ['binary', '>=', node[2][2], node[2][3]];
case '>': return ['binary', '<=', node[2][2], node[2][3]];