aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Convert remaining FunctionObject's to new constructor schemeLars Knoll2014-07-221-44/+4
| | | | | Change-Id: I440d5b128d0ee28566ebfa82c2505a4bd97bba6b Reviewed-by: Simon Hausmann <[email protected]>
* Convert FunctionObject derived classes to new construction schemeLars Knoll2014-07-221-59/+36
| | | | | Change-Id: I0d43a79ed531a9d651bd00866d73113c05d95a09 Reviewed-by: Simon Hausmann <[email protected]>
* Convert regexpsLars Knoll2014-07-221-1/+2
| | | | | Change-Id: I5b62a265a7ce363a16b1e14ae93cadbb1ab0cb5b Reviewed-by: Simon Hausmann <[email protected]>
* Convert delegate model and indexed builtin functionLars Knoll2014-07-221-3/+41
| | | | | Change-Id: Ic7d50aa472d6a1bafadb6641f88b5f89a9b893ad Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of all uses of ObjectRefLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788 Reviewed-by: Simon Hausmann <[email protected]>
* Remove the less often used Ref classesLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I9ee531c903317a0f324671d98af1f967b684915c Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of StringRefLars Knoll2014-07-221-6/+6
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <[email protected]>
* Convert ExecutionContext to new storage schemeLars Knoll2014-07-221-54/+54
| | | | | Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <[email protected]>
* Move MemberData over to new storage layoutLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I971b614d471e49d1be2e9474c985cb93ed7e2117 Reviewed-by: Simon Hausmann <[email protected]>
* Rename Managed::managedData() to d() to be consistentLars Knoll2014-07-221-8/+8
| | | | | | | | No need to differentiate in the name anymore, as the data structures all inherit from each other now. Change-Id: Ia41f50ce4e521f9626d874311ceb57e0e194888b Reviewed-by: Simon Hausmann <[email protected]>
* Convert FunctionObject to new storage schemeLars Knoll2014-07-221-16/+16
| | | | | Change-Id: Ida213b4684c4d7c4c64e75999cbc87987d9894c8 Reviewed-by: Simon Hausmann <[email protected]>
* Move ArrayData over to new data layoutLars Knoll2014-07-221-1/+1
| | | | | Change-Id: Ic51f37bea030b196f0fa35ab21e618447edaa25d Reviewed-by: Simon Hausmann <[email protected]>
* Convert the remaining classes in functionobject.hLars Knoll2014-07-221-18/+19
| | | | | Change-Id: I7dbc56ca3952772b99681f95f50129204f9d6c7c Reviewed-by: Simon Hausmann <[email protected]>
* Move data of FunctionObject into an inner structLars Knoll2014-07-221-38/+41
| | | | | Change-Id: Ic00b1761565f9f8881b665a3fecca723239e2279 Reviewed-by: Simon Hausmann <[email protected]>
* Move object data into internal structureLars Knoll2014-07-221-6/+6
| | | | | Change-Id: I1fcccd535ed356e736468337bd450270cd290044 Reviewed-by: Simon Hausmann <[email protected]>
* Move Managed data into it's own subclassLars Knoll2014-07-221-26/+26
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <[email protected]>
* Get rid of different macros for vtable specializationsLars Knoll2014-07-221-6/+6
| | | | | | | Detect existence of a a vtable entry at compile time. Change-Id: Ieed5d34b063184bc4435b22c6685ac0e3fabf493 Reviewed-by: Simon Hausmann <[email protected]>
* Use Members for storing the bound arguments in BoundFunctionLars Knoll2014-07-221-8/+12
| | | | | | | | Cleans up the code, and allows us to remove the destructor for bound function objects. Change-Id: Id32ac69171f7975ec7679d07d25c0eb6b4ca6fb5 Reviewed-by: Simon Hausmann <[email protected]>
* Avoid calling destroy() on most objectsLars Knoll2014-07-221-6/+6
| | | | | | | | | The method is now optional, and we can simply avoid calling it if all members an object has are themselves garbage collected. Change-Id: If560fce051908bcc10409ead1a7d8a5bd5fa71d2 Reviewed-by: Simon Hausmann <[email protected]>
* v4: Remove dead code ScriptFunction constructorHolger Hans Peter Freyther2014-07-201-6/+1
| | | | | | | | | Creating a Scope/ScopedValue will immediately access ExecutionEngine of the ExecutionContext so the null check is not needed here. Move the v4 variable into the scope that is using it. Change-Id: I9189ee9d1a63997119e49c12182dffefadc916f1 Reviewed-by: Simon Hausmann <[email protected]>
* Fix failing assertion inside MSVC STL in debug buildsSimon Hausmann2014-05-211-2/+2
| | | | | | | | | | | | | | | When using FunctionObject's call() method, we use std::copy to copy the arguments over to the new call context. Unfortunately std::copy has an assertion in there to check that we're not copying out of bounds. What the STL doesn't know is that the Value args[1] array is dynamically allocated and easily expands beyond just one entry. Fall back to copying by hand to work around this issue. Task-number: QTBUG-38195 Change-Id: I6e254b1c893ccf5cad2358179cda1b07b00228e0 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Garbage collect member dataLars Knoll2014-04-041-1/+2
| | | | | | | | Move the allocated member data into the garbage collected area, so that we can avoid using malloc/free for it. Change-Id: I20625efa67ecd60238568742b74854b0c8cb2e3e Reviewed-by: Simon Hausmann <[email protected]>
* Fix typoSimon Hausmann2014-04-011-2/+2
| | | | | | | creatScriptFunction -> createScriptFunction Change-Id: Icdb9214b1ae067fa2b8693d50cdac0be9fe6d390 Reviewed-by: Michael Brasser <[email protected]>
* Optimize construct callsLars Knoll2014-03-271-1/+1
| | | | | | | | Optimize construction of the internalClass for the object being constructed. Change-Id: Id5fc02c291664ec01c3595ae0acbb6895cc5b147 Reviewed-by: Simon Hausmann <[email protected]>
* Fix CompiledData::CompilationUnit object leakLiang Jian2014-03-131-5/+0
| | | | | | | | Don't ref CompiledData::CompilationUnit in constructor of ScriptFunction since its has been referenced in its base class Change-Id: I9ad2d6e190c2ac11de4ccd63015c81d2dead3971 Reviewed-by: Simon Hausmann <[email protected]>
* Fix copying of Property'sLars Knoll2014-03-101-3/+3
| | | | | | | | | | Data properties don't contain valid data in the set field if they are being stored in Objects. Thus we should never access that field unless we are dealing with accessor properties. Change-Id: I19dcbaee7ebd042ae24387f92a93571d75ca578a Reviewed-by: Simon Hausmann <[email protected]>
* Use an array of Value's for Object::memberDataLars Knoll2014-03-071-5/+4
| | | | | | | | | | This cuts the memory required to store properties in an object in half for the common case. Accessor properties require two slots inside memberData, but data properties only one. Change-Id: I0bab1b88ca9ed5930abf065c77c89985b9ed5320 Reviewed-by: Simon Hausmann <[email protected]>
* Better way of retrieving the prototype property for FunctionObjectsLars Knoll2014-03-071-53/+22
| | | | | | | | | Make sure FunctionObjects always have the prototype property at index 0. This way we can speed up the instanceOf operator even more, and at the same time save 16-28 bytes of memory per FunctionObject. Change-Id: I8527bc8f9dc7b04a9db8395b5f05bab47ddc21ce Reviewed-by: Simon Hausmann <[email protected]>
* Remove the name member of FunctionObjectLars Knoll2014-03-071-9/+19
| | | | | | | | The data is anyway stored in the name property of the FunctionObject, and is not performance critical. Change-Id: If1784b0ec6f368bc474c246bb9c2c50d5e56b689 Reviewed-by: Simon Hausmann <[email protected]>
* Reduce memory consumption of FunctionObjectLars Knoll2014-03-071-21/+6
| | | | | | | | | Remove varCount and formalParameterCount members in FunctionObject and retrieve them from the CompiledFunction instead. Change-Id: I8a6cdc6d354b0f33da9d67a4c3dbfe8a7cc96176 Reviewed-by: Simon Hausmann <[email protected]>
* Remove nArguments and name from QV4::FunctionLars Knoll2014-03-031-8/+6
| | | | | | | | Saves 12 bytes per Function Change-Id: I9a495805f9201eb6162a520ff5c2defeb73dc37a Reviewed-by: Simon Hausmann <[email protected]> Reviewed-by: Michael Brasser <[email protected]>
* Improve memory usage in QML/V4 engine.Michael Brasser2014-02-281-4/+4
| | | | | | | | | | | | | | * Don't create prototype Object for bindings and signal handlers. It is inaccessible and not required. This saves one Object-sized allocation per binding. * Shrink the size of QQmlContextWrapper by removing the v8 member variable. * Shrink the size of QObjectWrapper by moving the destroy identifier to the engine. Change-Id: I76e84e4c0581e97a19d2e959f814ac84d9c431fa Task-number: QTBUG-37134 Reviewed-by: Simon Hausmann <[email protected]>
* Clean up our internal namespacesLars Knoll2014-02-231-2/+2
| | | | | | | | QQmlJS::MASM -> QV4::JIT QQmlJS::V4IR -> QV4::IR Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-181-7/+12
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4functionobject.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
| * Fix spurious binding loop errors in QtQuick Controls and other placesSimon Hausmann2014-02-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 5dc7649f5ad7dca6e13707e827d001c3f118a6ef caused this regression, as a result of lazy binding evaluation and self-referencing objects: import QtQml 2.0 QtObject { property QtObject objectRef : subObject property QtObject blah: QtObject { id: subObject property int value: 42 property int blah: objectRef.value } } When blah is evaluated, we now lazily initialize objectRef - as opposed to previously throwing an exception and then when objectRef gets initialized we re-evaluate blah due to its dependency. So while evaluating "objectRef.value" for blah, we initialize objectRef by evaluating "subObject", and after doing that we write the "objectRef" property. That triggers a change notification, and since the objectRef reference for blah is a compile-time known dependency, the change notification triggers a re-evaluation of "blah", which is the binding loop. What's wrong here is that we register the pre-defined captures before the code execution, when we should register them after the evaluation, or strictly speaking after flushing pending bindings, like it is the case for individual properties in bindings where we could not pre-determine the depenencies. Change-Id: I9fb0c7583cba9d9b71c9ada2791fe87574f6ef44 Reviewed-by: Lars Knoll <[email protected]>
* | Satellite profiler for V4Ulf Hermann2014-02-121-4/+5
| | | | | | | | | | | | | | | | Self-contained profiler for V4. By itself it doesn't have any connections to qqmlprofilerservice. Change-Id: I471a6119e07eab9c5f4712a16835be49c8886d1a Reviewed-by: Kai Koehne <[email protected]>
* | CleanupsLars Knoll2014-01-311-7/+7
| | | | | | | | | | | | | | | | | | | | Remove SafeValue, it was used to port over to an exact GC. Since we now have that, we can now safely merge it with QV4::Value again. Also rename SafeString to StringValue for better naming consistency. Change-Id: I8553d1bec5134c53996f6b0d758738a0ec8a2e4d Reviewed-by: Simon Hausmann <[email protected]>
* | Split ManagedVTable into two classesLars Knoll2014-01-211-13/+13
| | | | | | | | | | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <[email protected]>
* | Save memory on array dataLars Knoll2014-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Store a simple vector of Values in the array data, instead of a Vector of Property's. This halfes the memory consumption on 64bit and simplifies our code. If an indexed property gets converted to an accessor property, we simply convert the ArrayData into a SparseArrayData. Add support in SparseArrayData to allocate double slots (two Value's) to hold a full Property in case someone sets an accessor on an indexed property. Some methods still return a Property*, but this is safe, as only the first Value in the Property pointer will ever get accessed if the Property doesn't contain an accessor. Change-Id: Ic9b0f309b09a2772a328d947a10faaf3be9fe56f Reviewed-by: Simon Hausmann <[email protected]>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-171-3/+0
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
| * Fix failing context->next != 0x1 assertionSimon Hausmann2014-01-161-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit bf173fe5da381c88343296ca33ef6b06389c6d20 context objects are always on the GC heap and no more in that special linked list or stack allocated, so the next pointer became dangling/uninitialized and asserting on it was bound to fail randomly. Since we no more allocate contexts on the stack, we can safely remove the assertion. Task-number: QTBUG-35917 Change-Id: I104bd129c6c32f46a6302052f563abdf926cb879 Reviewed-by: Albert Astals Cid <[email protected]> Reviewed-by: Jan Arve Sæther <[email protected]>
* | Cleanup: change signature of Object::insertMember()Lars Knoll2014-01-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Methods returning a Property pointer have to be removed, so that we can move over to store member data requiring only one value for the common case of data properties. This will in the long term reduce memory consumption on 64 bit systems quite a bit. Change-Id: I78de3794ec7b3bc5db13aa57275d3f08fa9d470a Reviewed-by: Simon Hausmann <[email protected]>
* | Rework array handling for JS objectsLars Knoll2014-01-091-4/+4
| | | | | | | | | | | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <[email protected]>
* | Move array data into it's own structLars Knoll2014-01-031-2/+2
| | | | | | | | | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <[email protected]>
* | Move Managed::type and some flags into the vtableLars Knoll2014-01-031-2/+0
|/ | | | | | | | | | | | | Move the type flag into the vtable to free up these bits in the Managed class, and not have to set them at object construction time. As we often need to know whether a Managed object is a Object, FunctionObject or String, add some bitflags to test for these to the vtable. Change-Id: I7d08ca044544debb307b55f124f34cb086ad9e84 Reviewed-by: Simon Hausmann <[email protected]>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-23/+23
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <[email protected]>
* Remove setVTable calls in performance critical areasLars Knoll2013-12-041-16/+28
| | | | | | | | | | Remove all the calls to setVTable that were in performance critical parts of the code. This now brings performance back to the level we had with the vtable inlined in the Managed objects. Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424 Reviewed-by: Simon Hausmann <[email protected]>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-16/+11
| | | | | | | | This saves one pointer per object, and willmake other optimizations easier in the future. Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe Reviewed-by: Simon Hausmann <[email protected]>
* Use an internalClass to represent formals and locals in CallContextsLars Knoll2013-12-041-18/+8
| | | | | | | | | | formals and locals in a CallContext where so far accessed through a linear search in ExecutionContext::getProperty. Fix this by introducing an internalClass for the Function used by the call context. Change-Id: I1141efa12b19d6de4a354bfd6e769c5ffcb8898b Reviewed-by: Simon Hausmann <[email protected]>
* Remove unused inline wrapperLars Knoll2013-12-041-2/+2
| | | | | | | | | The wrapper method for Function::code() was still there from the times we used C++ exceptions. It's not needed any more, so get rid of it. Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84 Reviewed-by: Simon Hausmann <[email protected]>