Changeset 154336 in webkit for trunk/Source/JavaScriptCore/runtime/Lookup.h
- Timestamp:
- Aug 20, 2013, 10:09:03 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Lookup.h
r154253 r154336 256 256 } 257 257 258 template <class ThisImp, class ParentImp>259 inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor)260 {261 const HashEntry* entry = table->entry(exec, propertyName);262 263 if (!entry) // not found, forward to parent264 return ParentImp::getOwnPropertyDescriptor(thisObj, exec, propertyName, descriptor);265 266 PropertySlot slot(thisObj);267 if (entry->attributes() & Function) {268 bool present = setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);269 if (present)270 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());271 return present;272 }273 274 slot.setCustom(thisObj, entry->attributes(), entry->propertyGetter());275 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());276 return true;277 }278 279 258 /** 280 259 * Simplified version of getStaticPropertySlot in case there are only functions. … … 294 273 return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 295 274 } 296 297 /**298 * Simplified version of getStaticPropertyDescriptor in case there are only functions.299 * Using this instead of getStaticPropertyDescriptor allows 'this' to avoid implementing300 * a dummy getValueProperty.301 */302 template <class ParentImp>303 inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor)304 {305 if (ParentImp::getOwnPropertyDescriptor(static_cast<ParentImp*>(thisObj), exec, propertyName, descriptor))306 return true;307 308 const HashEntry* entry = table->entry(exec, propertyName);309 if (!entry)310 return false;311 312 PropertySlot slot(thisObj);313 bool present = setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);314 if (present)315 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());316 return present;317 }318 275 319 276 /** … … 332 289 333 290 slot.setCacheableCustom(thisObj, entry->attributes(), entry->propertyGetter()); 334 return true;335 }336 337 /**338 * Simplified version of getStaticPropertyDescriptor in case there are no functions, only "values".339 * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class.340 */341 template <class ThisImp, class ParentImp>342 inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor)343 {344 const HashEntry* entry = table->entry(exec, propertyName);345 346 if (!entry) // not found, forward to parent347 return ParentImp::getOwnPropertyDescriptor(thisObj, exec, propertyName, descriptor);348 349 ASSERT(!(entry->attributes() & Function));350 PropertySlot slot(thisObj);351 slot.setCustom(thisObj, entry->attributes(), entry->propertyGetter());352 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());353 291 return true; 354 292 }
Note:
See TracChangeset
for help on using the changeset viewer.