aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-arrange qv4identifier{_p.h|.cpp}Ulf Hermann2020-04-151-1/+1
| | | | | | | | | | | | QV4::IdentifierHashData doesn't need to be visible to all the clients. Furthermore, it can be completely inline. The public functions of QV4::IdentifierHash need to be out of line, but the private ones can be all inline. This shouldn't make much of a difference as most of the public functions call at least one private function. Finally, the files should be named by the class names. Change-Id: I931f2aa71103e41fdd3dae9cc47d204edece0e12 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Clean up the runtime functions declarationsErik Verbruggen2019-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The declarations and usage of runtime functions have seen a number of changes: - we don't use the array of method pointers anymore because we don't use cross-platform AOT JITting - the check if a method can throw a JS exception was invalid, and was not used anymore - value-pointer vs. const-value-ref was inconsistent This patch cleans that up. By fixing the exception checking, we can now use it in the baseline JIT to automatically insert those checks. To make that work correctly, all runtime methods are in a struct, which gets annotated to indicate if that method throws. (The old way of checking which type of engine was used is fragile: some non-throwing methods do not take an engine parameter at all, and those got flagged as throwing). By using a struct, we can also get rid of a bunch of interesting macros. The flags in the struct (as mentioned above) can later be extended to capture more information, e.g. if a method will change the context. Change-Id: I1e0b9ba62a0bf538eb728b4378e2678136e29a64 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML Tooling: Prevent property capture while collecting dataUlf Hermann2018-10-101-0/+28
| | | | | | | | | We don't want additional connections to be formed as result of reporting data to the debugger. Task-number: QTBUG-70989 Change-Id: I78b038a159addac43a8661e402a70e5b14fb222b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML Tooling: Don't read properties in order to count themUlf Hermann2018-10-101-2/+1
| | | | | | | | | Reading properties may have side effects and we don't actually need the values here. Task-number: QTBUG-70989 Change-Id: If9f43f3c6a390ebd0ab1d1375fd021189adb10f7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Store InternalClass::nameMap in a MemberDataLars Knoll2018-09-161-1/+1
| | | | | | | | | | This helps make that memory known to the GC as well, and makes marking of internal classes much more efficient, as we don't mark the property keys repeatedly (even if they are shared between different internal classes) Change-Id: Ibb7e5383672d7657926bd08bf13f73f7680a9f31 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify ObjectIterator::nextLars Knoll2018-08-041-6/+4
| | | | | | | Use PropertyKey instead of two out pointers Change-Id: I4f57bcb36fd412f19f0ed116042f7b094b5785dc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4 Debuger: Drop namesAsObjects optionUlf Hermann2018-07-181-58/+4
| | | | | | | | There is no client that uses this anymore, and dropping it allows us to eliminate a lot of code. Change-Id: I6b09669c9dd7fcf9c2d249f133bfbb78d2b6f7f4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4 debugger: Drop redundantRefs optionUlf Hermann2018-07-181-44/+8
| | | | | | | | No client is using this anymore and we can eliminate a lot of code this way. Change-Id: I454581928fe88e59cd28738c4f7fddd060999181 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-2/+2
| | | | | | | | This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify put and putIndexedLars Knoll2018-07-021-2/+2
| | | | | | | | | | Pass an Identifier through those virtual methods to unify the string and integer based versions. Also add the receiver that's required in ES7 Change-Id: I4e7f01b4c97cc80bcb3c485f6343f28213dc9e6b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLars Knoll2018-05-241-29/+26
|\ | | | | | | Change-Id: I0127f2c16de1d930bdd8cbccd42ec6785f31ab96
| * V4 debugger: Allow retrieval of non-CallContext scopesUlf Hermann2018-05-231-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to encode the scope type properly and we need to return something from the "scope" command. Previously the client didn't even get notified about QML contexts and couldn't actually retrieve anything but call context. The other scope types are not terribly interesting right now, but at least for the global context it should be possible to provide more data in the future. Task-number: QTBUG-68218 Change-Id: I88d3dbc15a93f19b00f6f12365e4fb64ec78862e Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Garbage collect identifiersLars Knoll2018-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented by storing a backpointer to the Heap object in the identifier. Since identifiers now point back to their originating String or Symbol, we can now easily mark all identifiers that are still in use and collect those that aren't. Since Identifiers are 64bit also add support for holding an array index in there. With that an identifier can describe any kind of property that can be accessed in an object. This helps speed up and simplify some code paths. To make this possible, we need to register all IdentifierHash instances with the identifier table, so that we can properly mark those identifiers. Change-Id: Icadbaf5712ab9d252d4e71aa4a520e86b14cd2a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Use Identifier by value and don't new them anymoreLars Knoll2018-05-021-1/+1
| | | | | | | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Rework catch context handlingLars Knoll2018-05-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Remove the need for a specialized catch context, instead use a regular block context, that also captures the catched variable. This also removes the need to do lookups by name inside a catch expression. Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for proper lexical scopingLars Knoll2018-05-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This is still to some extend work in progress as lexically scoped for loops won't yet do the right thing. let and const variables are still accessible before they are declared, and the global scope doesn't yet have a proper context for lexically declared variables. Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove the QString member from IdentifierLars Knoll2018-05-021-1/+2
| | | | | | | | | | | | | | First step to turning identifier into a simple int. Change-Id: I4988587aa61f1f02ed80426ccbf00b685f38c829 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | garbage collect InternalClassLars Knoll2018-04-121-1/+1
|/ | | | | | | | | | | | | | | | Internal classes are now allocated and collected through the GC. As they are important to the deletion of other objects (because of the vtable pointer living inside the internal class), they need to get destroyed after regular objects have been sweeped. Achieve this by using a separate block allocator for internal class objects. Our lookups do often contain pointers to internal classes, so those need to be marked as well, so we don't accidentally collect them. Change-Id: I4762b054361c70c31f79f920f669ea0e8551601f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-10/+10
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the unusued canUseSimpleCall flagLars Knoll2017-11-071-9/+0
| | | | | Change-Id: I5230342db4647bd95793475f751213f0725d6965 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
| * Replace Q_NULLPTR with nullptrKevin Funk2017-09-271-1/+1
| | | | | | | | | | Change-Id: I0c01862dbb475494c84e39c695cb563df8cbcfa8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-221-2/+0
|\| | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * Remove hack to make QtC understand that typeof null is "object"Ulf Hermann2017-08-151-2/+0
| | | | | | | | | | | | | | Newer Qt Creators know that. Change-Id: If4d3da5a46b49864a77854fff79e54cef2ea26d6 Reviewed-by: hjk <hjk@qt.io>
* | Some prospective fixes to the debugging pluginLars Knoll2017-08-181-18/+23
| | | | | | | | | | | | | | Adjust to the context/frame changes Change-Id: I06e691654961c8c1f60765a4fd469f03607be4d0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Cleanup naming of Stack frame structuresLars Knoll2017-08-101-2/+1
| | | | | | | | | | Change-Id: I0b392040b6726e6d93f237ccccc9f053256ed819 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Refactor context handlingLars Knoll2017-08-101-24/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the push/pop context instructions to not modify the JS stack anymore, as that can cause conflicts with the VME (and was an ugly hack in any case). Instead, these instructions not return the old context, that is then stored in a temporary. Get rid of Engine::current and Engine::currentContext. The StackFrame structures do now contain the only and authoritive data. This finally gives us a nice setup where we create and destroy frames on the stack when entering/leaving functions. Change-Id: If161e3e941f59865c47ecfe1e094faf62b52bfa0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Unify SimpleCallContext and CallContextLars Knoll2017-07-051-7/+7
|/ | | | | | | Plan is to completely remove the need for the simple call context. Change-Id: Ie5e4673a6746dc110adbf526e45188f218fd7bfc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4argumentsobject.cpp src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4errorobject.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4managed.cpp src/qml/jsruntime/qv4managed_p.h src/qml/jsruntime/qv4object.cpp src/qml/jsruntime/qv4object_p.h src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4heap_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/memory/qv4mmdefs_p.h src/quick/scenegraph/util/qsgdistancefieldutil.cpp src/quick/scenegraph/util/qsgdistancefieldutil_p.h tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
| * Move the engine() accessor from Object to ManagedLars Knoll2017-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We can easily do this now that Managed has a pointer to an internal class (which always has a back pointer to the ExecutionEngine). Remove the extra engine pointer from ExecutionContext, and clean up tow methods in String. Change-Id: I98d750b1afbdeadf42e66ae0c92c48db1a7adc31 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-25/+62
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * V4 Debugger: Encode NaN and +/-Infinity as stringsUlf Hermann2017-03-211-2/+11
| | | | | | | | | | | | | | | | | | | | JSON doesn't have numerical values for those. However, as we give the type of each item in a separate field, we can just use strings here and the result will still not clash with actual strings. Task-number: QTBUG-47880 Change-Id: I85ffa008890a8a9e6894dd3151f7dc6b527ed5e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Protect CallContext member usage against word size differencesSimon Hausmann2017-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Ensure the offsets we're taking from ExecutionContext members in the JIT code generator can be translated from host architecture sizes to target architecture, using assertions and a memory layout that we already have in the dev branch with commit 4de7e48ab160dacc7a09360e80264eac4945a8f4. Change-Id: I1b26ef265234b05a6e5c8688a8aad2f33cd28783 Task-number: QTBUG-58666 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * QV4DebugService: Reduce unnecessary recursion and redundancyUlf Hermann2017-03-141-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Large parts of the protocol are unnecessary. There is no reason to send a separate chunk of "handles" with almost every reply. The refs are given as part of the regular data and if the client wants to find out more, it can do further lookups. Also, it makes no sense to encode the function and script names as objects, as they are in fact not JavaScript objects. Unfortunately these cleanups require some cooperation from the client. Older clients will misbehave if we just drop the redundancy. Therefore, we introduce parameters which the client can explicitly set with the "connect" message. redundantRefs tells the service if redundant references are required, namesAsObjects tells it if script and function names have to be sent as objects/ Once we can require clients that support these options, we can drop the code that generates redundant data. Also, fix tst_qv4debugger::evaluateExpression() to actually check all the expressions evaluated, not only the first and second one. Task-number: QTBUG-42435 Change-Id: If93d2a2b9d0b8035f85dbef871bc1b03f199171d Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add an actual write barrier and centralize it in one placeLars Knoll2017-03-091-2/+2
| | | | | | | | | | | | | | | | All stores into the Heap from C++ and Moth should now go through the write barrier. Change-Id: Iae9347754b90d68c10fade9f345842e86ec460cd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Separate SimpleCallData and CallDataLars Knoll2017-03-091-7/+7
| | | | | | | | | | | | | | | | | | | | SimpleCallData doesn't need any loca variables, so move it into a separate CallData Heap object. This also allows getting rid of the manual markObjects() implementation for CallContext. Change-Id: I9014eb2f815d3e2fe63a951a9d126c38e8aaa0a3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QV4Object: Remove helper put() methodRobin Burchell2017-02-091-3/+5
|/ | | | | | | | | This isn't used much, and we can do a bit of a better job by doing it by hand. In the case of jsonobject, we can reuse the empty string, and in the other uses, we can avoid allocating multiple values on the JS stack. Change-Id: I1f02cd86e3969c1471981978d18ce8512412123b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor the calling code for (Simple)ScriptFunctionLars Knoll2016-12-091-1/+1
| | | | | | | | | | | Factor the common code out into separate methods that can later on be reused by the QQmlJavaScriptExpression. Also ensure a CallContext is safe to use with a 0 FunctionObject. Change-Id: I1181a8e320b8c931d9df5b2c91bc143d8587fb60 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert the first batch of runtime functionsLars Knoll2016-04-111-1/+1
| | | | | | | | Convert them to the new calling convention through function pointers in the execution engine. Change-Id: Iecc54c9512f7231a04eb1659490a5d56118ff66a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove some dead code.Ulf Hermann2016-01-221-7/+0
| | | | | Change-Id: I511252cee0b6420670af839796b2e35915c35e50 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Clean up QV4DataCollectorUlf Hermann2016-01-211-10/+9
| | | | | | | | | We don't need to pass engines around as the data collector already has all the necessary information. Also, the exception collect job is only used in the test case, so we don't need to define it in the collector. Change-Id: I9e9f092a10295e3dc970f7b5f440e8f242ea1d54 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4 Debugger: Avoid looking up values in debugger threadUlf Hermann2016-01-211-8/+102
| | | | | | | | | | | To avoid interaction with the engine from the debugger thread we move the value lookup functionality into the data collector, and drop the RefHolder. Also, we define some more debugger jobs to move the work the request handlers do into the GUI thread. Task-number: QTBUG-50481 Change-Id: Id93548dc65133246deac71f73188c715e9dc01e4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* V4 Debugger: Move all the jobs into one placeUlf Hermann2016-01-111-202/+2
| | | | | | | | This makes the code more readable and allows us to keep the data collector as value, rather than pointer, in QV4Debugger. Change-Id: I2939c2b2f551111139f1dc34704a6029e87a66bf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4 Debugger: If no context is given inject the QML contextUlf Hermann2016-01-071-0/+16
| | | | | | | | | | The user generally expects QML "root" objects to be in a "global" scope. Or at least that makes debugging a lot easier. By opening a WithContext with the relevant objects we can simulate that. Task-number: QTCREATORBUG-14931 Change-Id: I89af0560803b2c54a35f08e9fd659e65fb937cb9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4 Debugger: Allow expression evaluation without pausingUlf Hermann2016-01-071-41/+110
| | | | | | | | | | | | | | We can schedule jobs into the GUI thread just fine, even if the debugger is running. They will run in global scope then. The only restriction is that we need exactly one engine to be running in order to do that, as otherwise we cannot decide which engine to use. To avoid interaction with the engine from the debugger thread we move the value lookup functionality into the data collector, and drop the RefHolder. Change-Id: Ifae124d70f42e488ed9a1b6794baef638992ddb1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-12-151-2/+2
| | | | | Change-Id: Ie25b5fa4f25392da29389c990494f704b7c80c95 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Move V4 debugger and its test into better placesUlf Hermann2015-10-301-3/+4
| | | | | | | | | Now that we have an abstract base class we don't need to carry the V4 debugger in QtQml anymore. The test clearly belongs into the debugger category. Change-Id: I0f71bdb331da8a568e43600363a0468299aa1a87 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into origin/devUlf Hermann2015-10-221-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.h src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h src/qml/debugger/qqmldebugserviceinterfaces.cpp src/qml/jsruntime/qv4debugging_p.h Change-Id: I82a4ce1bcd4579181df886558f55ad2b328d1682
| * QmlDebug: Split QV4::Debugging::Debuggerhjk2015-10-141-3/+4
| | | | | | | | | | | | | | | | | | | | ... into a pure interface and a QV4::Debugging::V4Debugger implementation. This is in preparation of a second implementation of this interface to be used with 'native mixed' debugging. Change-Id: I3078dcfe4bdee392a2d13ef43a55ca993e7b88d8 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>