JavaScriptCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Jul 2006 21:06:28 +0000 (21:06 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Jul 2006 21:06:28 +0000 (21:06 +0000)
commitb1f7e57f5ad2932037ae113f509025be0efc133e
treeae9439a30f22335c328b5d65e21de173853ba8f1
parent558f3edffc5190776f3f6e3e7c02eb9503f412e9
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
41 files changed:
JavaScriptCore/API/APICast.h
JavaScriptCore/API/JSBase.h
JavaScriptCore/API/JSCallbackObject.cpp
JavaScriptCore/API/JSCallbackObject.h
JavaScriptCore/API/JSClassRef.cpp
JavaScriptCore/API/JSClassRef.h
JavaScriptCore/API/JSObjectRef.cpp
JavaScriptCore/API/JSObjectRef.h
JavaScriptCore/API/testapi.c
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/kjs/PropertyNameArray.cpp [new file with mode: 0644]
JavaScriptCore/kjs/PropertyNameArray.h [new file with mode: 0644]
JavaScriptCore/kjs/array_instance.h
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/object.h
JavaScriptCore/kjs/property_map.cpp
JavaScriptCore/kjs/property_map.h
JavaScriptCore/kjs/protected_reference.h [deleted file]
JavaScriptCore/kjs/reference.cpp [deleted file]
JavaScriptCore/kjs/reference.h [deleted file]
JavaScriptCore/kjs/reference_list.cpp [deleted file]
JavaScriptCore/kjs/reference_list.h [deleted file]
JavaScriptCore/kjs/scope_chain.cpp
JavaScriptCore/kjs/string_object.cpp
JavaScriptCore/kjs/string_object.h
JavaScriptCore/kjs/ustring.h
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/JSValueWrapper.cpp
JavaScriptGlue/UserObjectImp.cpp
JavaScriptGlue/UserObjectImp.h
LayoutTests/ChangeLog
LayoutTests/fast/js/for-in-avoid-duplicates-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/for-in-avoid-duplicates.html [new file with mode: 0644]
LayoutTests/fast/js/kde/Array-expected.txt
LayoutTests/fast/js/resources/for-in-avoid-duplicates.js [new file with mode: 0644]