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

Bernd Buschinski b.buschinski at googlemail.com
Tue Jan 22 03:11:48 GMT 2013


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

(Updated Jan. 22, 2013, 3:11 a.m.)


Review request for kdelibs.


Changes
-------

- aggressively optimise getDirect calls, use direct call wherever possible, instead of virtual vtable call
- Rebase on KDE/4.10
- Get rid of toString calls in exceptions messages which could also throw an exception


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 (updated)
-----

  kjs/CMakeLists.txt ef3c5e8 
  kjs/CommonIdentifiers.h 79f3207 
  kjs/array_instance.h d2f641f 
  kjs/array_instance.cpp 2469316 
  kjs/function.h 5dbbfb2 
  kjs/function.cpp 6263b36 
  kjs/object.h 9446349 
  kjs/object.cpp 9249902 
  kjs/object_object.cpp 39161e2 
  kjs/operations.h 477d99c 
  kjs/operations.cpp 73593fd 
  kjs/propertydescriptor.h PRE-CREATION 
  kjs/propertydescriptor.cpp PRE-CREATION 

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/20130122/a1b15521/attachment.htm>


More information about the kde-core-devel mailing list