Changeset 171606 in webkit
- Timestamp:
- Jul 25, 2014, 12:04:50 PM (11 years ago)
- Location:
- branches/ftlopt/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
runtime/PropertyNameArray.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/ftlopt/Source/JavaScriptCore/ChangeLog
r171605 r171606 1 2014-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 1 33 2014-07-23 Mark Hahnenberg <mhahnenberg@apple.com> 2 34 -
branches/ftlopt/Source/JavaScriptCore/runtime/PropertyNameArray.h
r171605 r171606 28 28 29 29 namespace JSC { 30 31 class JSPropertyNameEnumerator;32 class Structure;33 class StructureChain;34 30 35 class RefCountedIdentifierSet : public RefCounted<RefCountedIdentifierSet> { 36 public: 37 typedef HashSet<StringImpl*, PtrHash<StringImpl*>> Set;31 class JSPropertyNameEnumerator; 32 class Structure; 33 class StructureChain; 38 34 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); }35 class RefCountedIdentifierSet : public RefCounted<RefCountedIdentifierSet> { 36 public: 37 typedef HashSet<StringImpl*, PtrHash<StringImpl*>> Set; 42 38 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); } 46 42 47 // FIXME: Rename to PropertyNameArray. 48 class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> { 49 public: 50 typedef Vector<Identifier, 20> PropertyNameVector; 43 private: 44 Set m_set; 45 }; 51 46 52 static PassRefPtr<PropertyNameArrayData> create() { return adoptRef(new PropertyNameArrayData); } 47 // FIXME: Rename to PropertyNameArray. 48 class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> { 49 public: 50 typedef Vector<Identifier, 20> PropertyNameVector; 53 51 54 PropertyNameVector& propertyNameVector() { return m_propertyNameVector; }52 static PassRefPtr<PropertyNameArrayData> create() { return adoptRef(new PropertyNameArrayData); } 55 53 56 private: 57 PropertyNameArrayData() 58 { 59 } 54 PropertyNameVector& propertyNameVector() { return m_propertyNameVector; } 60 55 61 PropertyNameVector m_propertyNameVector; 62 }; 56 private: 57 PropertyNameArrayData() 58 { 59 } 63 60 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 }; 76 63 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. 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 } 86 76 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 } 88 86 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; } 95 88 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 } 103 95 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 } 106 103 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]; } 110 106 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(); } 112 110 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(); } 119 112 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(); } 133 119 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 } 136 133 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 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 }; 146 146 147 147 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.