aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
...
* | CleanupsLars Knoll2015-09-159-80/+79
| | | | | | | | | | | | | | | | | | | | | | There's only one place where we need to resize our member data, namely when we call setInternalClass() on an object. In addition, encapsulate the access to the memberdata better in preparation for inline property data later on. Change-Id: Ia34d0253d5d1792f1d7c4981556d78375fa7a755 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Further cleanupsLars Knoll2015-09-155-11/+11
| | | | | | | | | | | | | | Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Don't compute the QString whenever we need to know the v4 string lengthAleix Pol2015-09-151-1/+1
| | | | | | | | | | | | | | The length is already computed in the len attribute anyway. Change-Id: I1a406175edd9127b9b425eb21703e2184f5a3cd7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Fix typoLars Knoll2015-09-152-4/+4
| | | | | | | | | | Change-Id: I9bfc96096ec5e2c8bd4d3c5bad13fc78ae657962 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Rename currentExecutionContext to currentContextLars Knoll2015-09-1510-50/+50
| | | | | | | | | | | | | | | | Now that the other method is gone, let's use the shorter currentContext Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Cleanup usage of ExecutionEngine::currentContextLars Knoll2015-09-1516-127/+107
| | | | | | | | | | Change-Id: Ic79d6da162375928ec25871cd0341daeab6483d2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of Scope.sizeLars Knoll2015-09-151-57/+0
| | | | | | | | | | | | | | | | | | The value was only set in debug builds, but never checked against. As this can't work with how ExecutionContexts are now stacked, let's get rid of it. Change-Id: I20f26afd7872a4783d163f913dde01858c3df792 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Store the stack of executioncontext's on the JS stackLars Knoll2015-09-157-77/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This saves one pointer per allocated execution context. Now every execution context that is pushed, allocates two Values on the js stack. One contains the context itself, the other one the offset to the parent context. Things are a bit tricky for with and catch scopes, as those are called from the generated code, and can't open a Scope anymore. In addition, all methods iterating over the js stack frames need to work with ExecutionContext pointers, not ScopedContext's. Change-Id: I6f3013749d4e73d2fac37973b976ba6029686b82 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Reduce usage of context->parentLars Knoll2015-09-153-25/+26
| | | | | | | | | | Change-Id: I31bb8019783311a7e6065e2aac7fec67c1120ebf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Explicitly push/pop ExecutionContextsLars Knoll2015-09-156-6/+11
| | | | | | | | | | | | | | | | Avoid the implicit push inside the execution context constructor and rather make this explicit in the code. Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Cleanup the ExecutionContextSaverLars Knoll2015-09-156-30/+30
| | | | | | | | | | | | | | | | Always operate on the current context (as that's what we do in practice anyway). Change-Id: I4171207a7a86e69aa685754956c0764ac6e152a7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of the qmlContextObject methodLars Knoll2015-09-152-10/+6
| | | | | | | | | | Change-Id: Id8c0d9e15dd85b3818e283ab6769a49bb2e6d0f7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Smaller cleanupLars Knoll2015-09-092-0/+7
| | | | | | | | | | | | | | Move the takeContextOwnership method over to the QmlContext. Change-Id: I9330b31a0cb079b1c7e68a00236a69e25ed2c5af Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Pass a QmlContext to QV4::Script instead of a contextwrapperLars Knoll2015-09-094-26/+32
| | | | | | | | | | Change-Id: Ia8db166aacbbe6e8f588179dffa04e2dce9566cb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Pass the correct QML context as scope to the binding wrapperLars Knoll2015-09-081-9/+6
| | | | | | | | | | Change-Id: Ib98b9bea1e021fb99f7f82c211111988939515b0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Don't push new QML contexts onto the context stackLars Knoll2015-09-083-4/+6
| | | | | | | | | | | | | | | | | | | | When creating new QML contexts, these are not used directly, but rather as scopes for other functions. Change the behavior, so that newQmlContext doesn't push the new context onto the context stack. Change-Id: I8254da3f660c4791941835c925b9892274ea51b0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QV4Include doesn't need a contextdataLars Knoll2015-09-082-8/+4
| | | | | | | | | | Change-Id: I062483b4bca0dd4c1e41accdd3aef4f11f3446ba Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Refactor the way we declare signal parameter namesLars Knoll2015-09-086-22/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qml Connection objects where using an awkward way to make the parameter names of signals available to the signal handler. This now uses an approach that is equivalent to what we do with other functions. The main difference is that we can't know the parameter names at type compile time, so we have to rewrite the internal class of the QV4::Function at connect time. Change-Id: I5e538ac840b5a46ccb14ff71684404d947948324 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move createQmlCallableForFunction out of the binding wrapperLars Knoll2015-09-084-52/+49
| | | | | | | | | | | | | | | | | | It's now QV4::FunctionObject::createQmlFunction, which I believe is a better place and name for the method, esp. as it has no real connnection to the binding wrapper anymore. Change-Id: I59e20e120db72e53735b3a986e0b91bc7c3347d7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix regression in ObjectProto.getOwnPropertyDescriptorLars Knoll2015-09-081-4/+4
| | | | | | | | | | Change-Id: Ie2bcfd7212773c1a48041a24433c2f73613ead3e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Allocate QML defined properties without extra roomFrank Meerkoetter2015-09-052-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | QV4::MemberData is used to allocate storage for QML defined properties. QV4::MemberData::reallocate() is multiplying each allocation by two as a growth strategy. This is a waste of memory for QML defined properties. This commits extends the QV4::MemberData with an additional method to allow exactly sized allocations. Change-Id: I5c0a3a5a3852d39af9e1afb512380fb1400d2448 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | CleanupFrank Meerkoetter2015-09-031-2/+2
| | | | | | | | | | | | | | Remove unnecessarry casts + reorder for better readability Change-Id: Ib0c6032f9d6a8a552eeff1c42b921f2ad24e00f0 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Create less BindingWrappersLars Knoll2015-08-252-18/+2
| | | | | | | | | | | | | | | | Instead create QmlContext's directly as they are the only thing used from the binding wrapper. Change-Id: If3a987134dee9e85b6a76ed74aacd76b19279117 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | std::sort JS profiling data instead of insert-sorting itUlf Hermann2015-08-242-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | The original FunctionCall struct is much smaller than the resulting FunctionCallProperties, and thus not as expensive to copy. Repeatedly calling upper_bound on a QVector is not such a great idea, either. Since the usage of QVector instead of QList for the results is new in Qt 5.6, the insert-sorting got slower, making this change a fix for a performance regression. Change-Id: I7154d8cf129b7fbe6e02424fbe16442042a5c3c2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Make iteration over persistent values saferLars Knoll2015-08-242-10/+61
| | | | | | | | | | | | | | | | This makes it safe to destruct persistents while we are iterating over them. Change-Id: I8797d0c553d3201859cdf03fb25df28836e55691 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove unused pointer to the context wrapperLars Knoll2015-08-202-12/+0
| | | | | | | | | | | | | | THe binding wrapper doesn't use that pointer anymore. Change-Id: Ie04fff448b9647927219936a62c67ac0b4853eec Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the qmlSingletonWrapper method out of the contextwrapperLars Knoll2015-08-203-2/+23
| | | | | | | | | | | | | | One more step towards removing the class alltogether. Change-Id: Ic9f6794eb3c5c6605ee43ad23a6d432ebbf321a1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the registerQmlDependencies method into QQmlPropertyCaptureLars Knoll2015-08-201-5/+5
| | | | | | | | | | | | | | | | This is where the method logically belongs, and removes one more thing from the context wrapper. Change-Id: Ibc076c9b31903a484ad4517402eca2a3b7f0d660 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Use the QmlContext as the scope for QQmlV4Function callsLars Knoll2015-08-203-17/+8
| | | | | | | | | | | | | | | | This further reduces our dependency on the QQmlContextWrapper and reduces storage requirements in the QObjectMethod. Change-Id: I2c12d0a8818d81d45139f482caac8510ad8dfddc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4 debugger: Fix expression evaluationUlf Hermann2015-08-192-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | We need to collect the refs in the debugService's list in order for them to show up on addRefs() and we need to generate proper error responses if either the debugger is not stopped or the evaluation throws an exception. Task-number: QTBUG-47797 Task-number: QTBUG-47816 Change-Id: I98f17c1f3976859ee50b9bfac41091276ff60982 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix performance of ListModel::get()Simon Hausmann2015-08-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When called, the function would return a full-fledged QObject that maps the list element addressed. It would contain a _copy_ of all values in the list item and it would create a new meta-object for each list element. This function exists for the JavaScript API, and therefore we now return a much more lightweight object. For compatbility reasons it still has to be a QObject, but the meta-object of it is created on-demand, i.e. only when accessing properties from the C++ side or when connecting to the changed signal of a property. Otherwise the JavaScript wrapper will return the live values from the model without copying them. Change-Id: Iabf3ca22192d2aee06ae9d4b4cfb2fcde2a021b1 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Spencer Schumann <spencer.schumann@echostar.com>
* | Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-1812-52/+67
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * Use the new macros for disabling warnings in qtdeclarativeThiago Macieira2015-07-282-13/+4
| | | | | | | | | | Change-Id: I476da50ba23598c7ca98651477fb701f74053b82 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
| * Fix warning about returning address of local variable by MSVC2015 in ↵Friedemann Kleint2015-07-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | qv4engine.cpp. qtdeclarative\src\qml\jsruntime\qv4engine.cpp(179) : warning C4172: returning address of local variable or temporary: dummy Disable warning as using the address is intended. Change-Id: Ide894a8dc2fb94f11d0455723c46567c84d91f8d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Fix trivial bug where ArrayBuffer.isView never returned falseNobuaki Sukegawa2015-07-151-1/+1
| | | | | | | | | | Change-Id: I168d2ec54997d057e3d32463c2b153df38073838 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * V4: track C++ heap usage for Strings in the MemoryManagerErik Verbruggen2015-07-107-19/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and do a GC run when it exceeds a threshold. The issue with Strings is that they hold on to QString instances that store the real content. However, the GC only sees the light-weight JS handle, and doesn't take the size of the backing content into account. So it could happen that big QStrings accumulate in the heap as long as the GC didn't reach its threshold. The newly introduced unmanaged heap threshold is upped by a factor of two when exceeded, and lowered by a factor of 2 when the used heap space falls below a quarter of the threshold. Also grow the threshold if there is enough space after running the GC, but another GC run would be triggered for the next allocation. There is a special case for Heap::String::append, because this method will copy the data from the left and right substrings into a new QString. To track this, append notifies the memory manager directly of the new length. The pointer to the memory manager is stored in Heap::String, growing it from 40 bytes to 48 bytes (which makes it still fit in the same bucket, so no extra memory is allocated). Task-number: QTBUG-42002 Change-Id: I71313915e593a9908a2b227b0bc4d768e375ee17 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * QtQml: Fix const correctness in old style castsThiago Macieira2015-07-094-17/+17
| | | | | | | | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Fix encoding of QV4::Value in host buildsSimon Hausmann2015-07-082-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | When building on a 64-bit host targeting a 32-bit architecture, we would use QT_POINTER_SIZE == 4 from qconfig.h, which is unfortunately shared. However on 64-bit hosts the 32-bit encoding appears to result in gcc/clang to miscompile simple QV4::Value uses - when optimizations are enabled. As a workaround, let's use 64-bit encoding in all host scenarios. Change-Id: I000cf13abcc9240c931191d6361b6dee578cb5d4 Task-number: QTBUG-45364 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
| * Fix ICC warning about change of signThiago Macieira2015-07-071-1/+1
| | | | | | | | | | | | | | qv4typedarray.cpp(87): error #68: integer conversion resulted in a change of sign Change-Id: Iee8cbc07c4434ce9b560ffff13cf917dd8f9012e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Smaller cleanupsLars Knoll2015-08-142-0/+17
| | | | | | | | | | Change-Id: I14eb7e2b4031c8a033740ed1ef34f3b2efdc3649 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove Q_ALWAYS_INLINE definition, as it is now in qglobal.hErik Verbruggen2015-08-141-10/+0
| | | | | | | | | | Change-Id: Ie37194a8a02dd43cdcf2b97670fffe21da04cbf3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | qml: Avoid heap allocations due to QString::fromLatin1()Sérgio Martins2015-08-135-9/+9
| | | | | | | | | | | | | | By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Access the id objects through a specialized runtime methodLars Knoll2015-08-123-11/+23
| | | | | | | | | | | | | | | | This brings us one step closer to getting rid of the QQmlContextWrapper. Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move DataCollector into debugger pluginUlf Hermann2015-08-103-635/+49
| | | | | | | | | | | | | | | | The data collector and all the jobs it uses to interact with the engine are only used from the debugger plugin. We can as well move them there. Change-Id: Ia48251f08b48c7e1e607b8ae2a3d1de29f80f742 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | Move V4 debugger agent into the debugger pluginUlf Hermann2015-08-102-199/+8
| | | | | | | | | | | | | | | | | | | | The debugger is the only thing that actually needs it. Note that for this to work we need to make QV4::Debugging::Debugger a QObject and add some signals. The net effect is still a reduction in binary size of about 1kb. Change-Id: Ibecb8cfa140fc26fc13c8cbefb3d027ebdcd28a4 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | Change data collection for debugging to use QV4::Value.Ulf Hermann2015-08-102-128/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the variable collection to store QV4::Value values into a JS array, which is retained by the collector. This prevents any GC issues, and gives a nice mapping from handle (used in the debugging protocol) to JS value. It also allows for easy "shallow" object serialization: any lookup can start with the QV4::Value, and add any values it encounters to the array. Testing is changed to use this collector directly, thereby testing the class that is actually used to generate protocol data. Task-number: QTBUG-47061 Change-Id: Iec75c4f74c08495e2a8af0fedf304f76f8385fd7 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | destruct qobject wrappers before sweeping the GC heapLars Knoll2015-08-103-49/+25
| | | | | | | | | | | | | | | | | | The wrappers emit a destroyed signal, and it's important that the GC heap is in a well defined state when these signals are emitted. Change-Id: I423c4241b1e2fd3de727277d26bbe64f08862193 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Encapsulate and protect all accesses to the vtable of Heap objectsLars Knoll2015-08-1018-36/+48
| | | | | | | | | | | | | | | | This is required, so we can safely access the vtable even while we're marking objects during GC. Change-Id: I34f56b61b4bca0d0742faf607eb5ab8b2c30685e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Access context properties through the qml contextLars Knoll2015-08-103-13/+46
| | | | | | | | | | | | | | And get rid of another temp in the IR. Change-Id: I039393e020e5141f1986aee276246c30fd8057f3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Use the QmlContext to access properties of the scope objectLars Knoll2015-08-106-13/+57
| | | | | | | | | | | | | | | | | | Add some runtime methods to access properties of the scope object directly (using the QmlContext), and generate proper code to call those. Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>