Show
Ignore:
Timestamp:
08/18/08 11:14:49 (5 months ago)
Author:
odole
Message:

merge with webkit revision 35814

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/JavaScriptCore/kjs/PropertySlot.h

    r414 r440  
    3535#define KJS_VALUE_SLOT_MARKER 0 
    3636#define KJS_REGISTER_SLOT_MARKER reinterpret_cast<GetValueFunc>(1) 
    37 #define KJS_NUMERIC_PROPERTY_NAME_SLOT_MARKER reinterpret_cast<GetValueFunc>(2) 
    3837 
    3938    class PropertySlot { 
     
    4241        { 
    4342            clearBase(); 
     43            clearValue(); 
    4444        } 
    4545 
     
    4747            : m_slotBase(base) 
    4848        { 
     49            clearValue(); 
    4950        } 
    5051 
    5152        typedef JSValue* (*GetValueFunc)(ExecState*, const Identifier&, const PropertySlot&); 
    52         typedef JSValue* (*GetValueNumericFunc)(ExecState*, unsigned index, const PropertySlot&); 
    5353 
    5454        JSValue* getValue(ExecState* exec, const Identifier& propertyName) const 
     
    5858            if (m_getValue == KJS_REGISTER_SLOT_MARKER) 
    5959                return (*m_data.registerSlot).jsValue(exec); 
    60             ASSERT(m_getValue != KJS_NUMERIC_PROPERTY_NAME_SLOT_MARKER); 
    6160            return m_getValue(exec, propertyName, *this); 
    6261        } 
     
    6665            if (m_getValue == KJS_VALUE_SLOT_MARKER) 
    6766                return *m_data.valueSlot; 
    68             if (m_getValue == KJS_NUMERIC_PROPERTY_NAME_SLOT_MARKER) 
    69                 return m_data.numericFunc(exec, propertyName, *this); 
    7067            if (m_getValue == KJS_REGISTER_SLOT_MARKER) 
    7168                return (*m_data.registerSlot).jsValue(exec); 
     
    9188        } 
    9289         
     90        void setValue(JSValue* value) 
     91        { 
     92            ASSERT(value); 
     93            m_getValue = KJS_VALUE_SLOT_MARKER; 
     94            clearBase(); 
     95            m_value = value; 
     96            m_data.valueSlot = &m_value; 
     97        } 
     98 
    9399        void setRegisterSlot(Register* registerSlot) 
    94100        { 
     
    126132        } 
    127133         
    128         void setCustomNumeric(JSValue* slotBase, GetValueNumericFunc getValue) 
    129         { 
    130             ASSERT(slotBase); 
    131             ASSERT(getValue); 
    132             m_slotBase = slotBase; 
    133             m_getValue = KJS_NUMERIC_PROPERTY_NAME_SLOT_MARKER; 
    134             m_data.numericFunc = getValue; 
    135         } 
    136          
    137134        void setGetterSlot(JSObject* getterFunc) 
    138135        { 
     
    145142        { 
    146143            clearBase(); 
    147             m_getValue = undefinedGetter
     144            setValue(jsUndefined())
    148145        } 
    149146 
     
    168165        } 
    169166 
     167        void clearValue() 
     168        { 
     169#ifndef NDEBUG 
     170            m_value = 0; 
     171#endif 
     172        } 
     173 
    170174        const HashEntry* staticEntry() const { return m_data.staticEntry; } 
    171175        unsigned index() const { return m_data.index; } 
    172176 
    173177    private: 
    174         static JSValue* undefinedGetter(ExecState*, const Identifier&, const PropertySlot&); 
    175178        static JSValue* functionGetter(ExecState*, const Identifier&, const PropertySlot&); 
    176179 
    177180        GetValueFunc m_getValue; 
     181         
     182        JSValue* m_value; 
    178183 
    179184        JSValue* m_slotBase; 
     
    184189            const HashEntry* staticEntry; 
    185190            unsigned index; 
    186             GetValueNumericFunc numericFunc; 
    187191        } m_data; 
    188192    };