Ignore:
Timestamp:
Jan 9, 2009, 4:14:25 PM (17 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:
File:
1 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();
Note: See TracChangeset for help on using the changeset viewer.