Changeset 153532 in webkit for trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
- Timestamp:
- Jul 31, 2013, 12:03:05 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r153229 r153532 628 628 inline JSValue JSValue::get(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const 629 629 { 630 if (UNLIKELY(!isCell())) { 631 JSObject* prototype = synthesizePrototype(exec); 632 if (!prototype->getPropertySlot(exec, propertyName, slot)) 633 return jsUndefined(); 630 // If this is a primitive, we'll need to synthesize the prototype - 631 // and if it's a string there are special properties to check first. 632 JSObject* object; 633 if (UNLIKELY(!isObject())) { 634 if (isCell() && asString(*this)->getStringPropertySlot(exec, propertyName, slot)) 635 return slot.getValue(exec, propertyName); 636 object = synthesizePrototype(exec); 637 } else 638 object = asObject(asCell()); 639 640 if (object->getPropertySlot(exec, propertyName, slot)) 634 641 return slot.getValue(exec, propertyName); 635 } 636 JSCell* cell = asCell(); 637 while (true) { 638 if (cell->fastGetOwnPropertySlot(exec, propertyName, slot)) 639 return slot.getValue(exec, propertyName); 640 JSValue prototype = asObject(cell)->prototype(); 641 if (!prototype.isObject()) 642 return jsUndefined(); 643 cell = asObject(prototype); 644 } 642 return jsUndefined(); 645 643 } 646 644 … … 653 651 inline JSValue JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot& slot) const 654 652 { 655 if (UNLIKELY(!isCell())) { 656 JSObject* prototype = synthesizePrototype(exec); 657 if (!prototype->getPropertySlot(exec, propertyName, slot)) 658 return jsUndefined(); 653 // If this is a primitive, we'll need to synthesize the prototype - 654 // and if it's a string there are special properties to check first. 655 JSObject* object; 656 if (UNLIKELY(!isObject())) { 657 if (isCell() && asString(*this)->getStringPropertySlot(exec, propertyName, slot)) 658 return slot.getValue(exec, propertyName); 659 object = synthesizePrototype(exec); 660 } else 661 object = asObject(asCell()); 662 663 if (object->getPropertySlot(exec, propertyName, slot)) 659 664 return slot.getValue(exec, propertyName); 660 } 661 JSCell* cell = const_cast<JSCell*>(asCell()); 662 while (true) { 663 if (cell->methodTable()->getOwnPropertySlotByIndex(cell, exec, propertyName, slot)) 664 return slot.getValue(exec, propertyName); 665 JSValue prototype = asObject(cell)->prototype(); 666 if (!prototype.isObject()) 667 return jsUndefined(); 668 cell = prototype.asCell(); 669 } 665 return jsUndefined(); 670 666 } 671 667
Note:
See TracChangeset
for help on using the changeset viewer.