Ignore:
Timestamp:
Jul 16, 2006, 2:06:28 PM (19 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.


  • switch property lists to be vector+set of Identifiers instead of list of References


This has the following benefits:


  • no duplicates in property lists
  • simplifies API calls
  • probably more efficient, since linked list is gone
  • entirely removed Reference, ReferenceList and ProtectedReference types from the API
  • kjs/PropertyNameArray.cpp: Added. (KJS::PropertyNameArray::add): Check set, if not already there, add to vector.
  • kjs/PropertyNameArray.h: Added. (KJS::PropertyNameArray::PropertyNameArray): Newly added type, combines a set and a vector to make a unique but ordered list of identifiers. (KJS::PropertyNameArray::begin): ditto (KJS::PropertyNameArray::end): ditto (KJS::PropertyNameArray::size): ditto (KJS::PropertyNameArray::operator[]): ditto
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstance::getPropertyNames): renamed from getPropertyList, updated for PropertyNameArray (ArrayInstance::setLength): updated for PropertyNameArray (ArrayInstance::pushUndefinedObjectsToEnd): ditto
  • kjs/nodes.cpp: (ForInNode::execute): updated for PropertyNameArray
  • kjs/nodes.h:
  • kjs/object.cpp: (KJS::JSObject::getPropertyNames): renamed from getPropertyList, updated for PropertyNameArray
  • kjs/object.h:
  • kjs/property_map.cpp: (KJS::PropertyMap::getEnumerablePropertyNames): updated for PropertyNameArray (KJS::PropertyMap::getSparseArrayPropertyNames): ditto
  • kjs/property_map.h:
  • kjs/protected_reference.h: Removed.
  • kjs/reference.cpp: Removed.
  • kjs/reference.h: Removed.
  • kjs/reference_list.cpp: Removed.
  • kjs/reference_list.h: Removed.
  • kjs/scope_chain.cpp: (KJS::ScopeChain::print): Use PropertyNamesArray instead of ReferenceList.
  • kjs/string_object.cpp: (StringInstance::getPropertyNames): Updated for new approach.
  • kjs/string_object.h:
  • kjs/ustring.h:
  • API/APICast.h: (toJS): Added overload for PropertyNameAccumulatorRef / PropertyNameArray* (toRef): ditto
  • API/JSBase.h:
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::getPropertyNames): Fixed for new API.
  • API/JSCallbackObject.h:
  • API/JSObjectRef.cpp: (JSPropertyNameArray::JSPropertyNameArray): Type used for a publicly vended JSPropertyNameArrayRef. (JSObjectCopyPropertyNames): New API call - renamed / refactored from JSObjectCreatePropertyList (JSPropertyNameArrayRetain): new retain call for JSPropertyNameArray. (JSPropertyNameArrayRelease): new release call for - " -. (JSPropertyNameArrayGetCount): Instead of having to use a stateful enumerator you can now get the count and items in any order. (JSPropertyNameArrayGetNameAtIndex): See above. (JSPropertyNameAccumulatorAddName): What you add properties to is now an opaque accumulator object.
  • API/JSObjectRef.h: Prototyped new functions, removed old ones
  • JavaScriptCore.exp: Updated exported symbols.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added new files, removed old.
  • API/testapi.c: (MyObject_getPropertyNames): Renamed / fixed callback to fit new paradigm. (main): Updated for new API.

JavaScriptGlue:

Reviewed by Darin.

  • switch property lists to be vector+set of Identifiers instead of list of References


  • JSUtils.cpp: (KJSValueToCFTypeInternal): updated for JSC SPI changes
  • JSValueWrapper.cpp: (JSValueWrapper::JSObjectCopyPropertyNames): ditto
  • UserObjectImp.cpp: (UserObjectImp::getPropertyNames): ditto
  • UserObjectImp.h:

LayoutTests:

Reviewed by Darin.


  • new test case and updated results for property list changes
  • fast/js/for-in-avoid-duplicates-expected.txt: Added.
  • fast/js/for-in-avoid-duplicates.html: Added.
  • fast/js/kde/Array-expected.txt:
  • fast/js/resources/for-in-avoid-duplicates.js: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r15462 r15468  
    1414_JSObjectCallAsConstructor
    1515_JSObjectCallAsFunction
    16 _JSObjectCreatePropertyEnumerator
     16_JSObjectCopyPropertyNames
    1717_JSObjectDeleteProperty
    1818_JSObjectGetPrivate
    1919_JSObjectGetProperty
     20_JSObjectGetPropertyAtIndex
    2021_JSObjectGetPrototype
    2122_JSObjectHasProperty
     
    2829_JSObjectSetPrivate
    2930_JSObjectSetProperty
     31_JSObjectSetPropertyAtIndex
    3032_JSObjectSetPrototype
    31 _JSPropertyEnumeratorGetNextName
    32 _JSPropertyEnumeratorRelease
    33 _JSPropertyEnumeratorRetain
    34 _JSPropertyListAdd
     33_JSPropertyNameAccumulatorAddName
     34_JSPropertyNameArrayGetCount
     35_JSPropertyNameArrayGetNameAtIndex
     36_JSPropertyNameArrayRelease
     37_JSPropertyNameArrayRetain
    3538_JSStringCopyCFString
    3639_JSStringCreateWithCFString
     
    139142__ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateEPNS_8JSObjectERKNS_10IdentifierERKS0_
    140143__ZN3KJS12jsNumberCellEd
    141 __ZN3KJS13ReferenceList6appendERKNS_9ReferenceE
    142 __ZN3KJS13ReferenceListC1Ev
    143 __ZN3KJS13ReferenceListD1Ev
    144144__ZN3KJS13SavedBuiltinsC1Ev
    145145__ZN3KJS13SavedBuiltinsD1Ev
     
    147147__ZN3KJS15SavedPropertiesD1Ev
    148148__ZN3KJS16RuntimeObjectImpC1EPNS_8Bindings8InstanceE
     149__ZN3KJS17PropertyNameArray3addERKNS_10IdentifierE
    149150__ZN3KJS18lengthPropertyNameE
    150151__ZN3KJS19InternalFunctionImp11hasInstanceEPNS_9ExecStateEPNS_7JSValueE
     
    152153__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
    153154__ZN3KJS19messagePropertyNameE
    154 __ZN3KJS21ReferenceListIteratorppEi
    155155__ZN3KJS21prototypePropertyNameE
    156156__ZN3KJS4List6appendEPNS_7JSValueE
     
    187187__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    188188__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    189 __ZN3KJS8JSObject15getPropertyListERNS_13ReferenceListEb
     189__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
    190190__ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    191191__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
     
    207207__ZN3KJS9Collector7protectEPNS_7JSValueE
    208208__ZN3KJS9Collector9unprotectEPNS_7JSValueE
    209 __ZN3KJS9ReferenceC1EPNS_8JSObjectERKNS_10IdentifierE
    210209__ZN3KJSeqERKNS_7UStringEPKc
    211210__ZN3WTF10fastCallocEmm
     
    222221__ZNK3KJS11PropertyMap4saveERNS_15SavedPropertiesE
    223222__ZNK3KJS12DateInstance7getTimeERdRi
    224 __ZNK3KJS13ReferenceList3endEv
    225 __ZNK3KJS13ReferenceList5beginEv
    226223__ZNK3KJS19InternalFunctionImp14implementsCallEv
    227224__ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv
    228 __ZNK3KJS21ReferenceListIteratorneERKS0_
    229 __ZNK3KJS21ReferenceListIteratorptEv
    230225__ZNK3KJS4List2atEi
    231226__ZNK3KJS4List8copyTailEv
     
    258253__ZNK3KJS8JSObject9toBooleanEPNS_9ExecStateE
    259254__ZNK3KJS9ExecState18lexicalInterpreterEv
    260 __ZNK3KJS9Reference15getPropertyNameEv
    261255__ZTVN3KJS19InternalFunctionImpE
    262256__ZTVN3KJS8JSObjectE
Note: See TracChangeset for help on using the changeset viewer.