copy/v86 — pull request #2 by subzey (2013-11-07 17:01:55+00:00)
Title: isNaN optimizations

This change goal is get rid of unneeded `isNaN` checks.

1. Change `isNaN(n) || n === Infinity || n === -Infinity` to `!isFinite(n)` as it actually does the same (see http://es5.github.io/#x15.1.2.5).

2. Rearrange
```javascript
if (isNaN(n) || n < -128 || n > 127){
doInvalidStuff();
} else {
doStuff();
}
```
to
```javascript
if (n >= -128 && n < 127){
doStuff();
} else {
doInvalidStuff();
}
```
as any comparison yields `false` if `n` is NaN, and whole statement without `isNaN` runs much faster (9 times faster in V8!), see http://jsperf.com/separate-isnan.