Changeset 9889 in webkit for trunk/JavaScriptCore/kjs/object.h
- Timestamp:
- Jul 25, 2005, 3:17:20 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/object.h
r9795 r9889 504 504 */ 505 505 // [[Get]] - must be implemented by all Objects 506 virtual Value get(ExecState *exec, const Identifier &propertyName) const; 507 virtual Value get(ExecState *exec, unsigned propertyName) const; 506 Value get(ExecState *exec, const Identifier &propertyName) const; 507 Value get(ExecState *exec, unsigned propertyName) const; 508 509 bool getProperty(ExecState *exec, const Identifier& propertyName, Value& result) const; 510 bool getProperty(ExecState *exec, unsigned propertyName, Value& result) const; 511 512 virtual bool getOwnProperty(ExecState *exec, const Identifier& propertyName, Value& result) const; 513 virtual bool getOwnProperty(ExecState *exec, unsigned propertyName, Value& result) const; 508 514 509 515 /** … … 633 639 }; 634 640 641 642 // it may seem crazy to inline a function this large but it makes a big difference 643 // since this is function very hot in variable lookup 644 inline bool ObjectImp::getProperty(ExecState *exec, const Identifier& propertyName, Value& result) const 645 { 646 const ObjectImp *imp = this; 647 648 while (true) { 649 if (imp->getOwnProperty(exec, propertyName, result)) 650 return true; 651 652 const ValueImp *proto = imp->_proto; 653 if (proto->dispatchType() != ObjectType) 654 break; 655 656 imp = static_cast<const ObjectImp *>(proto); 657 } 658 659 return false; 660 } 661 662 // it may seem crazy to inline a function this large, especially a virtual function, 663 // but it makes a big difference to property lookup if subclasses can inline their 664 // superclass call to this 665 inline bool ObjectImp::getOwnProperty(ExecState *exec, const Identifier &propertyName, Value &result) const 666 { 667 ValueImp *imp = getDirect(propertyName); 668 if (imp) { 669 result = Value(imp); 670 return true; 671 } 672 673 // non-standard netscape extension 674 if (propertyName == specialPrototypePropertyName) { 675 result = Value(_proto); 676 return true; 677 } 678 679 return false; 680 } 681 635 682 /** 636 683 * Types of Native Errors available. For custom errors, GeneralError
Note:
See TracChangeset
for help on using the changeset viewer.