Changeset 34372 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Jun 4, 2008, 10:36:55 PM (17 years ago)
Author:
[email protected]
Message:

2008-06-04 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak.

Big cleanup of formatting and whitespace.

Location:
trunk/JavaScriptCore/kjs
Files:
11 edited

Legend:

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

    r33979 r34372  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929#ifndef CallData_h
    3030#define CallData_h
  • trunk/JavaScriptCore/kjs/JSNotAnObject.cpp

    r33979 r34372  
    3434
    3535namespace KJS {
    36     // JSValue methods
    37     JSValue *JSNotAnObject::toPrimitive(ExecState* exec, JSType) const
    38     {
    39         UNUSED_PARAM(exec);
    40         ASSERT(exec->hadException() && exec->exception() == m_exception);
    41         return m_exception;
    42     }
    43    
    44     bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue*&)
    45     {
    46         UNUSED_PARAM(exec);
    47         ASSERT(exec->hadException() && exec->exception() == m_exception);
    48         return false;
    49     }
    50    
    51     bool JSNotAnObject::toBoolean(ExecState* exec) const
    52     {
    53         UNUSED_PARAM(exec);
    54         ASSERT(exec->hadException() && exec->exception() == m_exception);
    55         return false;
    56     }
    57    
    58     double JSNotAnObject::toNumber(ExecState* exec) const
    59     {
    60         UNUSED_PARAM(exec);
    61         ASSERT(exec->hadException() && exec->exception() == m_exception);
    62         return NaN;
    63     }
    6436
    65     UString JSNotAnObject::toString(ExecState* exec) const
    66     {
    67         UNUSED_PARAM(exec);
    68         ASSERT(exec->hadException() && exec->exception() == m_exception);
    69         return "";
    70     }
    71    
    72     JSObject *JSNotAnObject::toObject(ExecState* exec) const
    73     {
    74         UNUSED_PARAM(exec);
    75         ASSERT(exec->hadException() && exec->exception() == m_exception);
    76         return m_exception;
    77     }
    78    
    79     // marking
    80     void JSNotAnObject::mark()
    81     {
    82         JSCell::mark();
    83         if (!m_exception->marked())
    84             m_exception->mark();
    85     }
    86    
    87     bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&)
    88     {
    89         UNUSED_PARAM(exec);
    90         ASSERT(exec->hadException() && exec->exception() == m_exception);
    91         return false;
    92     }
    93    
    94     bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
    95     {
    96         UNUSED_PARAM(exec);
    97         ASSERT(exec->hadException() && exec->exception() == m_exception);
    98         return false;
    99     }
    100    
    101     void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue*)
    102     {
    103         UNUSED_PARAM(exec);
    104         ASSERT(exec->hadException() && exec->exception() == m_exception);
    105     }
    106    
    107     void JSNotAnObject::put(ExecState* exec, unsigned, JSValue*)
    108     {
    109         UNUSED_PARAM(exec);
    110         ASSERT(exec->hadException() && exec->exception() == m_exception);
    111     }
    112    
    113     bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier &)
    114     {
    115         UNUSED_PARAM(exec);
    116         ASSERT(exec->hadException() && exec->exception() == m_exception);
    117         return false;
    118     }
    119    
    120     bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
    121     {
    122         UNUSED_PARAM(exec);
    123         ASSERT(exec->hadException() && exec->exception() == m_exception);
    124         return false;
    125     }
    126    
    127     JSValue *JSNotAnObject::defaultValue(ExecState* exec, JSType) const
    128     {
    129         UNUSED_PARAM(exec);
    130         ASSERT(exec->hadException() && exec->exception() == m_exception);
    131         return m_exception;
    132     }
    133    
    134     JSObject* JSNotAnObject::construct(ExecState* exec, const List&)
    135     {
    136         UNUSED_PARAM(exec);
    137         ASSERT(exec->hadException() && exec->exception() == m_exception);
    138         return m_exception;
    139     }
    140    
    141     JSObject* JSNotAnObject::construct(ExecState* exec, const List&, const Identifier&, const UString&, int)
    142     {
    143         UNUSED_PARAM(exec);
    144         ASSERT(exec->hadException() && exec->exception() == m_exception);
    145         return m_exception;
    146     }
    147    
    148     JSValue* JSNotAnObject::callAsFunction(ExecState* exec, JSObject *, const List &)
    149     {
    150         UNUSED_PARAM(exec);
    151         ASSERT(exec->hadException() && exec->exception() == m_exception);
    152         return m_exception;
    153     }
    154    
    155     void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&)
    156     {
    157         UNUSED_PARAM(exec);
    158         ASSERT(exec->hadException() && exec->exception() == m_exception);       
    159     }
    160    
     37// JSValue methods
     38JSValue* JSNotAnObject::toPrimitive(ExecState* exec, JSType) const
     39{
     40    UNUSED_PARAM(exec);
     41    ASSERT(exec->hadException() && exec->exception() == m_exception);
     42    return m_exception;
    16143}
     44
     45bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue*&)
     46{
     47    UNUSED_PARAM(exec);
     48    ASSERT(exec->hadException() && exec->exception() == m_exception);
     49    return false;
     50}
     51
     52bool JSNotAnObject::toBoolean(ExecState* exec) const
     53{
     54    UNUSED_PARAM(exec);
     55    ASSERT(exec->hadException() && exec->exception() == m_exception);
     56    return false;
     57}
     58
     59double JSNotAnObject::toNumber(ExecState* exec) const
     60{
     61    UNUSED_PARAM(exec);
     62    ASSERT(exec->hadException() && exec->exception() == m_exception);
     63    return NaN;
     64}
     65
     66UString JSNotAnObject::toString(ExecState* exec) const
     67{
     68    UNUSED_PARAM(exec);
     69    ASSERT(exec->hadException() && exec->exception() == m_exception);
     70    return "";
     71}
     72
     73JSObject* JSNotAnObject::toObject(ExecState* exec) const
     74{
     75    UNUSED_PARAM(exec);
     76    ASSERT(exec->hadException() && exec->exception() == m_exception);
     77    return m_exception;
     78}
     79
     80// Marking
     81void JSNotAnObject::mark()
     82{
     83    JSCell::mark();
     84    if (!m_exception->marked())
     85        m_exception->mark();
     86}
     87
     88// JSObject methods
     89bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&)
     90{
     91    UNUSED_PARAM(exec);
     92    ASSERT(exec->hadException() && exec->exception() == m_exception);
     93    return false;
     94}
     95
     96bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
     97{
     98    UNUSED_PARAM(exec);
     99    ASSERT(exec->hadException() && exec->exception() == m_exception);
     100    return false;
     101}
     102
     103void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue*)
     104{
     105    UNUSED_PARAM(exec);
     106    ASSERT(exec->hadException() && exec->exception() == m_exception);
     107}
     108
     109void JSNotAnObject::put(ExecState* exec, unsigned, JSValue*)
     110{
     111    UNUSED_PARAM(exec);
     112    ASSERT(exec->hadException() && exec->exception() == m_exception);
     113}
     114
     115bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&)
     116{
     117    UNUSED_PARAM(exec);
     118    ASSERT(exec->hadException() && exec->exception() == m_exception);
     119    return false;
     120}
     121
     122bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
     123{
     124    UNUSED_PARAM(exec);
     125    ASSERT(exec->hadException() && exec->exception() == m_exception);
     126    return false;
     127}
     128
     129JSValue* JSNotAnObject::defaultValue(ExecState* exec, JSType) const
     130{
     131    UNUSED_PARAM(exec);
     132    ASSERT(exec->hadException() && exec->exception() == m_exception);
     133    return m_exception;
     134}
     135
     136JSObject* JSNotAnObject::construct(ExecState* exec, const List&)
     137{
     138    UNUSED_PARAM(exec);
     139    ASSERT(exec->hadException() && exec->exception() == m_exception);
     140    return m_exception;
     141}
     142
     143JSObject* JSNotAnObject::construct(ExecState* exec, const List&, const Identifier&, const UString&, int)
     144{
     145    UNUSED_PARAM(exec);
     146    ASSERT(exec->hadException() && exec->exception() == m_exception);
     147    return m_exception;
     148}
     149
     150JSValue* JSNotAnObject::callAsFunction(ExecState* exec, JSObject*, const List&)
     151{
     152    UNUSED_PARAM(exec);
     153    ASSERT(exec->hadException() && exec->exception() == m_exception);
     154    return m_exception;
     155}
     156
     157void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&)
     158{
     159    UNUSED_PARAM(exec);
     160    ASSERT(exec->hadException() && exec->exception() == m_exception);
     161}
     162
     163} // namespace KJS
  • trunk/JavaScriptCore/kjs/JSNotAnObject.h

    r33979 r34372  
    3333
    3434namespace KJS {
    35    
     35
    3636    // This unholy class is used to allow us to avoid multiple exception checks
    3737    // in certain SquirrelFish opcodes -- effectively it just silently consumes
     
    4545
    4646        // JSValue methods
    47         virtual JSValue *toPrimitive(ExecState* exec, JSType preferredType = UnspecifiedType) const;
    48         virtual bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value);
    49         virtual bool toBoolean(ExecState* exec) const;
    50         virtual double toNumber(ExecState* exec) const;
    51         virtual UString toString(ExecState* exec) const;
    52         virtual JSObject *toObject(ExecState* exec) const;
    53        
    54         // marking
     47        virtual JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const;
     48        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*&);
     49        virtual bool toBoolean(ExecState*) const;
     50        virtual double toNumber(ExecState*) const;
     51        virtual UString toString(ExecState*) const;
     52        virtual JSObject* toObject(ExecState*) const;
     53
     54        // Marking
    5555        virtual void mark();
    5656
    57         virtual bool getOwnPropertySlot(ExecState* , const Identifier&, PropertySlot&);
    58         virtual bool getOwnPropertySlot(ExecState* , unsigned index, PropertySlot&);
     57        // JSObject methods
     58        virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
     59        virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
    5960
    60         virtual void put(ExecState*, const Identifier& propertyName, JSValue* value);
    61         virtual void put(ExecState*, unsigned propertyName, JSValue* value);
     61        virtual void put(ExecState*, const Identifier& propertyName, JSValue*);
     62        virtual void put(ExecState*, unsigned propertyName, JSValue*);
    6263
    63         virtual bool deleteProperty(ExecState* exec, const Identifier &propertyName);
    64         virtual bool deleteProperty(ExecState* exec, unsigned propertyName);
     64        virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
     65        virtual bool deleteProperty(ExecState*, unsigned propertyName);
    6566
    66         virtual JSValue *defaultValue(ExecState* exec, JSType hint) const;
     67        virtual JSValue* defaultValue(ExecState*, JSType hint) const;
    6768
    68         virtual JSObject* construct(ExecState* exec, const List& args);
    69         virtual JSObject* construct(ExecState* exec, const List& args, const Identifier& functionName, const UString& sourceURL, int lineNumber);
    70        
    71         virtual JSValue *callAsFunction(ExecState* exec, JSObject *thisObj, const List &args);
     69        virtual JSObject* construct(ExecState*, const List&);
     70        virtual JSObject* construct(ExecState*, const List&, const Identifier& functionName, const UString& sourceURL, int lineNumber);
     71
     72        virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List&);
    7273
    7374        virtual void getPropertyNames(ExecState*, PropertyNameArray&);
     
    7677        JSObject* m_exception;
    7778    };
    78 }
    7979
    80 #endif
     80} // namespace KJS
     81
     82#endif // JSNotAnObject_h
  • trunk/JavaScriptCore/kjs/JSVariableObject.h

    r34355 r34372  
    5555
    5656        JSValue*& valueAt(int index) const { return registers()[index].u.jsValue; }
     57
    5758    protected:
    5859        // Subclasses of JSVariableObject can subclass this struct to add data
  • trunk/JavaScriptCore/kjs/LocalStorageEntry.h

    r32259 r34372  
    2323 */
    2424
    25 #ifndef KJS_LOCAL_STORAGE_H
    26 #define KJS_LOCAL_STORAGE_H
     25#ifndef LocalStorageEntry_h
     26#define LocalStorageEntry_h
    2727
    2828#include <wtf/Forward.h>
     
    3030
    3131namespace KJS {
     32
    3233    class JSValue;
    3334
     
    4849
    4950    typedef Vector<LocalStorageEntry, 32> LocalStorage;
    50 }
     51
     52} // namespace KJS
    5153
    5254namespace WTF {
     55
    5356    template<> struct VectorTraits<KJS::LocalStorageEntry> : VectorTraitsBase<true, KJS::LocalStorageEntry> { };
    54 }
    5557
    56 #endif // KJS_LOCAL_STORAGE_H
     58} // namespace WTF
     59
     60#endif // LocalStorageEntry_h
  • trunk/JavaScriptCore/kjs/PropertyNameArray.h

    r33979 r34372  
    2020 */
    2121
    22 #ifndef KJS_PROPERTY_NAME_ARRAY_H
    23 #define KJS_PROPERTY_NAME_ARRAY_H
     22#ifndef PropertyNameArray_h
     23#define PropertyNameArray_h
    2424
    2525#include "identifier.h"
     
    3737        void add(UString::Rep*);
    3838        void addKnownUnique(UString::Rep* identifier) { m_vector.append(identifier); }
     39
    3940        const_iterator begin() const { return m_vector.begin(); }
    4041        const_iterator end() const { return m_vector.end(); }
     42
    4143        size_t size() const { return m_vector.size(); }
    4244
     
    4547
    4648        Identifier* releaseIdentifiers() { return size() ? m_vector.releaseBuffer() : 0; }
     49
    4750    private:
    4851        typedef HashSet<UString::Rep*, PtrHash<UString::Rep*> > IdentifierSet;
     
    5457} // namespace KJS
    5558
    56 
    57 #endif // KJS_PROPERTY_NAME_ARRAY_H
     59#endif // PropertyNameArray_h
  • trunk/JavaScriptCore/kjs/SourceProvider.h

    r33979 r34372  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929#ifndef SourceProvider_h
    3030#define SourceProvider_h
     
    3737    class SourceProvider : public RefCounted<SourceProvider> {
    3838    public:
    39         virtual ~SourceProvider() {}
     39        virtual ~SourceProvider() { }
    4040        virtual UString getRange(int start, int end) const = 0;
    4141        virtual const UChar* data() const = 0;
     
    5252
    5353    private:
    54         UStringSourceProvider(const UString& source) : m_source(source) {}
     54        UStringSourceProvider(const UString& source)
     55            : m_source(source)
     56        {
     57        }
     58
    5559        UString m_source;
    5660    };
    5761
    58 }
     62} // namespace KJS
    5963
    6064#endif // SourceProvider_h
  • trunk/JavaScriptCore/kjs/SourceRange.h

    r33979 r34372  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929#ifndef SourceRange_h
    3030#define SourceRange_h
     
    3737    class SourceRange {
    3838    public:
    39         SourceRange(PassRefPtr<SourceProvider> provider, int start, int end) 
     39        SourceRange(PassRefPtr<SourceProvider> provider, int start, int end)
    4040            : m_sourceProvider(provider)
    4141            , m_startChar(start)
     
    4343        {
    4444        }
    45         SourceRange() {}
    4645
    47         UString toString() const { if (!m_sourceProvider) return UString(); return m_sourceProvider->getRange(m_startChar, m_endChar); }
     46        SourceRange()
     47        {
     48        }
     49
     50        UString toString() const
     51        {
     52            if (!m_sourceProvider)
     53                return UString();
     54            return m_sourceProvider->getRange(m_startChar, m_endChar);
     55        }
    4856
    4957    private:
     
    5361    };
    5462
    55 }
     63} // namespace KJS
    5664
    5765#endif // SourceRange_h
  • trunk/JavaScriptCore/kjs/scope_chain.h

    r34007 r34372  
    4545        JSObject* globalThis;
    4646        int refCount;
    47        
     47
    4848        void deref() { if (--refCount == 0) release(); }
    4949        void ref() { ++refCount; }
     
    119119    class ScopeChainIterator {
    120120    public:
    121         ScopeChainIterator(const ScopeChainNode* node) : m_node(node) {}
     121        ScopeChainIterator(const ScopeChainNode* node)
     122            : m_node(node)
     123        {
     124        }
    122125
    123126        JSObject* const & operator*() const { return m_node->object; }
     
    188191        void print() const { _node->print(); }
    189192#endif
    190        
     193
    191194    private:
    192195        ScopeChainNode* _node;
  • trunk/JavaScriptCore/kjs/value.cpp

    r34355 r34372  
    8181static const double D32 = 4294967296.0;
    8282
    83 void *JSCell::operator new(size_t size)
     83void* JSCell::operator new(size_t size)
    8484{
    8585    return Collector::allocate(size);
     
    102102
    103103// ECMA 9.4
    104 double JSValue::toInteger(ExecState *exec) const
     104double JSValue::toInteger(ExecState* exec) const
    105105{
    106106    int32_t i;
     
    111111}
    112112
    113 double JSValue::toIntegerPreserveNaN(ExecState *exec) const
     113double JSValue::toIntegerPreserveNaN(ExecState* exec) const
    114114{
    115115    int32_t i;
     
    172172}
    173173
    174 bool JSCell::getNumber(double &numericValue) const
     174bool JSCell::getNumber(double& numericValue) const
    175175{
    176176    if (!isNumber())
    177177        return false;
    178     numericValue = static_cast<const NumberImp *>(this)->value();
     178    numericValue = static_cast<const NumberImp*>(this)->value();
    179179    return true;
    180180}
     
    182182double JSCell::getNumber() const
    183183{
    184     return isNumber() ? static_cast<const NumberImp *>(this)->value() : NaN;
    185 }
    186 
    187 bool JSCell::getString(UString &stringValue) const
     184    return isNumber() ? static_cast<const NumberImp*>(this)->value() : NaN;
     185}
     186
     187bool JSCell::getString(UString&stringValue) const
    188188{
    189189    if (!isString())
    190190        return false;
    191     stringValue = static_cast<const StringImp *>(this)->value();
     191    stringValue = static_cast<const StringImp*>(this)->value();
    192192    return true;
    193193}
     
    195195UString JSCell::getString() const
    196196{
    197     return isString() ? static_cast<const StringImp *>(this)->value() : UString();
    198 }
    199 
    200 JSObject *JSCell::getObject()
    201 {
    202     return isObject() ? static_cast<JSObject *>(this) : 0;
    203 }
    204 
    205 const JSObject *JSCell::getObject() const
    206 {
    207     return isObject() ? static_cast<const JSObject *>(this) : 0;
     197    return isString() ? static_cast<const StringImp*>(this)->value() : UString();
     198}
     199
     200JSObject*JSCell::getObject()
     201{
     202    return isObject() ? static_cast<JSObject*>(this) : 0;
     203}
     204
     205const JSObject* JSCell::getObject() const
     206{
     207    return isObject() ? static_cast<const JSObject*>(this) : 0;
    208208}
    209209
  • trunk/JavaScriptCore/kjs/value.h

    r34355 r34372  
    5353    friend class JSCell; // so it can derive from this class
    5454    friend class Collector; // so it can call asCell()
    55 
    5655private:
    5756    JSValue();
     
    6867    bool isString() const;
    6968    bool isObject() const;
    70     bool isObject(const ClassInfo *) const;
     69    bool isObject(const ClassInfo*) const;
    7170
    7271    // Extracting the value.
     
    7877    bool getString(UString&) const;
    7978    UString getString() const; // null string if not a string
    80     JSObject *getObject(); // NULL if not an object
    81     const JSObject *getObject() const; // NULL if not an object
     79    JSObject* getObject(); // NULL if not an object
     80    const JSObject* getObject() const; // NULL if not an object
    8281
    8382    CallType getCallData(CallData&);
     
    9089   
    9190    // Basic conversions.
    92     JSValue* toPrimitive(ExecState* exec, JSType preferredType = UnspecifiedType) const;
    93     bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value);
    94 
    95     bool toBoolean(ExecState *exec) const;
     91    JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const;
     92    bool getPrimitiveNumber(ExecState*, double& number, JSValue*&);
     93
     94    bool toBoolean(ExecState*) const;
    9695
    9796    // toNumber conversion is expected to be side effect free if an exception has
    9897    // been set in the ExecState already.
    99     double toNumber(ExecState *exec) const;
     98    double toNumber(ExecState*) const;
    10099    JSValue* toJSNumber(ExecState*) const; // Fast path for when you expect that the value is an immediate number.
    101     UString toString(ExecState *exec) const;
    102     JSObject* toObject(ExecState *exec) const;
     100    UString toString(ExecState*) const;
     101    JSObject* toObject(ExecState*) const;
    103102
    104103    // Integer conversions.
     
    138137
    139138    // Implementation details.
    140     JSCell *asCell();
    141     const JSCell *asCell() const;
     139    JSCell* asCell();
     140    const JSCell* asCell() const;
    142141};
    143142
     
    152151    JSCell();
    153152    virtual ~JSCell();
     153
    154154public:
    155155    // Querying the type.
     
    158158    bool isString() const;
    159159    bool isObject() const;
    160     bool isObject(const ClassInfo *) const;
     160    bool isObject(const ClassInfo*) const;
    161161
    162162    // Extracting the value.
     
    165165    bool getString(UString&) const;
    166166    UString getString() const; // null string if not a string
    167     JSObject *getObject(); // NULL if not an object
    168     const JSObject *getObject() const; // NULL if not an object
     167    JSObject* getObject(); // NULL if not an object
     168    const JSObject* getObject() const; // NULL if not an object
    169169   
    170170    virtual CallType getCallData(CallData&);
     
    177177
    178178    // Basic conversions.
    179     virtual JSValue *toPrimitive(ExecState *exec, JSType preferredType = UnspecifiedType) const = 0;
    180     virtual bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value) = 0;
    181     virtual bool toBoolean(ExecState *exec) const = 0;
    182     virtual double toNumber(ExecState *exec) const = 0;
    183     virtual UString toString(ExecState *exec) const = 0;
    184     virtual JSObject *toObject(ExecState *exec) const = 0;
     179    virtual JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const = 0;
     180    virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*&) = 0;
     181    virtual bool toBoolean(ExecState*) const = 0;
     182    virtual double toNumber(ExecState*) const = 0;
     183    virtual UString toString(ExecState*) const = 0;
     184    virtual JSObject* toObject(ExecState*) const = 0;
    185185
    186186    // Garbage collection.
    187     void *operator new(size_t);
     187    void* operator new(size_t);
    188188    virtual void mark();
    189189    bool marked() const;
     
    200200
    201201class NumberImp : public JSCell {
    202   friend JSValue* jsNumberCell(double);
    203 
     202    friend JSValue* jsNumberCell(double);
    204203public:
    205   double value() const { return val; }
    206 
    207   virtual JSType type() const;
    208 
    209   virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const;
    210   virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
    211   virtual bool toBoolean(ExecState* exec) const;
    212   virtual double toNumber(ExecState* exec) const;
    213   virtual UString toString(ExecState* exec) const;
    214   virtual JSObject* toObject(ExecState* exec) const;
     204    double value() const { return val; }
     205
     206    virtual JSType type() const;
     207
     208    virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const;
     209    virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
     210    virtual bool toBoolean(ExecState*) const;
     211    virtual double toNumber(ExecState*) const;
     212    virtual UString toString(ExecState*) const;
     213    virtual JSObject* toObject(ExecState*) const;
    215214    virtual JSObject* toThisObject(ExecState*) const;
    216215
    217   void* operator new(size_t size)
    218   {
     216    void* operator new(size_t size)
     217    {
    219218#ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE
    220       return Collector::inlineAllocateNumber(size);
     219        return Collector::inlineAllocateNumber(size);
    221220#else
    222       return Collector::allocateNumber(size);
     221        return Collector::allocateNumber(size);
    223222#endif
    224   }
     223    }
    225224
    226225private:
    227   NumberImp(double v) : val(v) { }
    228 
    229   virtual bool getUInt32(uint32_t&) const;
    230   virtual bool getTruncatedInt32(int32_t&) const;
    231   virtual bool getTruncatedUInt32(uint32_t&) const;
    232 
    233   double val;
     226    NumberImp(double v)
     227        : val(v)
     228    {
     229    }
     230
     231    virtual bool getUInt32(uint32_t&) const;
     232    virtual bool getTruncatedInt32(int32_t&) const;
     233    virtual bool getTruncatedUInt32(uint32_t&) const;
     234
     235    double val;
    234236};
    235237
    236 JSCell *jsString(const UString&); // returns empty string if passed null string
    237 JSCell *jsString(const char* = ""); // returns empty string if passed 0
     238JSCell* jsString(const UString&); // returns empty string if passed null string
     239JSCell* jsString(const char* = ""); // returns empty string if passed 0
    238240
    239241// should be used for strings that are owned by an object that will
    240242// likely outlive the JSValue this makes, such as the parse tree or a
    241243// DOM object that contains a UString
    242 JSCell *jsOwnedString(const UString&);
     244JSCell* jsOwnedString(const UString&);
    243245
    244246extern const double NaN;
     
    252254}
    253255
    254 ALWAYS_INLINE JSValue *jsUndefined()
     256ALWAYS_INLINE JSValue* jsUndefined()
    255257{
    256258    return JSImmediate::undefinedImmediate();
    257259}
    258260
    259 inline JSValue *jsNull()
     261inline JSValue* jsNull()
    260262{
    261263    return JSImmediate::nullImmediate();
    262264}
    263265
    264 inline JSValue *jsNaN()
     266inline JSValue* jsNaN()
    265267{
    266268    return jsNumberCell(NaN);
    267269}
    268270
    269 inline JSValue *jsBoolean(bool b)
     271inline JSValue* jsBoolean(bool b)
    270272{
    271273    return b ? JSImmediate::trueImmediate() : JSImmediate::falseImmediate();
     
    608610}
    609611
    610 } // namespace
     612} // namespace KJS
    611613
    612614#endif // KJS_VALUE_H
Note: See TracChangeset for help on using the changeset viewer.