Review Request: KJS: Implement Object.GetOwnPropertyDescriptor & Object.DefineProperty

Maks Orlovich maksim at kde.org
Tue Apr 10 03:53:58 BST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104515/#review12282
-----------------------------------------------------------


I think I need a bit of higher-level info from here; plus I guess refining the other one (which has far simpler stuff to fix) and submitting it would remove some of the duplication..


kjs/CMakeLists.txt
<http://git.reviewboard.kde.org/r/104515/#comment9651>

    where is this file?
    



kjs/array_instance.cpp
<http://git.reviewboard.kde.org/r/104515/#comment9653>

    Could the array stuff perhaps be split out?



kjs/array_instance.cpp
<http://git.reviewboard.kde.org/r/104515/#comment9652>

    This is useless; it does what the default one would do (and why not copy constructor then?)



kjs/object.h
<http://git.reviewboard.kde.org/r/104515/#comment9654>

    This is why I don't like the making of these virtual: getDirectLocation goes with these, so if these are virtual so should it be, but getDirectLocation is used by the Window object, so it's absolutely and utterly performance-critical.
    
    What I don't understand is: is there actually generic/polymorphic code that needs to call both the default and array's version?
    



kjs/object.cpp
<http://git.reviewboard.kde.org/r/104515/#comment9655>

    I don't understand all that you're doing here --- you invoke getOwnPropertySlot (which is virtual and may be overridden in subclasses, then getPropertyAttributes and then getDirect. And then get. What's the interface to the subclass here? Just how many look ups is it doing, etc.?
    



kjs/object.cpp
<http://git.reviewboard.kde.org/r/104515/#comment9656>

    There is an explicit isUndefined check, but what about the ways in which toObject can fail?



kjs/operations.cpp
<http://git.reviewboard.kde.org/r/104515/#comment9657>

    Please point out how this isn't the same as strictEquals (due to the spec having two almost identical, but slightly different in handling of FP ops).
    


- Maks Orlovich


On April 9, 2012, 8:23 p.m., Bernd Buschinski wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104515/
> -----------------------------------------------------------
> 
> (Updated April 9, 2012, 8:23 p.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Description
> -------
> 
> KJS: Implement Object.GetOwnPropertyDescriptor & Object.DefineProperty
> 
> This is a pretty big patch, to get Object.defineProperty perfect for ecmascript (for all tests that only use implemented stuff, all test that use Object.create for example will fail, as its not implemented)
> 
> PropertyDescriptor:
> Necessary for collectiong data, this introduce new CommonIdentifiers.h, this might requiere to rebuild khtml against new kjs, otherwise it might cause weird crashes (at least for me)
> 
> 
> object.h:
> Beside from adding new getPropertyDescriptor & getOwnPropertyDescriptor & defineOwnProperty, the important changes are making
> getPropertyAttributes, put/get/remove-Direct virtual.
> Why do I need that?
> Because put checks if the prototype already has property XYZ and uses it. Now imagine an array that got a setter-only property via a prototype. DefineProperty would try to use put, which uses the prototype property and it would fail. So all custom-data classes like Array need to implement/use put/get/remove-Direct.
> 
> 
> object.cpp:
> currently put on a setter-only property would always throw an exception, this is only correct for strict-mode, as we currently do not check for strict-mode it would make more sense to change it to default not throwing an exception.
> 
> 
> array.cpp/h:
> The old Array implementation did not store attributes for array indexes, I rewrote it to also store the attributes.
> + Bonus: also fix getOwnPropertyNames, as we now store attributes.
> + use new attributes, reject put/delete/enum if set
> 
> function.cpp (Arguments)
> changed the default attributes how parameter are stored, according to ECMA 10.6.11.b
> 
> 
> Rest is "just" the defineProperty implementation
> 
> 
> Diffs
> -----
> 
>   kjs/CMakeLists.txt 1188064 
>   kjs/CommonIdentifiers.h 8ee40e8 
>   kjs/array_instance.h 3f2b630 
>   kjs/array_instance.cpp fe9b8b4 
>   kjs/function.h 3757fe8 
>   kjs/function.cpp 5f39ae6 
>   kjs/object.h 047c242 
>   kjs/object.cpp c19122f 
>   kjs/object_object.cpp 986f03f 
>   kjs/operations.h f8a28c8 
>   kjs/operations.cpp d4c0066 
> 
> Diff: http://git.reviewboard.kde.org/r/104515/diff/
> 
> 
> Testing
> -------
> 
> ecmascript & daily surfing
> 
> used valgrind on many array testcases to check for possible memleaks
> 
> 
> Thanks,
> 
> Bernd Buschinski
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120410/2dd8a8e5/attachment.htm>


More information about the kde-core-devel mailing list