Changeset 224927 in webkit for trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
- Timestamp:
- Nov 16, 2017, 11:08:37 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r222827 r224927 217 217 } 218 218 219 PropertyReificationResult JSFunction::reifyPropertyNameIfNeeded(JSCell* cell, ExecState* exec, PropertyName& propertyName) 220 { 221 JSFunction* thisObject = jsCast<JSFunction*>(cell); 222 PropertyStatus propertyType = thisObject->reifyLazyPropertyIfNeeded(exec->vm(), exec, propertyName); 223 return isReified(propertyType) ? PropertyReificationResult::Something : PropertyReificationResult::Nothing; 224 } 225 219 226 CallType JSFunction::getCallData(JSCell* cell, CallData& callData) 220 227 { … … 443 450 444 451 if (thisObject->isHostOrBuiltinFunction()) { 445 LazyPropertyType propType = thisObject->reifyLazyPropertyForHostOrBuiltinIfNeeded(vm, exec, propertyName);446 if ( propType == LazyPropertyType::IsLazyProperty)452 PropertyStatus propertyType = thisObject->reifyLazyPropertyForHostOrBuiltinIfNeeded(vm, exec, propertyName); 453 if (isLazy(propertyType)) 447 454 slot.disableCaching(); 448 455 scope.release(); … … 476 483 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 477 484 } 478 LazyPropertyType propType = thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);479 if ( propType == LazyPropertyType::IsLazyProperty)485 PropertyStatus propertyType = thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName); 486 if (isLazy(propertyType)) 480 487 slot.disableCaching(); 481 488 scope.release(); … … 643 650 unsigned initialAttributes = PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly; 644 651 const Identifier& identifier = vm.propertyNames->length; 652 rareData->setHasReifiedLength(); 645 653 putDirect(vm, identifier, initialValue, initialAttributes); 646 647 rareData->setHasReifiedLength();648 654 } 649 655 … … 684 690 name = makeString("set ", name); 685 691 692 rareData->setHasReifiedName(); 686 693 putDirect(vm, propID, jsString(exec, name), initialAttributes); 687 rareData->setHasReifiedName(); 688 } 689 690 JSFunction::LazyPropertyType JSFunction::reifyLazyPropertyIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 691 { 692 if (reifyLazyLengthIfNeeded(vm, exec, propertyName) == LazyPropertyType::IsLazyProperty)693 return LazyPropertyType::IsLazyProperty;694 if ( propertyName == vm.propertyNames->name) {695 if (!hasReifiedName())696 reifyName(vm, exec);697 return LazyPropertyType::IsLazyProperty;698 }699 return LazyPropertyType::NotLazyProperty;700 } 701 702 JSFunction:: LazyPropertyTypeJSFunction::reifyLazyPropertyForHostOrBuiltinIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName)694 } 695 696 JSFunction::PropertyStatus JSFunction::reifyLazyPropertyIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 697 { 698 if (isHostOrBuiltinFunction()) 699 return PropertyStatus::Eager; 700 PropertyStatus lazyLength = reifyLazyLengthIfNeeded(vm, exec, propertyName); 701 if (isLazy(lazyLength)) 702 return lazyLength; 703 PropertyStatus lazyName = reifyLazyNameIfNeeded(vm, exec, propertyName); 704 if (isLazy(lazyName)) 705 return lazyName; 706 return PropertyStatus::Eager; 707 } 708 709 JSFunction::PropertyStatus JSFunction::reifyLazyPropertyForHostOrBuiltinIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 703 710 { 704 711 ASSERT(isHostOrBuiltinFunction()); 705 712 if (isBuiltinFunction()) { 706 if (reifyLazyLengthIfNeeded(vm, exec, propertyName) == LazyPropertyType::IsLazyProperty) 707 return LazyPropertyType::IsLazyProperty; 713 PropertyStatus lazyLength = reifyLazyLengthIfNeeded(vm, exec, propertyName); 714 if (isLazy(lazyLength)) 715 return lazyLength; 708 716 } 709 717 return reifyLazyBoundNameIfNeeded(vm, exec, propertyName); 710 718 } 711 719 712 JSFunction:: LazyPropertyTypeJSFunction::reifyLazyLengthIfNeeded(VM& vm, ExecState*, PropertyName propertyName)720 JSFunction::PropertyStatus JSFunction::reifyLazyLengthIfNeeded(VM& vm, ExecState*, PropertyName propertyName) 713 721 { 714 722 if (propertyName == vm.propertyNames->length) { 715 if (!hasReifiedLength()) 723 if (!hasReifiedLength()) { 716 724 reifyLength(vm); 717 return LazyPropertyType::IsLazyProperty; 718 } 719 return LazyPropertyType::NotLazyProperty; 720 } 721 722 JSFunction::LazyPropertyType JSFunction::reifyLazyBoundNameIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 725 return PropertyStatus::Reified; 726 } 727 return PropertyStatus::Lazy; 728 } 729 return PropertyStatus::Eager; 730 } 731 732 JSFunction::PropertyStatus JSFunction::reifyLazyNameIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 733 { 734 if (propertyName == vm.propertyNames->name) { 735 if (!hasReifiedName()) { 736 reifyName(vm, exec); 737 return PropertyStatus::Reified; 738 } 739 return PropertyStatus::Lazy; 740 } 741 return PropertyStatus::Eager; 742 } 743 744 JSFunction::PropertyStatus JSFunction::reifyLazyBoundNameIfNeeded(VM& vm, ExecState* exec, PropertyName propertyName) 723 745 { 724 746 const Identifier& nameIdent = vm.propertyNames->name; 725 747 if (propertyName != nameIdent) 726 return LazyPropertyType::NotLazyProperty;748 return PropertyStatus::Eager; 727 749 728 750 if (hasReifiedName()) 729 return LazyPropertyType::IsLazyProperty;751 return PropertyStatus::Lazy; 730 752 731 753 if (isBuiltinFunction()) … … 735 757 String name = makeString("bound ", static_cast<NativeExecutable*>(m_executable.get())->name()); 736 758 unsigned initialAttributes = PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly; 759 rareData->setHasReifiedName(); 737 760 putDirect(vm, nameIdent, jsString(exec, name), initialAttributes); 738 rareData->setHasReifiedName(); 739 } 740 return LazyPropertyType::IsLazyProperty; 761 } 762 return PropertyStatus::Reified; 741 763 } 742 764
Note:
See TracChangeset
for help on using the changeset viewer.