Ignore:
Timestamp:
Jul 1, 2008, 9:21:43 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-01 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Optimized a[n] get and put for cases where n is an immediate unsigned
value.


SunSpider says 3.5% faster.

File:
1 edited

Legend:

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

    r34821 r34943  
    7070    {
    7171        return (getTag(v) == NumberType);
     72    }
     73   
     74    static ALWAYS_INLINE bool isPositiveNumber(const JSValue* v)
     75    {
     76        // A single mask to check for the sign bit and the number tag all at once.
     77        return (reinterpret_cast<uintptr_t>(v) & (0x80000000 | NumberType)) == NumberType;
    7278    }
    7379   
     
    329335ALWAYS_INLINE bool JSImmediate::getUInt32(const JSValue* v, uint32_t& i)
    330336{
    331     const int32_t si = static_cast<int32_t>(unTag(v)) >> 2;
    332     i = si;
    333     return isNumber(v) & (si >= 0);
     337    i = static_cast<uintptr_t>(unTag(v)) >> 2;
     338    return isPositiveNumber(v);
    334339}
    335340
Note: See TracChangeset for help on using the changeset viewer.