aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CleanupsLars Knoll2015-01-231-3/+3
| | | | | | | | Remove duplicated methods. Remove some mostly unused methods, and simplify some others. Change-Id: I605b249e54417bb32c3dfc8e22f2c8b6b684a1e1 Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-1/+1
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <[email protected]>
* Move the internalClass pointer into Heap::ObjectLars Knoll2015-01-211-3/+3
| | | | | | | | The other classes that derive from Heap::Base don't need it at all. So get rid of it there and save a pointer. Change-Id: I9c5df2e43cd6eeac2e6e41f3d3b8077d3afbc8f2 Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of all uses of Managed::engine()Lars Knoll2015-01-211-4/+4
| | | | | Change-Id: I596f14554d81f5e9af9996294d96047f2e810bef Reviewed-by: Simon Hausmann <[email protected]>
* Remove all the setVTable() calls that aren't required anymoreLars Knoll2015-01-211-6/+0
| | | | | | | | The memory manager's allocation methods now set this up correctly for us :) Change-Id: I8492bf732df601f95a1a851fb3804127ffc83935 Reviewed-by: Simon Hausmann <[email protected]>
* Remove the remaining bit of code that use the vtable in the internalClassLars Knoll2015-01-211-2/+2
| | | | | Change-Id: Ia52f0e6db325aab37477d455f163487b319dce29 Reviewed-by: Simon Hausmann <[email protected]>
* Move vtable out of internalClassLars Knoll2015-01-201-2/+6
| | | | | | | | | | | | | | | | We can move the internalClass to Object later on, and such save having the internalClass on lots of Heap objects. This commit basically adds and starts making use of a new vtable pointer in Heap::Base. In addition, the construction methods in the memory manager now automatically setup the correct vtable. Removing the vtable code from InternalClass and moving it into Object will come in a separate commit Change-Id: If49e8d73c769bf65bf47fe4dbf8b9546c8019dbc Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of subtype usage in Function objectsLars Knoll2015-01-121-1/+5
| | | | | | Change-Id: Ic84ddab292cb69e79dac0f2b8a87b96b096360d8 Reviewed-by: Robin Burchell <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of hasAccessorProperty in Heap::BaseLars Knoll2015-01-121-1/+1
| | | | | | | | | This shouldn't affect performance as we can just as well check for cases where we need to take the slow path differently. Change-Id: I4b9f69c39e9e64b437820ca3a6ea43e8877f2cf3 Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of the needsActivation flag in Heap::BaseLars Knoll2015-01-121-4/+0
| | | | | | Change-Id: Idcec374cb6d16aabf919c23d7236b76d9d047527 Reviewed-by: Robin Burchell <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of the bindingKeyFlagLars Knoll2015-01-121-0/+6
| | | | | | | | | Instead use the vtable to identify that we have a binding function. Change-Id: I794aebb6fb83f648ba36f2f15cad94d2af3cae91 Reviewed-by: Robin Burchell <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Start cleaning up flags in Heap::BaseLars Knoll2015-01-121-2/+0
| | | | | | | | | The goal is to get rid of the flags here and reduce the size of each GC'ed object with a pointer. Change-Id: I8c876810037756b85a646348cc5992a688588ea5 Reviewed-by: Robin Burchell <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Use QV4::ScopedObject typedef instead of actual typeOleg Shparber2015-01-031-2/+2
| | | | | Change-Id: I0b68c534ea513a7c230b12114f6b42b069f9864b Reviewed-by: Simon Hausmann <[email protected]>
* Use QV4::ScopedFunctionObject typedef instead of actual typeOleg Shparber2015-01-021-1/+1
| | | | | Change-Id: I6b4effaa5bef992b4ae9402eea7fe655bc7b18f0 Reviewed-by: Simon Hausmann <[email protected]>
* Make Managed inherit ValueLars Knoll2014-12-201-2/+4
| | | | | | | | This completes the first milestone towards being able to move objects across the GC heap. Change-Id: I8e6ce90254ea767188a31f0dc85b133534c87eb0 Reviewed-by: Simon Hausmann <[email protected]>
* Make Property uses GC safeLars Knoll2014-12-201-4/+6
| | | | | Change-Id: I5aa41a07a2d25e5c8a2d64bfa58a55fcd7aaf77e Reviewed-by: Simon Hausmann <[email protected]>
* Use Scoped values a bit more consistentlyLars Knoll2014-12-201-18/+17
| | | | | | | | Mainly cleanups, but also one or two potential places that could lead to issues with a moving GC. Change-Id: Ia388420052cd1a642120773f582bf21965830613 Reviewed-by: Simon Hausmann <[email protected]>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-6/+6
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <[email protected]>
* Return Heap::ExecutionContext for globalContext()Lars Knoll2014-12-191-3/+5
| | | | | Change-Id: Ide7c81735be4662ff45bf268cfe750ff1f784453 Reviewed-by: Simon Hausmann <[email protected]>
* Return Heap::ExecutionContext for currentContext()Lars Knoll2014-12-191-16/+13
| | | | | Change-Id: I155ab996e24d7f36761d2ea62a04774e16469b34 Reviewed-by: Simon Hausmann <[email protected]>
* Cleanup code that modifies the JS stackLars Knoll2014-12-191-2/+2
| | | | | Change-Id: Ic043e256c3df984bb06c9a16b86573b0173b19a1 Reviewed-by: Simon Hausmann <[email protected]>
* Make ExecutionContextSaver GC safeLars Knoll2014-12-191-6/+8
| | | | | Change-Id: I29f00366d24c770afe4ba4579106d81a8c9043df Reviewed-by: Simon Hausmann <[email protected]>
* Add default parameter value for ScopedCallData()Oleg Shparber2014-12-121-1/+1
| | | | | Change-Id: I16b6662a47c682e145d3e2201f9e90f58405a599 Reviewed-by: Simon Hausmann <[email protected]>
* Move prototype back from the vtable into ObjectLars Knoll2014-12-111-25/+22
| | | | | | | | This is the only way we can support a GC that moves objects around in memory. Change-Id: I1d168fae4aa9f575b730e469e762bc5b5549b886 Reviewed-by: Simon Hausmann <[email protected]>
* Encapsulate accesses to the root contextLars Knoll2014-12-111-3/+3
| | | | | Change-Id: I668cef1363a5c1a5c5b9a7e138f3bd0338712eea Reviewed-by: Simon Hausmann <[email protected]>
* Fix Object::arrayData() accessor to return a heap objectLars Knoll2014-12-111-2/+2
| | | | | Change-Id: Iffc82c2f415251d73bb7446848399b54b16589c9 Reviewed-by: Simon Hausmann <[email protected]>
* Remove two reinterpret_casts in ObjectLars Knoll2014-11-221-3/+3
| | | | | Change-Id: I921cd8129acb47cffd58be9551a6925c4f296d41 Reviewed-by: Simon Hausmann <[email protected]>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-2/+12
| | | | | | | | | | | | | | | | | Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <[email protected]>
* Remove ExecutionContext from the Runtime codegeneratorLars Knoll2014-11-151-1/+1
| | | | | Change-Id: Ic62ae1cbd24c0089e0df6bc6758d262cf49d0b91 Reviewed-by: Simon Hausmann <[email protected]>
* Changed MemoryManager::alloc<T> to return Heap::T* instead of T*Simon Hausmann2014-11-151-2/+2
| | | | | Change-Id: Iede1ba624d1313fbe2f8e5e979e936f1f32efdc9 Reviewed-by: Lars Knoll <[email protected]>
* Replaced more usages of Returned<T> with Heap::T*Simon Hausmann2014-11-141-3/+3
| | | | | Change-Id: I451128ee71610bfeb71139c28da89a00a8209ec6 Reviewed-by: Lars Knoll <[email protected]>
* Ported ExecutionEngine::newString and newIdentifier to Heap::StringSimon Hausmann2014-11-121-2/+2
| | | | | | | | | | Avoid the use of Returned<String> for newString and changed the identifier table to use Heap::String. This required moving some code back into Heap::String, but that's code that doesn't call back into the GC, so allocations and therefore future object moves aren't possible. Change-Id: I1dca3e9c12a9c56f09419af8cc8cba39fe04f720 Reviewed-by: Lars Knoll <[email protected]>
* Ported most ExecutionEnginew::new* factory methods away from Returned<T>Simon Hausmann2014-11-121-1/+1
| | | | | | | | We don't need Returned<T> anymore with the QV4:: vs. Heap:: separation. Eliminating Returned<T> simplifies also some code. Change-Id: Ic2a9cd3c1a94f2ea37b539d3984d63997121c2b9 Reviewed-by: Lars Knoll <[email protected]>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-4/+4
| | | | | | | | | This makes a lot more sense in the long term and is the more maintainable solution, once the GC starts moving objects around in memory Change-Id: I8f327c0f5b5b0af38c5fe1a217852ee8c4a5c2fc Reviewed-by: Simon Hausmann <[email protected]>
* CleanupsLars Knoll2014-11-121-0/+10
| | | | | | | Remove a few reinterpret_cast's Change-Id: I800b8c41123eaa22cf879571c747b4de0375e8cb Reviewed-by: Simon Hausmann <[email protected]>
* Store all data members in FunctionObject as heap dataLars Knoll2014-11-121-19/+30
| | | | | Change-Id: Ic061baaf7f5ff08c5e6e7130abd6a650148d3d2d Reviewed-by: Simon Hausmann <[email protected]>
* Convert ExecutionContext::parent/outer to use a heap objectLars Knoll2014-11-121-2/+2
| | | | | Change-Id: I1b8ee831cfcdd5b1904ce24a341f5a796dce41cf Reviewed-by: Simon Hausmann <[email protected]>
* Use Heap object for CallData::function memberLars Knoll2014-11-111-2/+2
| | | | | Change-Id: I5cae1b16c68751da9481a1cdae2601efa2a500a2 Reviewed-by: Simon Hausmann <[email protected]>
* Move Data of FunctionObject and related classes into HeapLars Knoll2014-11-081-28/+29
| | | | | Change-Id: Iadf74f953798c1884e0ec704ccb7c70d971e3273 Reviewed-by: Simon Hausmann <[email protected]>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-4/+4
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 Reviewed-by: Simon Hausmann <[email protected]>
* Begin moving the data out of Managed objectsLars Knoll2014-11-081-3/+3
| | | | | | | | | | | We need to move the Data objects out of the Managed objects, to avoid lots of trouble because inner classes can't be forward declared in C++. Instead move them all into a Heap namespace. Change-Id: I736af60702b68a1759f4643aa16d64108693dea2 Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of Members and directly store MemberData::Data pointersLars Knoll2014-11-071-22/+35
| | | | | | | And do the same change for ArrayData. Change-Id: Ia1ae56bd0ff586c9b987e15af7a53f395a37054a Reviewed-by: Simon Hausmann <[email protected]>
* Let markObjects() operate directly on HeapObjectsLars Knoll2014-11-041-9/+9
| | | | | | | | | This decouples things a bit better and helps moving over to directly store heapobject pointers in other objects. Change-Id: I798f922e018b0a3ca6f8768e4a810187f34d82f6 Reviewed-by: Simon Hausmann <[email protected]>
* Move the throw methods from ExecutionContext to ExecutionEngineLars Knoll2014-11-041-9/+9
| | | | | | | | The methods don't require a context, and thus shouldn't be implemented there. Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3 Reviewed-by: Simon Hausmann <[email protected]>
* Cleanup header file dependenciesLars Knoll2014-11-041-4/+0
| | | | | Change-Id: Ibb4658576a98b53de2eac2474ce4d5b9eb83b6ae Reviewed-by: Simon Hausmann <[email protected]>
* Remove some unneeded reinterpret_cast'sLars Knoll2014-11-041-2/+2
| | | | | Change-Id: I29ebc1f06bb3f0d20e6e21840c7fe326a0f4546d Reviewed-by: Simon Hausmann <[email protected]>
* Changed Value to store Managed::Data pointers directlySimon Hausmann2014-11-041-3/+3
| | | | | | | | This is a step towards storing direct heap object pointers for the values on the JS stack, to avoid the costly indirection for data access. Change-Id: Ibb57ed6cf52a7088bbc95ee04ae3a4cb25b8c045 Reviewed-by: Simon Hausmann <[email protected]>
* Don't check the this pointer for 0 in member functionsLars Knoll2014-10-271-1/+3
| | | | | | | | | | | | This actually violates the C++ standard that defines that you aren't allowed to call member functions on an invalid object. Instead insert the 0 pointer checks on the caller side where required. Change-Id: I8be3c3831594bb6482e9ef6de6e590ec437ac0f8 Reviewed-by: Simon Hausmann <[email protected]>
* Rework our simple array implementationLars Knoll2014-10-271-3/+3
| | | | | | | | | | | Implement the simple array as a circular buffer instead of an array with head room. This fixes a couple of severe issues with performance and memory management if the array is being used as a queue. Task-number: QTBUG-41421 Change-Id: I146ad8a874407c108aa8fe1eae68e9957e154847 Reviewed-by: Simon Hausmann <[email protected]>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | In the QQmlScriptString we store the binding id and it is an index into the runtimeFunctions array of the compilation unit. However we don't store the compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve it from the cache via the context url (we have the context after all). That turns out to be not a reliable way, as sometimes the URL might slightly differ from the originally compiled cache (qrc:/// turning to qrc:/ maybe). Consequently the type is (unnecessarily) compiled again and unfortunately not _linked_, therefore the runtime functions array is empty. Another option is that when the component was created from a QByteArray, then no entry exists in the cache in the first place. This patch addresses the problem by storing a reference to the compilation unit in the QQmlContextData. That we can safely retrieve and it'll make sure the compilation unit also stays alive. In the process of that the manual reference counting was switched over to QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit. Task-number: QTBUG-41193 Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7 Reviewed-by: Lars Knoll <[email protected]>