Changeset 171606 in webkit


Ignore:
Timestamp:
Jul 25, 2014, 12:04:50 PM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

Reindent PropertyNameArray.h
https://bugs.webkit.org/show_bug.cgi?id=135067

Reviewed by Geoffrey Garen.

  • runtime/PropertyNameArray.h:

(JSC::RefCountedIdentifierSet::contains):
(JSC::RefCountedIdentifierSet::size):
(JSC::RefCountedIdentifierSet::add):
(JSC::PropertyNameArrayData::create):
(JSC::PropertyNameArrayData::propertyNameVector):
(JSC::PropertyNameArrayData::PropertyNameArrayData):
(JSC::PropertyNameArray::PropertyNameArray):
(JSC::PropertyNameArray::vm):
(JSC::PropertyNameArray::add):
(JSC::PropertyNameArray::addKnownUnique):
(JSC::PropertyNameArray::operator[]):
(JSC::PropertyNameArray::setData):
(JSC::PropertyNameArray::data):
(JSC::PropertyNameArray::releaseData):
(JSC::PropertyNameArray::identifierSet):
(JSC::PropertyNameArray::canAddKnownUniqueForStructure):
(JSC::PropertyNameArray::size):
(JSC::PropertyNameArray::begin):
(JSC::PropertyNameArray::end):
(JSC::PropertyNameArray::numCacheableSlots):
(JSC::PropertyNameArray::setNumCacheableSlotsForObject):
(JSC::PropertyNameArray::setBaseObject):
(JSC::PropertyNameArray::setPreviouslyEnumeratedLength):

Location:
branches/ftlopt/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ftlopt/Source/JavaScriptCore/ChangeLog

    r171605 r171606  
     12014-07-25  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Reindent PropertyNameArray.h
     4        https://bugs.webkit.org/show_bug.cgi?id=135067
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * runtime/PropertyNameArray.h:
     9        (JSC::RefCountedIdentifierSet::contains):
     10        (JSC::RefCountedIdentifierSet::size):
     11        (JSC::RefCountedIdentifierSet::add):
     12        (JSC::PropertyNameArrayData::create):
     13        (JSC::PropertyNameArrayData::propertyNameVector):
     14        (JSC::PropertyNameArrayData::PropertyNameArrayData):
     15        (JSC::PropertyNameArray::PropertyNameArray):
     16        (JSC::PropertyNameArray::vm):
     17        (JSC::PropertyNameArray::add):
     18        (JSC::PropertyNameArray::addKnownUnique):
     19        (JSC::PropertyNameArray::operator[]):
     20        (JSC::PropertyNameArray::setData):
     21        (JSC::PropertyNameArray::data):
     22        (JSC::PropertyNameArray::releaseData):
     23        (JSC::PropertyNameArray::identifierSet):
     24        (JSC::PropertyNameArray::canAddKnownUniqueForStructure):
     25        (JSC::PropertyNameArray::size):
     26        (JSC::PropertyNameArray::begin):
     27        (JSC::PropertyNameArray::end):
     28        (JSC::PropertyNameArray::numCacheableSlots):
     29        (JSC::PropertyNameArray::setNumCacheableSlotsForObject):
     30        (JSC::PropertyNameArray::setBaseObject):
     31        (JSC::PropertyNameArray::setPreviouslyEnumeratedLength):
     32
    1332014-07-23  Mark Hahnenberg  <mhahnenberg@apple.com>
    234
  • branches/ftlopt/Source/JavaScriptCore/runtime/PropertyNameArray.h

    r171605 r171606  
    2828
    2929namespace JSC {
    30    
    31     class JSPropertyNameEnumerator;
    32     class Structure;
    33     class StructureChain;
    3430
    35     class RefCountedIdentifierSet : public RefCounted<RefCountedIdentifierSet> {
    36     public:
    37         typedef HashSet<StringImpl*, PtrHash<StringImpl*>> Set;
     31class JSPropertyNameEnumerator;
     32class Structure;
     33class StructureChain;
    3834
    39         bool contains(StringImpl* impl) const { return m_set.contains(impl); }
    40         size_t size() const  { return m_set.size(); }
    41         Set::AddResult add(StringImpl* impl) { return m_set.add(impl); }
     35class RefCountedIdentifierSet : public RefCounted<RefCountedIdentifierSet> {
     36public:
     37    typedef HashSet<StringImpl*, PtrHash<StringImpl*>> Set;
    4238
    43     private:
    44         Set m_set;
    45     };
     39    bool contains(StringImpl* impl) const { return m_set.contains(impl); }
     40    size_t size() const  { return m_set.size(); }
     41    Set::AddResult add(StringImpl* impl) { return m_set.add(impl); }
    4642
    47     // FIXME: Rename to PropertyNameArray.
    48     class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> {
    49     public:
    50         typedef Vector<Identifier, 20> PropertyNameVector;
     43private:
     44    Set m_set;
     45};
    5146
    52         static PassRefPtr<PropertyNameArrayData> create() { return adoptRef(new PropertyNameArrayData); }
     47// FIXME: Rename to PropertyNameArray.
     48class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> {
     49public:
     50    typedef Vector<Identifier, 20> PropertyNameVector;
    5351
    54         PropertyNameVector& propertyNameVector() { return m_propertyNameVector; }
     52    static PassRefPtr<PropertyNameArrayData> create() { return adoptRef(new PropertyNameArrayData); }
    5553
    56     private:
    57         PropertyNameArrayData()
    58         {
    59         }
     54    PropertyNameVector& propertyNameVector() { return m_propertyNameVector; }
    6055
    61         PropertyNameVector m_propertyNameVector;
    62     };
     56private:
     57    PropertyNameArrayData()
     58    {
     59    }
    6360
    64     // FIXME: Rename to PropertyNameArrayBuilder.
    65     class PropertyNameArray {
    66     public:
    67         PropertyNameArray(VM* vm)
    68             : m_data(PropertyNameArrayData::create())
    69             , m_set(adoptRef(new RefCountedIdentifierSet))
    70             , m_vm(vm)
    71             , m_numCacheableSlots(0)
    72             , m_baseObject(0)
    73             , m_previouslyEnumeratedLength(0)
    74         {
    75         }
     61    PropertyNameVector m_propertyNameVector;
     62};
    7663
    77         PropertyNameArray(ExecState* exec)
    78             : m_data(PropertyNameArrayData::create())
    79             , m_set(adoptRef(new RefCountedIdentifierSet))
    80             , m_vm(&exec->vm())
    81             , m_numCacheableSlots(0)
    82             , m_baseObject(0)
    83             , m_previouslyEnumeratedLength(0)
    84         {
    85         }
     64// FIXME: Rename to PropertyNameArrayBuilder.
     65class PropertyNameArray {
     66public:
     67    PropertyNameArray(VM* vm)
     68        : m_data(PropertyNameArrayData::create())
     69        , m_set(adoptRef(new RefCountedIdentifierSet))
     70        , m_vm(vm)
     71        , m_numCacheableSlots(0)
     72        , m_baseObject(0)
     73        , m_previouslyEnumeratedLength(0)
     74    {
     75    }
    8676
    87         VM* vm() { return m_vm; }
     77    PropertyNameArray(ExecState* exec)
     78        : m_data(PropertyNameArrayData::create())
     79        , m_set(adoptRef(new RefCountedIdentifierSet))
     80        , m_vm(&exec->vm())
     81        , m_numCacheableSlots(0)
     82        , m_baseObject(0)
     83        , m_previouslyEnumeratedLength(0)
     84    {
     85    }
    8886
    89         void add(uint32_t index)
    90         {
    91             if (index < m_previouslyEnumeratedLength)
    92                 return;
    93             add(Identifier::from(m_vm, index));
    94         }
     87    VM* vm() { return m_vm; }
    9588
    96         void add(const Identifier& identifier) { add(identifier.impl()); }
    97         JS_EXPORT_PRIVATE void add(StringImpl*);
    98         void addKnownUnique(StringImpl* identifier)
    99         {
    100             m_set->add(identifier);
    101             m_data->propertyNameVector().append(Identifier(m_vm, identifier));
    102         }
     89    void add(uint32_t index)
     90    {
     91        if (index < m_previouslyEnumeratedLength)
     92            return;
     93        add(Identifier::from(m_vm, index));
     94    }
    10395
    104         Identifier& operator[](unsigned i) { return m_data->propertyNameVector()[i]; }
    105         const Identifier& operator[](unsigned i) const { return m_data->propertyNameVector()[i]; }
     96    void add(const Identifier& identifier) { add(identifier.impl()); }
     97    JS_EXPORT_PRIVATE void add(StringImpl*);
     98    void addKnownUnique(StringImpl* identifier)
     99    {
     100        m_set->add(identifier);
     101        m_data->propertyNameVector().append(Identifier(m_vm, identifier));
     102    }
    106103
    107         void setData(PassRefPtr<PropertyNameArrayData> data) { m_data = data; }
    108         PropertyNameArrayData* data() { return m_data.get(); }
    109         PassRefPtr<PropertyNameArrayData> releaseData() { return m_data.release(); }
     104    Identifier& operator[](unsigned i) { return m_data->propertyNameVector()[i]; }
     105    const Identifier& operator[](unsigned i) const { return m_data->propertyNameVector()[i]; }
    110106
    111         RefCountedIdentifierSet* identifierSet() const { return m_set.get(); }
     107    void setData(PassRefPtr<PropertyNameArrayData> data) { m_data = data; }
     108    PropertyNameArrayData* data() { return m_data.get(); }
     109    PassRefPtr<PropertyNameArrayData> releaseData() { return m_data.release(); }
    112110
    113         // FIXME: Remove these functions.
    114         bool canAddKnownUniqueForStructure() const { return !m_set->size() && (!m_alternateSet || !m_alternateSet->size()); }
    115         typedef PropertyNameArrayData::PropertyNameVector::const_iterator const_iterator;
    116         size_t size() const { return m_data->propertyNameVector().size(); }
    117         const_iterator begin() const { return m_data->propertyNameVector().begin(); }
    118         const_iterator end() const { return m_data->propertyNameVector().end(); }
     111    RefCountedIdentifierSet* identifierSet() const { return m_set.get(); }
    119112
    120         size_t numCacheableSlots() const { return m_numCacheableSlots; }
    121         void setNumCacheableSlotsForObject(JSObject* object, size_t numCacheableSlots)
    122         {
    123             if (object != m_baseObject)
    124                 return;
    125             m_numCacheableSlots = numCacheableSlots;
    126         }
    127         void setBaseObject(JSObject* object)
    128         {
    129             if (m_baseObject)
    130                 return;
    131             m_baseObject = object;
    132         }
     113    // FIXME: Remove these functions.
     114    bool canAddKnownUniqueForStructure() const { return !m_set->size() && (!m_alternateSet || !m_alternateSet->size()); }
     115    typedef PropertyNameArrayData::PropertyNameVector::const_iterator const_iterator;
     116    size_t size() const { return m_data->propertyNameVector().size(); }
     117    const_iterator begin() const { return m_data->propertyNameVector().begin(); }
     118    const_iterator end() const { return m_data->propertyNameVector().end(); }
    133119
    134         void setPreviouslyEnumeratedLength(uint32_t length) { m_previouslyEnumeratedLength = length; }
    135         void setPreviouslyEnumeratedProperties(const JSPropertyNameEnumerator*);
     120    size_t numCacheableSlots() const { return m_numCacheableSlots; }
     121    void setNumCacheableSlotsForObject(JSObject* object, size_t numCacheableSlots)
     122    {
     123        if (object != m_baseObject)
     124            return;
     125        m_numCacheableSlots = numCacheableSlots;
     126    }
     127    void setBaseObject(JSObject* object)
     128    {
     129        if (m_baseObject)
     130            return;
     131        m_baseObject = object;
     132    }
    136133
    137     private:
    138         RefPtr<PropertyNameArrayData> m_data;
    139         RefPtr<RefCountedIdentifierSet> m_set;
    140         RefPtr<RefCountedIdentifierSet> m_alternateSet;
    141         VM* m_vm;
    142         size_t m_numCacheableSlots;
    143         JSObject* m_baseObject;
    144         uint32_t m_previouslyEnumeratedLength;
    145     };
     134    void setPreviouslyEnumeratedLength(uint32_t length) { m_previouslyEnumeratedLength = length; }
     135    void setPreviouslyEnumeratedProperties(const JSPropertyNameEnumerator*);
     136
     137private:
     138    RefPtr<PropertyNameArrayData> m_data;
     139    RefPtr<RefCountedIdentifierSet> m_set;
     140    RefPtr<RefCountedIdentifierSet> m_alternateSet;
     141    VM* m_vm;
     142    size_t m_numCacheableSlots;
     143    JSObject* m_baseObject;
     144    uint32_t m_previouslyEnumeratedLength;
     145};
    146146
    147147} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.