Changeset 97536 in webkit for trunk/Source/JavaScriptCore/runtime/Lookup.h
- Timestamp:
- Oct 14, 2011, 6:25:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Lookup.h
r97532 r97536 177 177 } 178 178 179 class ConstIterator { 180 public: 181 ConstIterator(const HashTable* table, int position) 182 : m_table(table) 183 , m_position(position) 184 { 185 skipInvalidKeys(); 186 } 187 188 const HashEntry* operator->() 189 { 190 return &m_table->table[m_position]; 191 } 192 193 const HashEntry* operator*() 194 { 195 return &m_table->table[m_position]; 196 } 197 198 bool operator!=(const ConstIterator& other) 199 { 200 ASSERT(m_table == other.m_table); 201 return m_position != other.m_position; 202 } 203 204 ConstIterator& operator++() 205 { 206 ASSERT(m_position < m_table->compactSize); 207 ++m_position; 208 skipInvalidKeys(); 209 return *this; 210 } 211 212 private: 213 void skipInvalidKeys() 214 { 215 ASSERT(m_position <= m_table->compactSize); 216 while (m_position < m_table->compactSize && !m_table->table[m_position].key()) 217 ++m_position; 218 ASSERT(m_position <= m_table->compactSize); 219 } 220 221 const HashTable* m_table; 222 int m_position; 223 }; 224 225 ConstIterator begin(JSGlobalData& globalData) const 226 { 227 initializeIfNeeded(&globalData); 228 return ConstIterator(this, 0); 229 } 230 ConstIterator end(JSGlobalData& globalData) const 231 { 232 initializeIfNeeded(&globalData); 233 return ConstIterator(this, compactSize); 234 } 235 179 236 private: 180 237 ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const … … 200 257 }; 201 258 202 voidsetUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, const Identifier& propertyName, PropertySlot&);259 bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, const Identifier& propertyName, PropertySlot&); 203 260 204 261 /** … … 217 274 218 275 if (entry->attributes() & Function) 219 setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 220 else 221 slot.setCacheableCustom(thisObj, entry->propertyGetter()); 222 276 return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 277 278 slot.setCacheableCustom(thisObj, entry->propertyGetter()); 223 279 return true; 224 280 } … … 233 289 234 290 PropertySlot slot; 235 if (entry->attributes() & Function) 236 setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 237 else 238 slot.setCustom(thisObj, entry->propertyGetter()); 239 291 if (entry->attributes() & Function) { 292 bool present = setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 293 if (present) 294 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); 295 return present; 296 } 297 298 slot.setCustom(thisObj, entry->propertyGetter()); 240 299 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); 241 300 return true; … … 257 316 return false; 258 317 259 setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 260 return true; 318 return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 261 319 } 262 320 … … 277 335 278 336 PropertySlot slot; 279 setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 280 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); 281 return true; 337 bool present = setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 338 if (present) 339 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); 340 return present; 282 341 } 283 342 … … 332 391 return false; 333 392 334 if (entry->attributes() & Function) { // function: put as override property 335 if (LIKELY(value.isCell())) 336 thisObj->putDirect(exec->globalData(), propertyName, value.asCell()); 337 else 338 thisObj->putDirect(exec->globalData(), propertyName, value); 339 } else if (!(entry->attributes() & ReadOnly)) 393 // If this is a function put it as an override property. 394 if (entry->attributes() & Function) 395 thisObj->putDirect(exec->globalData(), propertyName, value); 396 else if (!(entry->attributes() & ReadOnly)) 340 397 entry->propertyPutter()(exec, thisObj, value); 341 398
Note:
See TracChangeset
for help on using the changeset viewer.