Changeset 37714 in webkit for trunk/JavaScriptCore/kjs/JSValue.h


Ignore:
Timestamp:
Oct 20, 2008, 12:29:28 AM (17 years ago)
Author:
Darin Adler
Message:

2008-10-19 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

  • VM/Machine.cpp: (JSC::Machine::cti_op_call_profiler): Use asFunction. (JSC::Machine::cti_vm_lazyLinkCall): Ditto. (JSC::Machine::cti_op_construct_JSConstructFast): Use asObject.
  • kjs/JSCell.h: Re-sort friend classes. Eliminate inheritance from JSValue. Changed cast in asCell from static_cast to reinterpret_cast. Removed JSValue::getNumber(double&) and one of JSValue::getObject overloads.
  • kjs/JSValue.h: Made the private constructor and destructor both non-virtual and also remove the definitions. This class can never be instantiated or derived.
File:
1 edited

Legend:

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

    r37712 r37714  
    3636namespace JSC {
    3737
    38     class ExecState;
    3938    class Identifier;
    40     class JSCell;
    41     class JSObject;
    4239    class JSString;
    4340    class PropertySlot;
    4441    class PutPropertySlot;
    45     class StructureID;
    4642
    4743    struct ClassInfo;
     
    5046    enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString };
    5147
    52     /**
    53      * JSValue is the base type for all primitives (Undefined, Null, Boolean,
    54      * String, Number) and objects in ECMAScript.
    55      *
    56      * Note: you should never inherit from JSValue as it is for primitive types
    57      * only (all of which are provided internally by KJS). Instead, inherit from
    58      * JSObject.
    59      */
    6048    class JSValue : Noncopyable {
    61         friend class JSCell; // so it can derive from this class
    6249    private:
    6350        JSValue();
    64         virtual ~JSValue();
     51        ~JSValue();
    6552
    6653    public:
     
    7461        bool isGetterSetter() const;
    7562        bool isObject() const;
    76         bool isObject(const ClassInfo*) const; // FIXME: Merge with inherits.
     63        bool isObject(const ClassInfo*) const;
    7764       
    7865        // Extracting the value.
    7966        bool getBoolean(bool&) const;
    8067        bool getBoolean() const; // false if not a boolean
    81         bool getNumber(double&) const;
    8268        double getNumber() const; // NaN if not a number
    8369        double uncheckedGetNumber() const;
    8470        bool getString(UString&) const;
    8571        UString getString() const; // null string if not a string
    86         JSObject* getObject(); // NULL if not an object
    87         const JSObject* getObject() const; // NULL if not an object
     72        JSObject* getObject() const; // 0 if not an object
    8873
    8974        CallType getCallData(CallData&);
     
    10590        double toNumber(ExecState*) const;
    10691        JSValuePtr toJSNumber(ExecState*) const; // Fast path for when you expect that the value is an immediate number.
     92
    10793        UString toString(ExecState*) const;
    10894        JSObject* toObject(ExecState*) const;
     
    160146    uint32_t toUInt32SlowCase(double, bool& ok);
    161147
    162     inline JSValue::JSValue()
    163     {
    164     }
    165 
    166     inline JSValue::~JSValue()
    167     {
    168     }
    169 
    170148    inline JSValuePtr JSValue::asValue() const
    171149    {
Note: See TracChangeset for help on using the changeset viewer.