Ignore:
Timestamp:
Oct 16, 2009, 10:52:20 PM (16 years ago)
Author:
[email protected]
Message:

Rolled back in r49717 with the build maybe working now?

File:
1 edited

Legend:

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

    r49726 r49734  
    3232#include "JSObject.h"
    3333#include "JSString.h"
     34#include "Operations.h"
    3435#include "PropertyNameArray.h"
    3536
     
    4041
    4142    class JSPropertyNameIterator : public JSCell {
     43        friend class JIT;
     44
    4245    public:
    43         static JSPropertyNameIterator* create(ExecState*, JSValue);
    44 
    45         virtual ~JSPropertyNameIterator();
    46 
    47         virtual void markChildren(MarkStack&);
    48 
    49         JSValue next(ExecState*);
    50         void invalidate();
     46        static JSPropertyNameIterator* create(ExecState*, JSObject*);
    5147       
    5248        static PassRefPtr<Structure> createStructure(JSValue prototype)
     
    5450            return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren));
    5551        }
     52
     53        virtual void markChildren(MarkStack&);
     54
     55        JSValue get(ExecState*, JSObject*, size_t i);
     56        size_t size() { return m_jsStringsSize; }
     57
     58        void setCachedStructure(Structure* structure) { m_cachedStructure = structure; }
     59        Structure* cachedStructure() { return m_cachedStructure; }
     60
     61        void setCachedPrototypeChain(NonNullPassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
     62        StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
     63
    5664    private:
    57         JSPropertyNameIterator(ExecState*);
    58         JSPropertyNameIterator(ExecState*, JSObject*, PassRefPtr<PropertyNameArrayData> propertyNameArrayData);
     65        JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData);
    5966
    60         JSObject* m_object;
    61         RefPtr<PropertyNameArrayData> m_data;
    62         PropertyNameArrayData::const_iterator m_position;
    63         PropertyNameArrayData::const_iterator m_end;
     67        Structure* m_cachedStructure;
     68        RefPtr<StructureChain> m_cachedPrototypeChain;
     69        size_t m_jsStringsSize;
     70        OwnArrayPtr<JSValue> m_jsStrings;
    6471    };
    6572
    66 inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec)
     73inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData)
    6774    : JSCell(exec->globalData().propertyNameIteratorStructure.get())
    68     , m_object(0)
    69     , m_position(0)
    70     , m_end(0)
     75    , m_cachedStructure(0)
     76    , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
     77    , m_jsStrings(new JSValue[m_jsStringsSize])
    7178{
     79    PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
     80    for (size_t i = 0; i < m_jsStringsSize; ++i)
     81        m_jsStrings[i] = jsOwnedString(exec, propertyNameVector[i].ustring());
    7282}
    7383
    74 inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, JSObject* object, PassRefPtr<PropertyNameArrayData> propertyNameArrayData)
    75     : JSCell(exec->globalData().propertyNameIteratorStructure.get())
    76     , m_object(object)
    77     , m_data(propertyNameArrayData)
    78     , m_position(m_data->begin())
    79     , m_end(m_data->end())
     84inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache)
    8085{
    81 }
    82 
    83 inline JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue v)
    84 {
    85     if (v.isUndefinedOrNull())
    86         return new (exec) JSPropertyNameIterator(exec);
    87 
    88     JSObject* o = v.toObject(exec);
    89     PropertyNameArray propertyNames(exec);
    90     o->getPropertyNames(exec, propertyNames);
    91     return new (exec) JSPropertyNameIterator(exec, o, propertyNames.releaseData());
    92 }
    93 
    94 inline JSValue JSPropertyNameIterator::next(ExecState* exec)
    95 {
    96     if (m_position == m_end)
    97         return JSValue();
    98 
    99     if (m_data->cachedStructure() == m_object->structure() && m_data->cachedPrototypeChain() == m_object->structure()->prototypeChain(exec))
    100         return jsOwnedString(exec, (*m_position++).ustring());
    101 
    102     do {
    103         if (m_object->hasProperty(exec, *m_position))
    104             return jsOwnedString(exec, (*m_position++).ustring());
    105         m_position++;
    106     } while (m_position != m_end);
    107 
    108     return JSValue();
     86    ASSERT(!isDictionary());
     87    m_enumerationCache = enumerationCache;
    10988}
    11089
Note: See TracChangeset for help on using the changeset viewer.