Ignore:
Timestamp:
Nov 3, 2007, 8:37:21 PM (18 years ago)
Author:
mjs
Message:

Reviewed by Sam.


  • remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup

It turns out that doing this check costs more than it saves.


  • kjs/JSImmediate.h: (KJS::JSImmediate::fromDouble):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSImmediate.h

    r27149 r27416  
    156156            return 0;
    157157
    158         // check for data loss from conversion to float
    159         // The d == d check is to allow NaN - it does not
    160         // compare equal to itself, but we do want to allow it
    161         if (floatUnion.asFloat != d && d == d)
    162             return 0;
    163 
    164         return tag(floatUnion.asBits, NumberType);
     158        // check for data loss from conversion to float. This
     159        // unfortunately also rejects NaN, however, it costs more to
     160        // do a check that will include NaN than is saved by letting
     161        // NaN be an immediate.
     162        if (floatUnion.asFloat == d)
     163            return tag(floatUnion.asBits, NumberType);
     164
     165        return 0;
    165166    }
    166167
Note: See TracChangeset for help on using the changeset viewer.