Commit Graph

87 Commits

Author SHA1 Message Date
Simon Hausmann 24d0266ee4 Merge remote-tracking branch 'origin/5.9' into HEAD
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
2017-03-23 14:43:46 +01:00
Ulf Hermann 1bc9e17636 V4 Debugger: Encode NaN and +/-Infinity as strings
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>
2017-03-21 13:10:50 +00:00
Simon Hausmann 7a125135e1 Protect CallContext member usage against word size differences
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 4de7e48ab1.

Change-Id: I1b26ef265234b05a6e5c8688a8aad2f33cd28783
Task-number: QTBUG-58666
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-17 08:36:14 +00:00
Ulf Hermann 8469f0501d V4 Debugger: Fix typo
We want to set redundantRefs if the client states "redundantRefs".

Change-Id: I277120e3feedec14492679ad827845732dc36495
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-14 17:00:23 +00:00
Liang Qi 12e82111ab Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I0ec164ce6e8099e6e4d6b40a3c7340737473ef4b
2017-03-14 10:49:51 +01:00
Ulf Hermann ffe538a565 QV4DebugService: Reduce unnecessary recursion and redundancy
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>
2017-03-14 09:02:51 +00:00
Lars Knoll b214d6cc2f Add an actual write barrier and centralize it in one place
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>
2017-03-09 08:58:57 +00:00
Lars Knoll 3a0bb11d73 Separate SimpleCallData and CallData
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>
2017-03-09 08:58:17 +00:00
Ulf Hermann 5a9fd4f49e V4 Debugger: Don't crash when stepping to the end of a script
The last instruction is a return, which leads to an invalid context.
Don't try to save that context, but rather clear the current one.

Change-Id: I468b7420c4ca0842209c9b00478f99cc4dc69726
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-28 16:33:00 +00:00
Robin Burchell 60d67b4eb9 QV4Object: Remove helper put() method
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>
2017-02-09 14:52:55 +00:00
Liang Qi 0e80d28aa5 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
	src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
	src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
	src/qml/qml/qqmlimport.cpp
	src/quick/items/context2d/qquickcontext2dtexture_p.h
	tools/qmleasing/splineeditor.h

Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
2016-12-14 19:01:23 +01:00
Ulf Hermann bff7302fc2 V4 Debugger: Add an option to pass additional context for evaluate
Interpret the "context" option as an ID for a QObject whose QML context
is then injected when evaluating the expression. The QObject needs to
be tracked by some other debug service for this to work, e.g. the QML
debugger or the inspector.

Task-number: QTCREATORBUG-17177
Change-Id: I6a9e8b9ae23e8bb67ed1905a2ef73f7c4faeb990
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-09 12:51:51 +00:00
Lars Knoll deec039008 Refactor the calling code for (Simple)ScriptFunction
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>
2016-12-09 08:31:01 +00:00
Alexander Volkov 3dd96630a2 headers: Add missing override and remove redundant virtual
Change-Id: Ifa816ebcd79372afca42dbd0dc0ecde006bb688a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-07 20:10:22 +00:00
Lars Knoll b4ccdf004a Change ExecutionContext::getFunctionObject() to getFunction()
And return a QV4::Function from now on. This simplifies code in
other places and provides all the info required for stack traces
and debugging.

Change-Id: I512a8ac3932268d8cfc60675e75c4661d1f16fd8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-06 13:01:44 +00:00
Lars Knoll e31e72925f Cleanup and reduce the number of overloads for QQmlBinding::create()
Change-Id: Ibcd277bc434638e5c6e8e9ccea634aa25cde1643
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-06 13:01:30 +00:00
Lars Knoll 8a6383775a Start cleaning up the QmlContextWrapper
The class should get merged with the QV4::QmlContext class.
Simplify the cleanup by moving both classes into a common
file.

Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-04 08:31:49 +00:00
Ulf Hermann 0cbda65924 QmlTooling: Move native debug service into own plugin
QV4DebugService and QQmlNativeDebugService cannot coexist at the same
time. Thus, there is no point in putting them into one plugin.

Change-Id: Ic042f7472fce23d504c62ccf96756b0f1bd68534
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-18 14:36:39 +00:00
Ulf Hermann 9f5945a630 QmlTooling: Move QDebugMessageService into own plugin
The debug message service is used by both the debugger and the
profiler. It shouldn't be necessary to load the debugger plugin in
order to do QML profiling.

Change-Id: Ic9a4216763098cc795fa9feb98b37ddceeed47d9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-18 14:36:35 +00:00
J-P Nurmi da5083c11d Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	tools/qmljs/qmljs.cpp

Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
2016-11-03 11:01:45 +01:00
Thiago Macieira a754b0620f Cast enums to int before streaming into QDataStream
They are decoded as ints, as in

QPacket &operator>>(QPacket &ds, QmlObjectProperty &data)
{
    int type;
    ds >> type >> data.name >> data.value >> data.valueTypeName
       >> data.binding >> data.hasNotifySignal;
    data.type = (QmlObjectProperty::Type)type;
    return ds;
}

So we should serialize the same, since the required operator<< and >>
don't exist.

Change-Id: I33dc971f005a4848bb8ffffd1478edcf2e916dfc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-10-23 21:48:31 +00:00
Anton Kudryavtsev 142a56ecb9 Plugins: add missing 'override'
... and drop redundant 'virtual'

Change-Id: Ifa12539dd40be600158f92f04fac56626527ef77
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-10-06 13:17:18 +00:00
Anton Kudryavtsev 798b6ba239 optimize string usage: use fromLatin1() less
.. to reduce allocations.

Replace fromLatin1 with QLatin1String or
with QStringBuilder where it is possible.

Change-Id: I09c7242fa7b118447b51239e2a6743a34fb3de14
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-09-08 18:18:29 +00:00
Anton Kudryavtsev 31a2cbbbc2 Plugins: replace 'foreach' with 'range for'
Mark some local variables as const to prevent detach()'ing.
Use qAsConst where is not possible mark as const.
If a container is changed in a loop's body, just make copy
like 'foreach'.

Change-Id: Ic453a688a9edf8a864d47f6e3a605164508a027c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-08-26 12:40:37 +00:00
Anton Kudryavtsev 0010a214ec NativeDebugger: fix MSVC build
MSVC does not like QStringLiteral in operator[].
And the follow-up patch, which replaces 'foreach'
with 'range for' triggers this MSVC bug.

Replcace operator[] with insert() method.

Change-Id: I9805510bfb4e9f29496dcae08be583d98230debe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-08-25 18:04:55 +00:00
Erik Verbruggen 86a55cdb8c QML: Make all fields in QQmlPropertyRawData private
And add accessors. This makes it easier later on to change the storage
of the fields.

Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-10 14:21:15 +00:00
Ulf Hermann a7c7b26653 V4: Make ExecutionEngine's debugger and profiler private
This will allow us to #define them away on -no-qml-debug, saving two
pointers per engine.

Change-Id: I400cffd32cd7f55ff0e68565734b6002b9f901d5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-28 15:09:33 +00:00
Ulf Hermann bd48f0e5ed Tooling: Convert connects to Qt5 style
Change-Id: I6746b777f73d047f5cf610bfca9b320ac1e13676
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-28 09:17:49 +00:00
Erik Verbruggen 3dfd47362f QML: Specialize bindings based on target property type.
When we can determine the type of a target property during type
compilation, we can skip a whole bunch of code that deals with
converting the result of a binding to the correct (target) type.

This removes 65 instructions on x86 for such typed bindings.

Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-27 06:20:23 +00:00
Erik Verbruggen 702c4247d7 V4: Pass scope around as parameters inside the runtime.
The implementation of many (or all) runtime functions consist of first
creating a QV4::Scope, which saves and restores the JS stack pointer.
It also prevents tail-calls because of that restoring behavior. In many
cases it suffices to do that at the entry-point of the runtime.

The return value of a JS function call is now also stored in the scope.
Previously, all return values were stored in a ScopedValue, got loaded
on return, and immediately stored in another ScopedValue in the caller.
This resulted in a lot of stores, where now there is only one store
needed, and no extra ScopedValue for every function.

Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-22 11:07:05 +00:00
Liang Qi 43431619d6 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/quick/items/qquickflickable_p_p.h
	src/quick/items/qquickpathview_p_p.h
	tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp

Change-Id: I77664a095d8a203e07a021c9d5953e02b8b99a1e
2016-06-21 21:22:46 +02:00
Liang Qi cb6c208c77 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/qml/jit/qv4targetplatform_p.h
	src/quick/accessible/qaccessiblequickitem_p.h

Change-Id: Ic95075a5fad81ec997a61561bd65979dfa3b9d4d
2016-06-20 12:26:08 +02:00
Erik Verbruggen aa7c3b35ef V4: Always set the tag when boxing a pointer in QV4::Value.
All setters now store tags, so no-one can play loosy-goosy with the
boxed values (and accidentally forget to "tag" a value, resulting in
random garbage).

Change-Id: Ia0b78aa038d3ff46d5292b14bd593de310da16a0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-16 12:32:36 +00:00
Frank Meerkoetter 2e950afe90 Use the QStringBuilder API to save allocations
Change-Id: Iae2b08715157325f031f1c08b393cd682908029f
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-14 20:38:36 +00:00
Anton Kudryavtsev 4de6c1bc6c Imports, Plugins, Quick: replace QStringLiteral with QL1S
.. in such cases:
- if there is overloaded function
- in QStringBuilder expressions

Result: reducing .rodata

Change-Id: I972bc0a61df7b5567c40329dd47e77176d9a5b96
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-06-09 08:14:39 +00:00
Frank Meerkoetter 573356464b Fixed another batch of QHash/QMap::values() (mis)use
Avoid memory allocations.

Change-Id: I0b4cbef6a8c22184781a44d92172d93ac38e778c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-05-25 19:27:33 +00:00
Simon Hausmann ef6469a959 VME Method object data cleanup
Get rid of the redundant MethodData meta-data that is stored per-type.

Change-Id: I9faa284bdd0c9f0c9ebb3c66905ab5e34a9ee3a4
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-19 12:12:35 +00:00
Liang Qi ae745746a6 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/qml/jsapi/qjsengine.cpp
	src/qml/qml/qqmlengine_p.h
	src/quick/items/qquickanchors.cpp
	src/quick/items/qquickanimatedimage_p_p.h
	src/quick/items/qquickitem_p.h
	tests/auto/qml/qqmlecmascript/testtypes.h
	tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
	tests/benchmarks/qml/creation/tst_creation.cpp

Change-Id: I65861e32f16e8a04c7090a90231627e1ebf6ba6f
2016-05-13 08:28:27 +02:00
Anton Kudryavtsev 1be53f4e14 Use QStringRef to optimize memory allocation
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.

Create QString from QStringRef only where necessary.

While touching the code, also port loops to C++11 style.

Change-Id: I04c99b24ea6afd3715e3edf9ea00bfab838fd53c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-04-26 10:31:19 +00:00
Lars Knoll 1e557d90b5 Convert the first batch of runtime functions
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>
2016-04-11 12:27:29 +00:00
J-P Nurmi 23712c5680 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro

Change-Id: I3ca8f0422828191b7e19539c25f31f2d048e9f18
2016-03-01 14:17:52 +01:00
Oswald Buddenhagen 09a9519d7c consistently put {qt,qml}_{module,plugin} at the end of project files
this fixes static builds by ensuring that all dependencies are exported.

Task-number: QTBUG-51071
Change-Id: I5928f853a1d13b6a73533f9c6f6eae9da0e52a26
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-25 16:47:28 +00:00
Ulf Hermann 2fb5c2342b Remove some dead code.
Change-Id: I511252cee0b6420670af839796b2e35915c35e50
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-22 14:43:07 +00:00
Simon Hausmann f286db98ee Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
2016-01-22 15:21:06 +01:00
Ulf Hermann b60a5dc940 Clean up QV4DataCollector
We don't need to pass debuggers and 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: I3197dd5c2d99e95465aa787097c6f8bf8aee794e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-22 09:51:40 +00:00
Ulf Hermann 5537027094 V4 Debugger: Avoid looking up values in debugger thread
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: Ia73ebd01e715f13110ef010a766e9b0a1e202df9
Reviewed-by: Nils Jeisecke <jeisecke@saltation.de>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-22 09:51:37 +00:00
Ulf Hermann ce093497f2 Clean up QV4DataCollector
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>
2016-01-21 14:49:43 +00:00
Ulf Hermann ebb08ee84e V4 Debugger: Avoid looking up values in debugger thread
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>
2016-01-21 14:49:39 +00:00
Jani Heikkinen 45bd04ba73 Updated license headers
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>
2016-01-19 14:53:18 +00:00
Anton Kudryavtsev 8d0d5053ad Plugins: fix expensive iteration over QHash::keys()
... and QMultiHash::keys()

Change-Id: I616c486c05471fc514595f9cb446953331c4eb90
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-01-15 14:43:56 +00:00