aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_objects.h
Commit message (Collapse)AuthorAgeFilesLines
* Add fast conversion of a string to an array indexLars Knoll2013-01-041-0/+2
| | | | | | | | This will be required later on when Array gets fixed properly. Change-Id: I37eccf94b202c9a003aab30b078ee24c422359a1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Save some memoryLars Knoll2013-01-031-11/+6
| | | | | | | | | Move some boolean flags from Object and FunctionObject into the Managed class and reduce the size of these Objects. Change-Id: Iee9ab09407ec44b447f9597a9b1d55e9092e7ad5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the Managed class into it's own fileLars Knoll2013-01-031-24/+1
| | | | | | | Preparations for some further cleanups. Change-Id: Id9fa3a8541748ee70085bc84985ac508f989e1d3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup constructor handlingLars Knoll2012-12-171-2/+0
| | | | | | | | Simplify the code and unify the generic part of object construction in FunctionObject::construct. Change-Id: Ie430458bedaa211efba37c8283e26a9b84e6764a Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Micro optimization of StringPoolJędrzej Nowacki2012-12-141-1/+1
| | | | | | | | | | In destructor we do not need to create a copy off all pointers. By hiding StringPool::strings in class private section we reduce risk of it being accidentally copied. Change-Id: I1b9df6bf9e49bd6926e84b8eac6b3d904277e50a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes for arguments object in non strict modeLars Knoll2012-12-141-1/+9
| | | | | | | | | | | | | In non strict mode, the arguments object actually reflects the argument as it changes over the lifetime of a function, unless you explicitly delete some of it's properties. The code to implement this is pretty ugly, but still better then the specification :) Change-Id: Ie42ed25c797513615fbc4bdee14145d953f323f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes for the arguments objectLars Knoll2012-12-141-4/+4
| | | | | | | We now pass most of the test cases for it. Change-Id: Idc43a9baa75c3c1e8fe760d78cf5e6092f051c6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup getPropertyDescriptor and arguments objectLars Knoll2012-12-141-3/+4
| | | | | | | | | | The only place where getProepertyDescriptor was still being used outside of Object itself was the arguments object. Fixed that by reimplementing get, hasProperty, put and canPut in the arguments object. Change-Id: Ie44c7acf857321c65bc0f58915de0353231459c0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify/speed up retrieving of propertiesLars Knoll2012-12-141-5/+5
| | | | | | | | | | | The hasProperty()/get() sequence used so far is as in the spec, but requires us to lookup the name twice. Instead add a bool hasProperty() to Object::__get__() and use that. Speeds up fact.2.js by ~20% Change-Id: Ic8c84718f1a702c3da9487010c0d6dd0fee44609 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Unset/Set to the more readable Enabled/Disabled for the property tristateSimon Hausmann2012-12-131-8/+8
| | | | | Change-Id: I67f5a509be64b20a5fa0205779f2a67dc1ba6536 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Prevent accidental allocation of GC managed objects on the regular heapSimon Hausmann2012-12-131-0/+1
| | | | | | | | | Make the regular new operator private. As it turns out no other changes were required, all the existing objects are already allocated on the GC heap, thanks to the new* factor functions in ExecutionEngine. Change-Id: I9b69221b5bbc4491ca909ec6bb5afe0f3c010b54 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use a smart pointer for Object::members.Jędrzej Nowacki2012-12-131-2/+2
| | | | | Change-Id: I070c00281a5b92de82568d4d4e0bb35700233a21 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused property (Object::klass)Jędrzej Nowacki2012-12-131-2/+0
| | | | | Change-Id: I623ceeceb810719f44ed832f0cc37a1d74430db3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix access rights for builtin propertiesLars Knoll2012-12-121-1/+7
| | | | | | | | | | | According to the spec all builtin properties have writable: true, enumerable: false and configurable:true by default. This is what is now being used. Some constants have all attributes set to false, and there is an extra method for setting these readonly properties. Change-Id: If5ba875bcc9f1644aa8a07a2d9b37716bf228e12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove IR::Function from the runtime.Erik Verbruggen2012-12-111-9/+35
| | | | | | | | | | This fixes potential leaks of IR::Functions, lowers the memory usage of the functions that the VM needs (because the IR fields are not present in the VM::Function), and makes both managed by the module respectively the ExecutionEngine. Change-Id: I6748ad98b062f994eae9dd14f1919aec5aa7c0b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make the Math constants constantLars Knoll2012-12-111-0/+1
| | | | | | | Mark the Math.pi etc. constants as readonly. Change-Id: I9224400ae48c7f21fc3b0478898c7c78aa7f45df Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a MemoryManager, which does GC for the interpreter.Erik Verbruggen2012-12-081-1/+35
| | | | | | | | | Todo: - stack walking for MASM - fix all TODOs/FIXMEs and hidden treasures (bugs). Change-Id: I36f8cdc3a545df7287ce1df17b3570a9c017865e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the ActivationObjectLars Knoll2012-12-051-13/+1
| | | | | | | | Also implement __qmljs_xxx_activation_property in a more correct way. Change-Id: I60c330bccca21fad99930987ed78153114a80c7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Throw proper type and reference errorsLars Knoll2012-12-041-0/+4
| | | | | Change-Id: I898017f3e63ada72fc2e50abfa1880f9fd7ffe37 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow only the ExecutionEngine's StringPool to create Strings.Erik Verbruggen2012-12-041-3/+6
| | | | | | | | Strings are the only non-Object Values living on the heap. So by tracking creation, we can help the future GC a lot. Change-Id: I5d5044f9ff10da42aeb75dd4a556d6ab3d839b1a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove the callFunction() methodLars Knoll2012-12-021-0/+2
| | | | | | | | | Give Object a virtual call() method, that simply throws a type error. FunctionObject reimplements this to do the right thing. Change-Id: I5a11a4de0302ad86b9ad3a822501224e11692b70 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the DeclarativeEnvironment class againLars Knoll2012-12-021-4/+4
| | | | | | | | | The class is a specification detail that we can implement in a more performant way. ExecutionContext now contains everything needed again. Change-Id: Ideb5f04eeeecaf2b8543676c626e3943e4d6d7a1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Clean up the DeclarativeEnvironmentLars Knoll2012-11-301-1/+1
| | | | | | | | Add a pointer to the FunctionObject in there, and remove the duplication of the formal and local variable names. Change-Id: Id8017b3e167228292b5d351e02b8927f0bfb41eb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Get rid of variableEnvironmentLars Knoll2012-11-301-1/+1
| | | | | | | | | | | | Found out that the variableEnv is only required for two use cases: To expose the exception in the catch statement, and to create temporary environments for the with() statment. Both can be better handled differently and don't require the overhead of two environments. Change-Id: I149e1fd7bdfc3267544b141b6f94e46e42cf641b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Give primeIds the amount of bits it requiresLars Knoll2012-11-301-3/+3
| | | | | | | Also mark the prime number array as const Change-Id: Ieae3e5d13decb0edf0d086780b323a12351a55d8 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Add some debugging infrastructure to the interpreter.Erik Verbruggen2012-11-291-0/+4
| | | | | | | | | This currently mainly intended to be useful in a C++ debugger. The infrastructure makes it a lot easier to access (parent) contexts, find function names, etc. Change-Id: I0493d3a3bd4bf5c3a03379c1a2b545ed76862cd5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Set the name of a function in more (most?) cases.Erik Verbruggen2012-11-291-4/+4
| | | | | Change-Id: I1c2b9d61b6d97e3c2a8cb976fb6be8b68d51ae28 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add defineGetter and defineSetter methods to ObjectLars Knoll2012-11-291-2/+4
| | | | | | | | These methods are de-facto standard (every engine implements them), and also allow testing of accessor properties. Change-Id: I1fcaa7467f7be56ea758bf511e843385f74b9641 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Tune the bucket count a bit to be a prime upto 68000 entries.Erik Verbruggen2012-11-281-6/+19
| | | | | | | | The ECMA test suite has some tests that throw in vars with all possible unicode names. So, this should make it safer for longer. Change-Id: I4a65ab7d09a357d7665509d38e401098ab6e4607 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Throw a SyntaxError instead of printing an error message.Erik Verbruggen2012-11-281-2/+9
| | | | | Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix a bug in Object::__put__()Lars Knoll2012-11-281-1/+1
| | | | | | | | The method was always throwing in strict mode, due to a missing return statement. Change-Id: I85e44f8067d1f2aea76d03e42abf31a0d5a2d180 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Obey strict mode for property getters and settersLars Knoll2012-11-281-3/+3
| | | | | Change-Id: I6f51cd72c2607989c55373dfee53130381f5ef75 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Implement the first parts of strict mode.Lars Knoll2012-11-281-8/+10
| | | | | | | | Tested with eval() which now obeys strict mode semantics. Change-Id: Ib3c7f31047e43c1ef0fa74261f23ec4f2ea4244f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix some issues with the delete operatorLars Knoll2012-11-251-1/+1
| | | | | | | | Properly implement delete operator for identifiers and local variables. Change-Id: I8ac55edc80c31a94d11444c9f5c78caf4b131c95 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Keep the EvalISelFactory in the ExecutionEngine.Erik Verbruggen2012-11-211-7/+4
| | | | | | | Also corrected the class name cApiTaliSatiOn. Change-Id: I131566e904c8ee575686a469f16d098dd512d865 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* return results directly instead of using the contextLars Knoll2012-11-201-10/+10
| | | | | | | | | The result variable in the context is not really required, as we can return results directly in the return value register. Change-Id: I12554c228500aa24625ef82e31fd7f72989a71bb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix isel for eval and a whole bunch of other warnings.Erik Verbruggen2012-11-191-2/+6
| | | | | | | A factory is now passed along to do the codegen for eval(). Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added isNaN and isFinite to the global context.Erik Verbruggen2012-11-191-0/+14
| | | | | Change-Id: Ia85d27a6ac82fd5dbf6b0f706747afa6418626b1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Better handling of contexts and environmentsLars Knoll2012-11-191-10/+17
| | | | | | | | | | Make the ExecutionContext standard compliant. Move most of it's members into a new DeclarativeEnvironment data structure that contains locals and arguments. Change-Id: I094f559168810dbd3717d677fe28750076015976 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the engine and context classes into their own filesLars Knoll2012-11-191-97/+2
| | | | | Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Context to ExecutionContextLars Knoll2012-11-191-65/+65
| | | | | | | | | This is so it'll map to the name used in the ECMAScript spec once the other refactorings are in. Change-Id: I8dcc7ad43b457ce50e7123c57bc4c770bcda8d11 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Create a proper function object for evalLars Knoll2012-11-181-1/+13
| | | | | | | | Still doesn't work correctly, as we can't modify the global context there. Change-Id: Ifd0ab217c3cf2d0c1b86f09907b440ea31c29ac8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Do not save/restore interpreter stack for exceptions.Erik Verbruggen2012-11-151-12/+3
| | | | | | | Only the instruction pointer and targetTempIndex are needed. Change-Id: I21279d68e74dac42d875e3ced9004e9d3c42c29d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added all missing error objects.Erik Verbruggen2012-11-151-0/+51
| | | | | Change-Id: I806184c5593af44d79b21afb1e3235ec9afa1e2a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup Context initializationLars Knoll2012-11-151-1/+1
| | | | | | | | Make the initialization for call() compliant with the standard, and add a strict mode boolean. Change-Id: I8617af8dbfde47d8b2a8a0a7ce0ab491031ba4ba Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add missing message property to the ErrorObject.Erik Verbruggen2012-11-141-0/+1
| | | | | Change-Id: Ice16360f98d1d66162440d972c6bfbc416884474 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix interpreter exception handling.Erik Verbruggen2012-11-141-1/+12
| | | | | | | | | The stack frame of the interpreting function is restored, but all the datastructures live on the heap. So, save them out on handler creation, and restore them afterwards. Change-Id: I84b84007cc9944b56926bf0387c2798f7841cd2a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property deletion.Erik Verbruggen2012-11-121-5/+5
| | | | | | | | Also tweak the bucket size calculation to be prime for just a bit longer than. Change-Id: I9fc6779956693301eb01a6558d4c20d8e39d8bad Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Better argument ordering.Lars Knoll2012-11-121-1/+1
| | | | | Change-Id: I1d47ce7bd2cf27bc43a0e9afbfb2914296c9d704 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Clean up inplace binary operations for subscripts.Lars Knoll2012-11-121-0/+3
| | | | | | | | Remove a lot of duplicated code, and make it a lot easier to implement JS compliant semantics. Change-Id: Ic5ecb58d34a5df8fe05e86c5f906d70c50c51b54 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>