Changeset 41232 in webkit for trunk/JavaScriptCore/runtime/JSGlobalObject.h
- Timestamp:
- Feb 25, 2009, 3:44:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r41126 r41232 330 330 } 331 331 332 inline JSValuePtr Structure::prototypeForLookup(ExecState* exec) 332 inline JSValuePtr Structure::prototypeForLookup(ExecState* exec) const 333 333 { 334 334 if (typeInfo().type() == ObjectType) … … 340 340 ASSERT(typeInfo().type() == NumberType); 341 341 return exec->lexicalGlobalObject()->numberPrototype(); 342 } 343 344 inline StructureChain* Structure::prototypeChain(ExecState* exec) const 345 { 346 // We cache our prototype chain so our clients can share it. 347 if (!isValid(exec, m_cachedPrototypeChain.get())) { 348 JSValuePtr prototype = prototypeForLookup(exec); 349 m_cachedPrototypeChain = StructureChain::create(prototype.isNull() ? 0 : asObject(prototype)->structure()); 350 } 351 return m_cachedPrototypeChain.get(); 352 } 353 354 inline bool Structure::isValid(ExecState* exec, StructureChain* cachedPrototypeChain) const 355 { 356 if (!cachedPrototypeChain) 357 return false; 358 359 JSValuePtr prototype = prototypeForLookup(exec); 360 RefPtr<Structure>* cachedStructure = cachedPrototypeChain->head(); 361 while(*cachedStructure && !prototype.isNull()) { 362 if (asObject(prototype)->structure() != *cachedStructure) 363 return false; 364 ++cachedStructure; 365 prototype = asObject(prototype)->prototype(); 366 } 367 return prototype.isNull() && !*cachedStructure; 342 368 } 343 369
Note:
See TracChangeset
for help on using the changeset viewer.