Ignore:
Timestamp:
Nov 8, 2007, 2:23:39 PM (18 years ago)
Author:
oliver
Message:

Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).

Reviewed by Sam.

This only improves bitwise-and performance, as the additional logic required
for similar code paths on or, xor, and shifting requires additional operations
and branches that negate (and in certain cases, regress) any advantage we might
otherwise receive.

This improves performance on all bitop tests, the cryptography tests, as well as
the string-base64 and string-unpack-code tests. No significant degradation on
any other tests.

File:
1 edited

Legend:

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

    r27606 r27615  
    8383    }
    8484
     85    static ALWAYS_INLINE bool areBothImmediateNumbers(const JSValue* v1, const JSValue* v2)
     86    {
     87        return (reinterpret_cast<uintptr_t>(v1) & reinterpret_cast<uintptr_t>(v2) & TagMask) == NumberType;
     88    }
     89
     90    static ALWAYS_INLINE JSValue* andImmediateNumbers(const JSValue* v1, const JSValue* v2)
     91    {
     92        ASSERT(areBothImmediateNumbers(v1, v2));
     93        return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) & reinterpret_cast<uintptr_t>(v2));
     94    }
     95
    8596    static JSValue* fromDouble(double d);
    8697    static double toDouble(const JSValue*);
Note: See TracChangeset for help on using the changeset viewer.