aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_runtime.h
Commit message (Collapse)AuthorAgeFilesLines
* Set data properties using __defineOwnProperties__Lars Knoll2013-01-041-0/+1
| | | | | | | | | | | | Properties in object literals are defined using defineOwnProperty, so that they get set even if the object prototype contains a non writable property with the same name. This fixes all remaining test cases for 11.1.5 Change-Id: I3928a144d09c51c5bf20a25bcb1c6c3c243975ee Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement { get/set ... }Lars Knoll2013-01-031-0/+1
| | | | | | | | Implement support for defining accessor properties through { ... }. Implementation for moth is pending. Change-Id: I558b6811bc5656dc0fae78c49e23155043ce9cb1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a bug in catch{}finally{} and simplify codeLars Knoll2012-12-171-0/+1
| | | | | | | | | | | There was a bug in the implementation of unwindException(), that caused failures when called twice from one catch statement. Also refactor and simplify the TryStatement code further by introducing a rethrow builtin. Change-Id: I77bf37f1707042f402488ef2dfaf4e59bf8dc82a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the bit shift and complement operatorsLars Knoll2012-12-131-9/+13
| | | | | | | | Take care of some corner cases and make them pass the test suite. Change-Id: Ic83508859800c62681ee873968b475ef81fffb82 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix increment and decrement operatorsLars Knoll2012-12-121-0/+2
| | | | | | | | These operators have semantics that are different from (foo + 1), as they always convert the LHS to a number first. Change-Id: I3fb4a1a328e3dfcb334875435c3cec90d01b67dd Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Correctly handle negative 0Lars Knoll2012-12-121-1/+2
| | | | | | | | | -0 and +0 are two distinct numbers. Since integers only have one 0 value, we need to convert the number to double when negating a 0 Change-Id: I915c4bd7168eece947fa91c6b65137a873d4f75a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove IR::Function from the runtime.Erik Verbruggen2012-12-111-6/+2
| | | | | | | | | | 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>
* Implement Object.create/defineProperty/definePropertiesLars Knoll2012-12-081-1/+1
| | | | | Change-Id: I3a71597d012b5fb7d7a2f482f4a16431c71c1c22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix typeof to work with undefined referencesLars Knoll2012-12-081-30/+5
| | | | | Change-Id: I90cd2b34a25476dfee1ec01315275b6c179d11dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the ActivationObjectLars Knoll2012-12-051-1/+0
| | | | | | | | Also implement __qmljs_xxx_activation_property in a more correct way. Change-Id: I60c330bccca21fad99930987ed78153114a80c7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix qmljs_call_propertyLars Knoll2012-12-021-1/+1
| | | | | Change-Id: Ic32fc8815704ed201a3b50eae05ff2705372210d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Set the name of a function in more (most?) cases.Erik Verbruggen2012-11-291-1/+1
| | | | | Change-Id: I1c2b9d61b6d97e3c2a8cb976fb6be8b68d51ae28 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Correctly instantiate variables in the local scopeLars Knoll2012-11-271-0/+1
| | | | | | | | This fixes cases where eval() would create variables in the wrong scope. Change-Id: Ie93ec2d1fb125e588c1b6ffa2ca8ca4b6e3112c9 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix some issues with the delete operatorLars Knoll2012-11-251-2/+1
| | | | | | | | Properly implement delete operator for identifiers and local variables. Change-Id: I8ac55edc80c31a94d11444c9f5c78caf4b131c95 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Support for the with statementLars Knoll2012-11-251-0/+2
| | | | | | | | | | | | Add the with object (list) to the environment, and check properties there if it's available. Generate IR statements implementing with() support. Add two new builtin methods to enter and leave a with scope. Implement support for the builtin's in masm. Make sure exception handling works across with scopes. Change-Id: I8257a16cfccc91a1acedfd740ade711b016b33fd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* return results directly instead of using the contextLars Knoll2012-11-201-1/+1
| | | | | | | | | 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>
* Properly namespace the math headerLars Knoll2012-11-191-8/+1
| | | | | Change-Id: I0f4ac76376028081b13b1cdeaadc4c9b09c1556d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value into it's own header/cpp fileLars Knoll2012-11-191-309/+2
| | | | | Change-Id: I2872d824a2016a653e64f0332f6416f416eef0e7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the engine and context classes into their own filesLars Knoll2012-11-191-41/+0
| | | | | Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Context to ExecutionContextLars Knoll2012-11-191-206/+206
| | | | | | | | | 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>
* Fix for calling Error constructor as a function (15.11.1).Erik Verbruggen2012-11-151-0/+1
| | | | | Change-Id: I989c2a546b7e4d9a4fd2f7ff8b682c747d38332f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup Context initializationLars Knoll2012-11-151-2/+2
| | | | | | | | 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>
* Smaller cleanups in the Context classLars Knoll2012-11-151-19/+8
| | | | | Change-Id: I02bc1cad6231988fdf453d0b4fdde55dd1ae9148 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Store the activation object as a pointer, not as a Value.Lars Knoll2012-11-151-1/+1
| | | | | | | | | The activation object inside the context is always an object, or null. This avoids some needless conversions to and from Value's. Change-Id: Ibbd88c83fa073a4ed3cf03742129357dd9567cec Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused variable and methodLars Knoll2012-11-151-1/+0
| | | | | Change-Id: I357f3062f58e76c1749c9818426be5c0eedf3327 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed the LLVM backend to also support the LLVM JIT.Erik Verbruggen2012-11-121-0/+6
| | | | | | | This is useful for quick LLVM codegen testing. Change-Id: I45778371375b903e154222c47b15411d08085ae5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Smaller 64 bit optimisationLars Knoll2012-11-121-0/+11
| | | | | Change-Id: I78311310c6f986bf187e3923d1fb71e09f4569fb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Allow Const's as operands to BinopLars Knoll2012-11-121-6/+9
| | | | | | | | | | | This allows us to use expressions such as %x = %y + const in the IR. This still requires an implementation for moth. Change-Id: I134e96ddad08bcbe4f3ea5fa27c5338a96acac80 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* These methods are actually used now.Lars Knoll2012-11-121-1/+0
| | | | | Change-Id: Ic0d43902fec5d3b752678eadfbccb9f71e21d895 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Correct implementation of inplace binopsLars Knoll2012-11-111-0/+1
| | | | | | | | Fix the last parts of the inplace bitops to do the correct thing. Change-Id: I748dde919082193c034cdc20e92cc568d8efa225 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Improve handling of binops on LHS expressionsLars Knoll2012-11-111-0/+2
| | | | | | | | | | Add a generic method to handle binops such as += to Object and use it. We can probably remove most of the __qmljs_inplace_xxx methods later on and call one generic method instead. Change-Id: If7cbd2e3012ad381e29b9eec2059e17f02a0a38a Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Change ConvertibleToInt to not interfere with valid addresses.Erik Verbruggen2012-11-081-1/+1
| | | | | Change-Id: I1415907f94d064e64bf5495b7c136355ffd866fe Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fixed compilation of LLVM glue-code.Erik Verbruggen2012-11-081-5/+3
| | | | | Change-Id: I3adc68012f7492281fe8849f58764473dcb3671e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix free memory readsLars Knoll2012-11-071-1/+1
| | | | | | | | | This doesn't quite fix all issues, as activation records and arguments objects will still not work correctly in all cases (esp. the inplace operators). Change-Id: I0ebf2a08e6c61e4049d4b6f449987757bfc3f81c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add tracing for runtime methods.Erik Verbruggen2012-11-071-0/+76
| | | | | Change-Id: I540297e83e3e297d0724c3e08e5780eee0d2fac8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix === operatorLars Knoll2012-11-011-0/+2
| | | | | | | | Correctly handle the case where one of the two arguments is a double and the other an integer. Change-Id: I589ac46acc30180b025c7e377c0523cf0889f294 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement initial support for the delete operatorLars Knoll2012-10-311-1/+0
| | | | | | | And don't dump the assemply unless SHOW_CODE is set. Change-Id: I17ad36f002404b57c65f910048e5c82d42307976 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a Value::sameValue() methodLars Knoll2012-10-311-13/+24
| | | | | | | | This implements Section 9.11 of the spec. Also simplify __qmljs_strict_equal(). Change-Id: I99b33308c33f4d4732b4a72bd5327336b2b22257 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework propertiesLars Knoll2012-10-311-9/+1
| | | | | | | | | | | This brings the basic structure or accessing properties more in line with the EcmaScript 5.1 specification. There's however still quite some work to be done to make things fully compliant. Change-Id: If55afd7ae6e4f7aa5ce06afe49b1453b537ac98b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Added basic support for 'for (var x in y)' statementLars Knoll2012-10-311-0/+4
| | | | | Change-Id: I8f3c8add78bebf92e0073348d1ecbdf3f328af6d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Moved definition of Value before the extern block to suppress warnings.Erik Verbruggen2012-10-251-164/+161
| | | | | Change-Id: Ic400255d0a7f6830dcb0604688d88d5020628b15 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove all is*Object methods.Erik Verbruggen2012-10-251-12/+0
| | | | | | | | | | They differ from the isObject/isUndefined/etc. methods because they do an extra virtual function call. And with isObject and friends being cheap, is*Object methods could have made the same (but faulty) impression. Change-Id: I32f26a96e73251bd14f8198b0a1ffb5d59e53f31 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Removed duplicate code for the various function call methods.Erik Verbruggen2012-10-251-1/+0
| | | | | | | | | | The main change is renaming __qmljs_call_function to callFunction, and move duplicate error checking in there. Now __qmljs_call_value does not do its own call anymore, but calls __qmljs_call_function. All calls to __qmljs_call_function are replaced by calls to __qmljs_call_value. Change-Id: I7fffc2e811c43e84e7344d70e2ed521331ed710d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Proper exception handlingLars Knoll2012-10-241-6/+8
| | | | | | | | | | | Implement exceptions using setjmp/longjmp. The advantage is that this removes all exception handling overhead from regular code, the only code that still has a (very small) overhead is the try{} catch() {} statement. Change-Id: I43d6a60dfc9dfd4b7a20d2e99ab0a9315b4d8a2f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build on ia32Simon Hausmann2012-10-201-2/+2
| | | | | | | Fix undefinedValue() and nullValue() initializers. Change-Id: I7117331137c7d76b39099b57a5dc17b15136fd26 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement regexp supportLars Knoll2012-10-201-0/+3
| | | | | Change-Id: I86c9bbe69c9ba4ae9d300b62e7d16b372f3478ea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make Value a real PODLars Knoll2012-10-191-144/+52
| | | | | | | | | | | | | | | Remove the inheritance from ValueData and ValueBase. Use a few ifdef's for 64 bit instead of a lot of template magic and inheritance to get the correct implementations for 32 and 64 bit. Saves some code, and makes Value a real POD type. Apparently this also helps gcc generate better code, crypto.js runs another few percent faster now. Change-Id: I9dac488b27e629e6ef8c096f2bee86a5d678fd49 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use some tricks to speed up binary operatorsLars Knoll2012-10-191-71/+119
| | | | | | | | | | Add some flags to the Value's tag that allow us to simplify type conversion from null and bool to integer. Add a method to allow checking in one go whether two values are "integer compatible" Change-Id: I0a05bdf881836ad3f8286c0365dd192bf7f6e5d6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the is(Type) methods in ValueLars Knoll2012-10-191-23/+19
| | | | | | | | Simplify and optimise the Value::isXxx() methods at the same time. Change-Id: I3e8fa98cf7b91079a4450c048c6d0795d1684724 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimise function calls a little.Lars Knoll2012-10-181-0/+1
| | | | | Change-Id: I906a4f27bf47ae0ae088ae40a747b28ba827e10a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>