Ignore:
Timestamp:
May 30, 2008, 1:10:38 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases

Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
parameter to 0...31.

0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.

  • VM/Machine.cpp: (KJS::Machine::privateExecute): Added fast paths for >>> and <<.
  • kjs/JSImmediate.h: (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result to unsigned.
File:
1 edited

Legend:

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

    r34258 r34265  
    168168    static JSObject* toObject(const JSValue*, ExecState*);
    169169    static UString toString(const JSValue*);
     170    static uint32_t toTruncatedUInt32(const JSValue*);
    170171    static JSType type(const JSValue*);
    171172
     
    220221    uintptr_t bits = unTag(v);
    221222    return (bits != 0) & (JSImmediate::getTag(v) != UndefinedType);
     223}
     224
     225ALWAYS_INLINE uint32_t JSImmediate::toTruncatedUInt32(const JSValue* v)
     226{
     227    ASSERT(isImmediate(v));
     228    return static_cast<uint32_t>(reinterpret_cast<intptr_t>(v) >> 2);
    222229}
    223230
Note: See TracChangeset for help on using the changeset viewer.