Ignore:
Timestamp:
Oct 27, 2007, 7:48:34 AM (18 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
  • kjs/object.h: Removed redundant includes.
  • kjs/value.h: Ditto.
File:
1 edited

Legend:

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

    r26950 r27149  
    2525#include "JSType.h"
    2626#include <wtf/Assertions.h>
     27#include <wtf/AlwaysInline.h>
    2728#include <stdarg.h>
    2829#include <stdint.h>
     
    6061class JSImmediate {
    6162public:
    62     static bool isImmediate(const JSValue* v)
     63    static ALWAYS_INLINE bool isImmediate(const JSValue* v)
    6364    {
    6465        return getTag(v) != 0;
    6566    }
    6667   
    67     static bool isNumber(const JSValue* v)
     68    static ALWAYS_INLINE bool isNumber(const JSValue* v)
    6869    {
    6970        return (getTag(v) == NumberType);
    7071    }
    7172   
    72     static bool isBoolean(const JSValue* v)
     73    static ALWAYS_INLINE bool isBoolean(const JSValue* v)
    7374    {
    7475        return (getTag(v) == BooleanType);
     
    7677   
    7778    // Since we have room for only 3 unique tags, null and undefined have to share.
    78     static bool isUndefinedOrNull(const JSValue* v)
     79    static ALWAYS_INLINE bool isUndefinedOrNull(const JSValue* v)
    7980    {
    8081        return (getTag(v) == UndefinedType);
     
    103104    static const uintptr_t TagMask = 3; // type tags are 2 bits long
    104105   
    105     static JSValue* tag(uintptr_t bits, uintptr_t tag)
     106    static ALWAYS_INLINE JSValue* tag(uintptr_t bits, uintptr_t tag)
    106107    {
    107108        return reinterpret_cast<JSValue*>(bits | tag);
    108109    }
    109110   
    110     static uintptr_t unTag(const JSValue* v)
     111    static ALWAYS_INLINE uintptr_t unTag(const JSValue* v)
    111112    {
    112113        return reinterpret_cast<uintptr_t>(v) & ~TagMask;
    113114    }
    114115   
    115     static uintptr_t getTag(const JSValue* v)
     116    static ALWAYS_INLINE uintptr_t getTag(const JSValue* v)
    116117    {
    117118        return reinterpret_cast<uintptr_t>(v) & TagMask;
     
    146147    static const uint32_t zeroAsBits = 0x0;
    147148
    148     static JSValue* fromDouble(double d)
     149    static ALWAYS_INLINE JSValue* fromDouble(double d)
    149150    {
    150151        FloatUnion floatUnion;
     
    164165    }
    165166
    166     static float toFloat(const JSValue* v)
     167    static ALWAYS_INLINE float toFloat(const JSValue* v)
    167168    {
    168169        ASSERT(isImmediate(v));
     
    173174    }
    174175
    175     static double toDouble(const JSValue* v)
     176    static ALWAYS_INLINE double toDouble(const JSValue* v)
    176177    {
    177178        return toFloat(v);
    178179    }
    179180
    180     static bool getTruncatedInt32(const JSValue* v, int32_t& i)
     181    static ALWAYS_INLINE bool getTruncatedInt32(const JSValue* v, int32_t& i)
    181182    {
    182183        float f = toFloat(v);
     
    187188    }
    188189
    189     static bool getTruncatedUInt32(const JSValue* v, uint32_t& i)
     190    static ALWAYS_INLINE bool getTruncatedUInt32(const JSValue* v, uint32_t& i)
    190191    {
    191192        float f = toFloat(v);
     
    202203    static const uint64_t zeroAsBits = 0x0;
    203204
    204     static JSValue* fromDouble(double d)
     205    static ALWAYS_INLINE JSValue* fromDouble(double d)
    205206    {
    206207        DoubleUnion doubleUnion;
     
    214215    }
    215216
    216     static double toDouble(const JSValue* v)
     217    static ALWAYS_INLINE double toDouble(const JSValue* v)
    217218    {
    218219        ASSERT(isImmediate(v));
     
    223224    }
    224225
    225     static bool getTruncatedInt32(const JSValue* v, int32_t& i)
     226    static ALWAYS_INLINE bool getTruncatedInt32(const JSValue* v, int32_t& i)
    226227    {
    227228        double d = toDouble(v);
     
    232233    }
    233234
    234     static bool getTruncatedUInt32(const JSValue* v, uint32_t& i)
     235    static ALWAYS_INLINE bool getTruncatedUInt32(const JSValue* v, uint32_t& i)
    235236    {
    236237        double d = toDouble(v);
     
    242243};
    243244
    244 inline JSValue* JSImmediate::trueImmediate() { return tag(FPBitValues<is32bit, is64bit>::oneAsBits, BooleanType); }
    245 inline JSValue* JSImmediate::falseImmediate() { return tag(FPBitValues<is32bit, is64bit>::zeroAsBits, BooleanType); }
    246 inline JSValue* JSImmediate::NaNImmediate() { return tag(FPBitValues<is32bit, is64bit>::nanAsBits, NumberType); }
    247 inline JSValue* JSImmediate::undefinedImmediate() { return tag(FPBitValues<is32bit, is64bit>::nanAsBits, UndefinedType); }
    248 inline JSValue* JSImmediate::nullImmediate() { return tag(FPBitValues<is32bit, is64bit>::zeroAsBits, UndefinedType); }
    249 
    250 inline bool JSImmediate::toBoolean(const JSValue* v)
     245ALWAYS_INLINE JSValue* JSImmediate::trueImmediate() { return tag(FPBitValues<is32bit, is64bit>::oneAsBits, BooleanType); }
     246ALWAYS_INLINE JSValue* JSImmediate::falseImmediate() { return tag(FPBitValues<is32bit, is64bit>::zeroAsBits, BooleanType); }
     247ALWAYS_INLINE JSValue* JSImmediate::NaNImmediate() { return tag(FPBitValues<is32bit, is64bit>::nanAsBits, NumberType); }
     248ALWAYS_INLINE JSValue* JSImmediate::undefinedImmediate() { return tag(FPBitValues<is32bit, is64bit>::nanAsBits, UndefinedType); }
     249ALWAYS_INLINE JSValue* JSImmediate::nullImmediate() { return tag(FPBitValues<is32bit, is64bit>::zeroAsBits, UndefinedType); }
     250
     251ALWAYS_INLINE bool JSImmediate::toBoolean(const JSValue* v)
    251252{
    252253    ASSERT(isImmediate(v));
     
    259260}
    260261
    261 inline JSValue* JSImmediate::fromDouble(double d)
     262ALWAYS_INLINE JSValue* JSImmediate::fromDouble(double d)
    262263{
    263264    return FPBitValues<is32bit, is64bit>::fromDouble(d);
    264265}
    265266
    266 inline double JSImmediate::toDouble(const JSValue* v)
     267ALWAYS_INLINE double JSImmediate::toDouble(const JSValue* v)
    267268{
    268269    return FPBitValues<is32bit, is64bit>::toDouble(v);
    269270}
    270271
    271 inline bool JSImmediate::getUInt32(const JSValue* v, uint32_t& i)
     272ALWAYS_INLINE bool JSImmediate::getUInt32(const JSValue* v, uint32_t& i)
    272273{
    273274    double d = toDouble(v);
     
    276277}
    277278
    278 inline bool JSImmediate::getTruncatedInt32(const JSValue* v, int32_t& i)
     279ALWAYS_INLINE bool JSImmediate::getTruncatedInt32(const JSValue* v, int32_t& i)
    279280{
    280281    return FPBitValues<is32bit, is64bit>::getTruncatedInt32(v, i);
    281282}
    282283
    283 inline bool JSImmediate::getTruncatedUInt32(const JSValue* v, uint32_t& i)
     284ALWAYS_INLINE bool JSImmediate::getTruncatedUInt32(const JSValue* v, uint32_t& i)
    284285{
    285286    return FPBitValues<is32bit, is64bit>::getTruncatedUInt32(v, i);
Note: See TracChangeset for help on using the changeset viewer.