Changeset 39769 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Jan 9, 2009, 4:14:25 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-01-09 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Stage two of converting JSValue from a pointer to a class type.
Remove the class JSValue. The functionallity has been transitioned
into the wrapper class type JSValuePtr.

The last stage will be to rename JSValuePtr to JSValue, remove the
overloaded -> operator, and switch operations on JSValuePtrs from
using '->' to use '.' instead.

  • API/APICast.h:
  • JavaScriptCore.exp:
  • runtime/JSCell.h: (JSC::asCell): (JSC::JSValuePtr::asCell): (JSC::JSValuePtr::isNumber): (JSC::JSValuePtr::isString): (JSC::JSValuePtr::isGetterSetter): (JSC::JSValuePtr::isObject): (JSC::JSValuePtr::getNumber): (JSC::JSValuePtr::getString): (JSC::JSValuePtr::getObject): (JSC::JSValuePtr::getCallData): (JSC::JSValuePtr::getConstructData): (JSC::JSValuePtr::getUInt32): (JSC::JSValuePtr::getTruncatedInt32): (JSC::JSValuePtr::getTruncatedUInt32): (JSC::JSValuePtr::mark): (JSC::JSValuePtr::marked): (JSC::JSValuePtr::toPrimitive): (JSC::JSValuePtr::getPrimitiveNumber): (JSC::JSValuePtr::toBoolean): (JSC::JSValuePtr::toNumber): (JSC::JSValuePtr::toString): (JSC::JSValuePtr::toObject): (JSC::JSValuePtr::toThisObject): (JSC::JSValuePtr::needsThisConversion): (JSC::JSValuePtr::toThisString): (JSC::JSValuePtr::getJSNumber):
  • runtime/JSImmediate.h: (JSC::JSValuePtr::isUndefined): (JSC::JSValuePtr::isNull): (JSC::JSValuePtr::isUndefinedOrNull): (JSC::JSValuePtr::isBoolean): (JSC::JSValuePtr::getBoolean): (JSC::JSValuePtr::toInt32): (JSC::JSValuePtr::toUInt32):
  • runtime/JSNumberCell.h: (JSC::JSValuePtr::uncheckedGetNumber): (JSC::JSValuePtr::toJSNumber):
  • runtime/JSObject.h: (JSC::JSValuePtr::isObject): (JSC::JSValuePtr::get): (JSC::JSValuePtr::put):
  • runtime/JSString.h: (JSC::JSValuePtr::toThisJSString):
  • runtime/JSValue.cpp: (JSC::JSValuePtr::toInteger): (JSC::JSValuePtr::toIntegerPreserveNaN): (JSC::JSValuePtr::toInt32SlowCase): (JSC::JSValuePtr::toUInt32SlowCase):
  • runtime/JSValue.h: (JSC::JSValuePtr::makeImmediate): (JSC::JSValuePtr::immediateValue): (JSC::JSValuePtr::JSValuePtr): (JSC::JSValuePtr::operator->): (JSC::JSValuePtr::operator bool): (JSC::JSValuePtr::operator==): (JSC::JSValuePtr::operator!=): (JSC::JSValuePtr::encode): (JSC::JSValuePtr::decode): (JSC::JSValuePtr::toFloat): (JSC::JSValuePtr::asValue): (JSC::operator==): (JSC::operator!=):

WebCore:

2009-01-09 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Delete references to JSValue, removing this class.

  • bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::self):
  • bindings/js/ScriptCallStack.h:
Location:
trunk/JavaScriptCore/runtime
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSCell.h

    r39670 r39769  
    2424#define JSCell_h
    2525
     26#include <wtf/Noncopyable.h>
    2627#include "Structure.h"
    2728#include "JSValue.h"
     
    3132namespace JSC {
    3233
    33     class JSCell : public JSValue {
     34    class JSCell : Noncopyable {
    3435        friend class JIT;
    3536        friend class GetterSetter;
     
    3940        friend class JSPropertyNameIterator;
    4041        friend class JSString;
    41         friend class JSValue;
     42        friend class JSValuePtr;
    4243        friend class Interpreter;
    4344
     
    113114    inline JSCell* asCell(JSValuePtr value)
    114115    {
    115         ASSERT(!JSImmediate::isImmediate(value));
    116116        return value->asCell();
    117117    }
     
    156156    }
    157157
    158     ALWAYS_INLINE JSCell* JSValue::asCell() const
     158    ALWAYS_INLINE JSCell* JSValuePtr::asCell() const
    159159    {
    160160        ASSERT(!JSImmediate::isImmediate(asValue()));
    161         return const_cast<JSCell*>(reinterpret_cast<const JSCell*>(this));
     161        return m_ptr;
    162162    }
    163163
     
    173173    // --- JSValue inlines ----------------------------
    174174
    175     inline bool JSValue::isNumber() const
     175    inline bool JSValuePtr::isNumber() const
    176176    {
    177177        return JSImmediate::isNumber(asValue()) || (!JSImmediate::isImmediate(asValue()) && asCell()->isNumber());
    178178    }
    179179
    180     inline bool JSValue::isString() const
     180    inline bool JSValuePtr::isString() const
    181181    {
    182182        return !JSImmediate::isImmediate(asValue()) && asCell()->isString();
    183183    }
    184184
    185     inline bool JSValue::isGetterSetter() const
     185    inline bool JSValuePtr::isGetterSetter() const
    186186    {
    187187        return !JSImmediate::isImmediate(asValue()) && asCell()->isGetterSetter();
    188188    }
    189189
    190     inline bool JSValue::isObject() const
     190    inline bool JSValuePtr::isObject() const
    191191    {
    192192        return !JSImmediate::isImmediate(asValue()) && asCell()->isObject();
    193193    }
    194194
    195     inline double JSValue::getNumber() const
     195    inline double JSValuePtr::getNumber() const
    196196    {
    197197        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asCell()->getNumber();
    198198    }
    199199
    200     inline bool JSValue::getString(UString& s) const
     200    inline bool JSValuePtr::getString(UString& s) const
    201201    {
    202202        return !JSImmediate::isImmediate(asValue()) && asCell()->getString(s);
    203203    }
    204204
    205     inline UString JSValue::getString() const
     205    inline UString JSValuePtr::getString() const
    206206    {
    207207        return JSImmediate::isImmediate(asValue()) ? UString() : asCell()->getString();
    208208    }
    209209
    210     inline JSObject* JSValue::getObject() const
     210    inline JSObject* JSValuePtr::getObject() const
    211211    {
    212212        return JSImmediate::isImmediate(asValue()) ? 0 : asCell()->getObject();
    213213    }
    214214
    215     inline CallType JSValue::getCallData(CallData& callData)
     215    inline CallType JSValuePtr::getCallData(CallData& callData)
    216216    {
    217217        return JSImmediate::isImmediate(asValue()) ? CallTypeNone : asCell()->getCallData(callData);
    218218    }
    219219
    220     inline ConstructType JSValue::getConstructData(ConstructData& constructData)
     220    inline ConstructType JSValuePtr::getConstructData(ConstructData& constructData)
    221221    {
    222222        return JSImmediate::isImmediate(asValue()) ? ConstructTypeNone : asCell()->getConstructData(constructData);
    223223    }
    224224
    225     ALWAYS_INLINE bool JSValue::getUInt32(uint32_t& v) const
     225    ALWAYS_INLINE bool JSValuePtr::getUInt32(uint32_t& v) const
    226226    {
    227227        return JSImmediate::isImmediate(asValue()) ? JSImmediate::getUInt32(asValue(), v) : asCell()->getUInt32(v);
    228228    }
    229229
    230     ALWAYS_INLINE bool JSValue::getTruncatedInt32(int32_t& v) const
     230    ALWAYS_INLINE bool JSValuePtr::getTruncatedInt32(int32_t& v) const
    231231    {
    232232        return JSImmediate::isImmediate(asValue()) ? JSImmediate::getTruncatedInt32(asValue(), v) : asCell()->getTruncatedInt32(v);
    233233    }
    234234
    235     inline bool JSValue::getTruncatedUInt32(uint32_t& v) const
     235    inline bool JSValuePtr::getTruncatedUInt32(uint32_t& v) const
    236236    {
    237237        return JSImmediate::isImmediate(asValue()) ? JSImmediate::getTruncatedUInt32(asValue(), v) : asCell()->getTruncatedUInt32(v);
    238238    }
    239239
    240     inline void JSValue::mark()
     240    inline void JSValuePtr::mark()
    241241    {
    242242        asCell()->mark(); // callers should check !marked() before calling mark(), so this should only be called with cells
    243243    }
    244244
    245     inline bool JSValue::marked() const
     245    inline bool JSValuePtr::marked() const
    246246    {
    247247        return JSImmediate::isImmediate(asValue()) || asCell()->marked();
    248248    }
    249249
    250     inline JSValuePtr JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
     250    inline JSValuePtr JSValuePtr::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
    251251    {
    252252        return JSImmediate::isImmediate(asValue()) ? asValue() : asCell()->toPrimitive(exec, preferredType);
    253253    }
    254254
    255     inline bool JSValue::getPrimitiveNumber(ExecState* exec, double& number, JSValuePtr& value)
     255    inline bool JSValuePtr::getPrimitiveNumber(ExecState* exec, double& number, JSValuePtr& value)
    256256    {
    257257        if (JSImmediate::isImmediate(asValue())) {
     
    263263    }
    264264
    265     inline bool JSValue::toBoolean(ExecState* exec) const
     265    inline bool JSValuePtr::toBoolean(ExecState* exec) const
    266266    {
    267267        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toBoolean(asValue()) : asCell()->toBoolean(exec);
    268268    }
    269269
    270     ALWAYS_INLINE double JSValue::toNumber(ExecState* exec) const
     270    ALWAYS_INLINE double JSValuePtr::toNumber(ExecState* exec) const
    271271    {
    272272        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asCell()->toNumber(exec);
    273273    }
    274274
    275     inline UString JSValue::toString(ExecState* exec) const
     275    inline UString JSValuePtr::toString(ExecState* exec) const
    276276    {
    277277        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toString(asValue()) : asCell()->toString(exec);
    278278    }
    279279
    280     inline JSObject* JSValue::toObject(ExecState* exec) const
     280    inline JSObject* JSValuePtr::toObject(ExecState* exec) const
    281281    {
    282282        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toObject(asValue(), exec) : asCell()->toObject(exec);
    283283    }
    284284
    285     inline JSObject* JSValue::toThisObject(ExecState* exec) const
     285    inline JSObject* JSValuePtr::toThisObject(ExecState* exec) const
    286286    {
    287287        if (UNLIKELY(JSImmediate::isImmediate(asValue())))
     
    290290    }
    291291
    292     inline bool JSValue::needsThisConversion() const
     292    inline bool JSValuePtr::needsThisConversion() const
    293293    {
    294294        if (UNLIKELY(JSImmediate::isImmediate(asValue())))
     
    297297    }
    298298
    299     inline UString JSValue::toThisString(ExecState* exec) const
     299    inline UString JSValuePtr::toThisString(ExecState* exec) const
    300300    {
    301301        return JSImmediate::isImmediate(asValue()) ? JSImmediate::toString(asValue()) : asCell()->toThisString(exec);
    302302    }
    303303
    304     inline JSValuePtr JSValue::getJSNumber()
     304    inline JSValuePtr JSValuePtr::getJSNumber()
    305305    {
    306306        return JSImmediate::isNumber(asValue()) ? asValue() : JSImmediate::isImmediate(asValue()) ? noValue() : asCell()->getJSNumber();
  • trunk/JavaScriptCore/runtime/JSImmediate.h

    r39738 r39769  
    3838    class JSCell;
    3939    class JSObject;
    40     class JSValue;
    4140    class UString;
    4241
     
    506505    uint32_t toUInt32SlowCase(double, bool& ok);
    507506
    508     inline bool JSValue::isUndefined() const
     507    inline bool JSValuePtr::isUndefined() const
    509508    {
    510509        return asValue() == jsUndefined();
    511510    }
    512511
    513     inline bool JSValue::isNull() const
     512    inline bool JSValuePtr::isNull() const
    514513    {
    515514        return asValue() == jsNull();
    516515    }
    517516
    518     inline bool JSValue::isUndefinedOrNull() const
     517    inline bool JSValuePtr::isUndefinedOrNull() const
    519518    {
    520519        return JSImmediate::isUndefinedOrNull(asValue());
    521520    }
    522521
    523     inline bool JSValue::isBoolean() const
     522    inline bool JSValuePtr::isBoolean() const
    524523    {
    525524        return JSImmediate::isBoolean(asValue());
    526525    }
    527526
    528     inline bool JSValue::getBoolean(bool& v) const
     527    inline bool JSValuePtr::getBoolean(bool& v) const
    529528    {
    530529        if (JSImmediate::isBoolean(asValue())) {
     
    536535    }
    537536
    538     inline bool JSValue::getBoolean() const
     537    inline bool JSValuePtr::getBoolean() const
    539538    {
    540539        return asValue() == jsBoolean(true);
    541540    }
    542541
    543     ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const
     542    ALWAYS_INLINE int32_t JSValuePtr::toInt32(ExecState* exec) const
    544543    {
    545544        int32_t i;
     
    550549    }
    551550
    552     inline uint32_t JSValue::toUInt32(ExecState* exec) const
     551    inline uint32_t JSValuePtr::toUInt32(ExecState* exec) const
    553552    {
    554553        uint32_t i;
     
    577576    }
    578577
    579     inline int32_t JSValue::toInt32(ExecState* exec, bool& ok) const
     578    inline int32_t JSValuePtr::toInt32(ExecState* exec, bool& ok) const
    580579    {
    581580        int32_t i;
     
    587586    }
    588587
    589     inline uint32_t JSValue::toUInt32(ExecState* exec, bool& ok) const
     588    inline uint32_t JSValuePtr::toUInt32(ExecState* exec, bool& ok) const
    590589    {
    591590        uint32_t i;
  • trunk/JavaScriptCore/runtime/JSNumberCell.h

    r39670 r39769  
    231231    // --- JSValue inlines ----------------------------
    232232
    233     inline double JSValue::uncheckedGetNumber() const
     233    inline double JSValuePtr::uncheckedGetNumber() const
    234234    {
    235235        ASSERT(JSImmediate::isImmediate(asValue()) || asCell()->isNumber());
     
    253253    }
    254254
    255     ALWAYS_INLINE JSValuePtr JSValue::toJSNumber(ExecState* exec) const
     255    ALWAYS_INLINE JSValuePtr JSValuePtr::toJSNumber(ExecState* exec) const
    256256    {
    257257        return JSImmediate::isNumber(asValue()) ? asValue() : jsNumber(exec, this->toNumber(exec));
  • trunk/JavaScriptCore/runtime/JSObject.h

    r39670 r39769  
    269269
    270270// this method is here to be after the inline declaration of JSCell::isObject
    271 inline bool JSValue::isObject(const ClassInfo* classInfo) const
     271inline bool JSValuePtr::isObject(const ClassInfo* classInfo) const
    272272{
    273273    return !JSImmediate::isImmediate(asValue()) && asCell()->isObject(classInfo);
     
    466466}
    467467
    468 inline JSValuePtr JSValue::get(ExecState* exec, const Identifier& propertyName) const
    469 {
    470     PropertySlot slot(this);
     468inline JSValuePtr JSValuePtr::get(ExecState* exec, const Identifier& propertyName) const
     469{
     470    PropertySlot slot(asValue());
    471471    return get(exec, propertyName, slot);
    472472}
    473473
    474 inline JSValuePtr JSValue::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const
     474inline JSValuePtr JSValuePtr::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const
    475475{
    476476    if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
     
    492492}
    493493
    494 inline JSValuePtr JSValue::get(ExecState* exec, unsigned propertyName) const
    495 {
    496     PropertySlot slot(this);
     494inline JSValuePtr JSValuePtr::get(ExecState* exec, unsigned propertyName) const
     495{
     496    PropertySlot slot(asValue());
    497497    return get(exec, propertyName, slot);
    498498}
    499499
    500 inline JSValuePtr JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot& slot) const
     500inline JSValuePtr JSValuePtr::get(ExecState* exec, unsigned propertyName, PropertySlot& slot) const
    501501{
    502502    if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
     
    518518}
    519519
    520 inline void JSValue::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
     520inline void JSValuePtr::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
    521521{
    522522    if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
     
    527527}
    528528
    529 inline void JSValue::put(ExecState* exec, unsigned propertyName, JSValuePtr value)
     529inline void JSValuePtr::put(ExecState* exec, unsigned propertyName, JSValuePtr value)
    530530{
    531531    if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
  • trunk/JavaScriptCore/runtime/JSString.h

    r39670 r39769  
    205205    // --- JSValue inlines ----------------------------
    206206
    207     inline JSString* JSValue::toThisJSString(ExecState* exec)
     207    inline JSString* JSValuePtr::toThisJSString(ExecState* exec)
    208208    {
    209209        return JSImmediate::isImmediate(asValue()) ? jsString(exec, JSImmediate::toString(asValue())) : asCell()->toThisJSString(exec);
  • trunk/JavaScriptCore/runtime/JSValue.cpp

    r37938 r39769  
    3232
    3333// ECMA 9.4
    34 double JSValue::toInteger(ExecState* exec) const
     34double JSValuePtr::toInteger(ExecState* exec) const
    3535{
    3636    int32_t i;
     
    4141}
    4242
    43 double JSValue::toIntegerPreserveNaN(ExecState* exec) const
     43double JSValuePtr::toIntegerPreserveNaN(ExecState* exec) const
    4444{
    4545    int32_t i;
     
    6969}
    7070
    71 int32_t JSValue::toInt32SlowCase(ExecState* exec, bool& ok) const
     71int32_t JSValuePtr::toInt32SlowCase(ExecState* exec, bool& ok) const
    7272{
    7373    return JSC::toInt32SlowCase(toNumber(exec), ok);
     
    9292}
    9393
    94 uint32_t JSValue::toUInt32SlowCase(ExecState* exec, bool& ok) const
     94uint32_t JSValuePtr::toUInt32SlowCase(ExecState* exec, bool& ok) const
    9595{
    9696    return JSC::toUInt32SlowCase(toNumber(exec), ok);
    9797}
    9898
    99 float JSValue::toFloat(ExecState* exec) const
    100 {
    101     return static_cast<float>(toNumber(exec));
    102 }
    103 
    10499} // namespace JSC
  • trunk/JavaScriptCore/runtime/JSValue.h

    r39670 r39769  
    2929#include "CallData.h"
    3030#include "ConstructData.h"
    31 #include <wtf/Noncopyable.h>
    3231
    3332namespace JSC {
     
    4645    enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString };
    4746
    48     class JSValue : Noncopyable {
    49     protected:
    50         JSValue() { }
    51         virtual ~JSValue() { }
    52 
     47    class JSImmediate;
     48    class JSValueEncodedAsPointer;
     49
     50    class JSValuePtr {
     51        friend class JSImmediate;
     52
     53        static JSValuePtr makeImmediate(intptr_t value)
     54        {
     55            return JSValuePtr(reinterpret_cast<JSCell*>(value));
     56        }
     57
     58        intptr_t immediateValue()
     59        {
     60            return reinterpret_cast<intptr_t>(m_ptr);
     61        }
     62       
    5363    public:
     64        JSValuePtr()
     65            : m_ptr(0)
     66        {
     67        }
     68
     69        JSValuePtr(JSCell* ptr)
     70            : m_ptr(ptr)
     71        {
     72        }
     73
     74        JSValuePtr(const JSCell* ptr)
     75            : m_ptr(const_cast<JSCell*>(ptr))
     76        {
     77        }
     78
     79        JSValuePtr* operator->() const
     80        {
     81            return const_cast<JSValuePtr*>(this);
     82        }
     83
     84        operator bool() const
     85        {
     86            return m_ptr;
     87        }
     88
     89        bool operator==(const JSValuePtr other) const
     90        {
     91            return m_ptr == other.m_ptr;
     92        }
     93
     94        bool operator!=(const JSValuePtr other) const
     95        {
     96            return m_ptr != other.m_ptr;
     97        }
     98
     99        static JSValueEncodedAsPointer* encode(JSValuePtr value)
     100        {
     101            return reinterpret_cast<JSValueEncodedAsPointer*>(value.m_ptr);
     102        }
     103
     104        static JSValuePtr decode(JSValueEncodedAsPointer* ptr)
     105        {
     106            return JSValuePtr(reinterpret_cast<JSCell*>(ptr));
     107        }
     108
    54109        // Querying the type.
    55110        bool isUndefined() const;
     
    90145        double toNumber(ExecState*) const;
    91146        JSValuePtr toJSNumber(ExecState*) const; // Fast path for when you expect that the value is an immediate number.
    92 
    93147        UString toString(ExecState*) const;
    94148        JSObject* toObject(ExecState*) const;
     
    103157
    104158        // Floating point conversions.
    105         float toFloat(ExecState*) const;
     159        float toFloat(ExecState* exec) const { return static_cast<float>(toNumber(exec)); }
    106160
    107161        // Garbage collection.
     
    116170        void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&);
    117171        void put(ExecState*, unsigned propertyName, JSValuePtr);
    118         bool deleteProperty(ExecState*, const Identifier& propertyName);
    119         bool deleteProperty(ExecState*, unsigned propertyName);
    120172
    121173        bool needsThisConversion() const;
     
    126178        JSValuePtr getJSNumber(); // 0 if this is not a JSNumber or number object
    127179
    128         JSValuePtr asValue() const;
    129 
    130180        JSCell* asCell() const;
    131181
    132182    private:
    133         bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
    134         bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
     183        inline const JSValuePtr asValue() const { return *this; }
     184
    135185        int32_t toInt32SlowCase(ExecState*, bool& ok) const;
    136186        uint32_t toUInt32SlowCase(ExecState*, bool& ok) const;
     187
     188        JSCell* m_ptr;
    137189    };
    138 
    139     class JSImmediate;
    140     class JSValueEncodedAsPointer;
    141 
    142     class JSValuePtr {
    143         friend class JSImmediate;
    144 
    145         static JSValuePtr makeImmediate(intptr_t value)
    146         {
    147             return JSValuePtr(reinterpret_cast<JSValue*>(value));
    148         }
    149 
    150         intptr_t immediateValue()
    151         {
    152             return reinterpret_cast<intptr_t>(m_ptr);
    153         }
    154        
    155     public:
    156         JSValuePtr()
    157             : m_ptr(0)
    158         {
    159         }
    160 
    161         JSValuePtr(JSValue* ptr)
    162             : m_ptr(ptr)
    163         {
    164         }
    165 
    166         JSValuePtr(const JSValue* ptr)
    167             : m_ptr(const_cast<JSValue*>(ptr))
    168         {
    169         }
    170 
    171         JSValue* operator->() const
    172         {
    173             return m_ptr;
    174         }
    175 
    176         operator bool() const
    177         {
    178             return m_ptr;
    179         }
    180 
    181         bool operator==(const JSValuePtr other) const
    182         {
    183             return m_ptr == other.m_ptr;
    184         }
    185 
    186         bool operator!=(const JSValuePtr other) const
    187         {
    188             return m_ptr != other.m_ptr;
    189         }
    190 
    191         static JSValueEncodedAsPointer* encode(JSValuePtr value)
    192         {
    193             return reinterpret_cast<JSValueEncodedAsPointer*>(value.m_ptr);
    194         }
    195 
    196         static JSValuePtr decode(JSValueEncodedAsPointer* ptr)
    197         {
    198             return JSValuePtr(reinterpret_cast<JSValue*>(ptr));
    199         }
    200 
    201     private:
    202         JSValue* m_ptr;
    203     };
    204 
    205     inline JSValuePtr JSValue::asValue() const
    206     {
    207         return JSValuePtr(this);
    208     }
    209190
    210191    inline JSValuePtr noValue()
     
    213194    }
    214195
    215     inline bool operator==(const JSValuePtr a, const JSValue* b) { return a == JSValuePtr(b); }
    216     inline bool operator==(const JSValue* a, const JSValuePtr b) { return JSValuePtr(a) == b; }
    217 
    218     inline bool operator!=(const JSValuePtr a, const JSValue* b) { return a != JSValuePtr(b); }
    219     inline bool operator!=(const JSValue* a, const JSValuePtr b) { return JSValuePtr(a) != b; }
     196    inline bool operator==(const JSValuePtr a, const JSCell* b) { return a == JSValuePtr(b); }
     197    inline bool operator==(const JSCell* a, const JSValuePtr b) { return JSValuePtr(a) == b; }
     198
     199    inline bool operator!=(const JSValuePtr a, const JSCell* b) { return a != JSValuePtr(b); }
     200    inline bool operator!=(const JSCell* a, const JSValuePtr b) { return JSValuePtr(a) != b; }
    220201
    221202} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.