platform/upstream/qtdeclarative.git
9 years agoGet rid of subtype usage in Function objects
Lars Knoll [Fri, 9 Jan 2015 12:28:40 +0000 (13:28 +0100)]
Get rid of subtype usage in Function objects

Change-Id: Ic84ddab292cb69e79dac0f2b8a87b96b096360d8
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoGet rid of hasAccessorProperty in Heap::Base
Lars Knoll [Fri, 9 Jan 2015 12:13:04 +0000 (13:13 +0100)]
Get rid of hasAccessorProperty in Heap::Base

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 <simon.hausmann@digia.com>
9 years agoGet rid of the needsActivation flag in Heap::Base
Lars Knoll [Fri, 9 Jan 2015 11:30:01 +0000 (12:30 +0100)]
Get rid of the needsActivation flag in Heap::Base

Change-Id: Idcec374cb6d16aabf919c23d7236b76d9d047527
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoGet rid of the bindingKeyFlag
Lars Knoll [Fri, 9 Jan 2015 11:11:09 +0000 (12:11 +0100)]
Get rid of the bindingKeyFlag

Instead use the vtable to identify that we have a
binding function.

Change-Id: I794aebb6fb83f648ba36f2f15cad94d2af3cae91
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoStart cleaning up flags in Heap::Base
Lars Knoll [Fri, 9 Jan 2015 11:01:06 +0000 (12:01 +0100)]
Start cleaning up flags in Heap::Base

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 <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQML 3rdparty: revert unnecessary change.
Erik Verbruggen [Wed, 17 Dec 2014 12:25:22 +0000 (13:25 +0100)]
QML 3rdparty: revert unnecessary change.

It is the change to DataLog.h, which in turn forces the other changes in
order to match types.

Change-Id: Ie17e7efbd6a4d380a3b7383b0fd0243c6f68d0d5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQV4: Use QVarLengthArray in cleanupBasicBlocks.
Robin Burchell [Sun, 21 Dec 2014 23:00:26 +0000 (00:00 +0100)]
QV4: Use QVarLengthArray in cleanupBasicBlocks.

Avoids heap allocations, drops around ~60ms off my morbid testcase in doing so.
QBitArray is still allocating, meaning this function isn't "free", but it's now
at 0.9% of runtime vs the 1.3% it was before, so something for another day.

Change-Id: Ie0db8e0312bde5f67b37250d04b4d65e1f0b034d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix compiler warning about use of uninitialized variable
Lars Knoll [Fri, 9 Jan 2015 10:51:03 +0000 (11:51 +0100)]
Fix compiler warning about use of uninitialized variable

Change-Id: Ic9218d82c5f47d464a6536759cfe2c6dbfc9f985
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
9 years agoAdd Window.width and Window.height attached properties
J-P Nurmi [Mon, 5 Jan 2015 20:00:40 +0000 (21:00 +0100)]
Add Window.width and Window.height attached properties

[ChangeLog][QtQuick] Added Window.width and Window.height attached
properties

Change-Id: I3ef590a0d3e6fa660ed88992d5ae843deb09c7bc
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
9 years agoTest: make mouse press, release, click and double click default to the center of...
Albert Astals Cid [Fri, 9 Jan 2015 09:49:47 +0000 (10:49 +0100)]
Test: make mouse press, release, click and double click default to the center of the item

Most of the times you just want to act on the item not caring the position.
This helps for cleaner test code

Change-Id: I0e8a4919c503e3fd6dee60e1bd937ac57622279f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
9 years agoQQuickGridMesh: Avoid a signal connection per mesh instance by just calling the signa...
Robin Burchell [Wed, 7 Jan 2015 21:00:00 +0000 (22:00 +0100)]
QQuickGridMesh: Avoid a signal connection per mesh instance by just calling the signal directly.

This can be instantiated a fair number of times, leading to a lot of signal
connections. Since the signal is so simple, just place a function call inline
and avoid unnecessary allocations.

Change-Id: I031245c46bf797898f22ed991d0e97d73728bdf5
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
9 years agoV4 JIT: Hoist QVector allocation out of a loop.
Robin Burchell [Mon, 22 Dec 2014 14:32:06 +0000 (15:32 +0100)]
V4 JIT: Hoist QVector allocation out of a loop.

Use erase() each loop iteration, but preserve the underlying allocation.

Change-Id: I673766f5567794215465daa597a4839a4900450b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQV4: Don't heap allocate blockNumbers.
Robin Burchell [Sun, 21 Dec 2014 21:55:24 +0000 (22:55 +0100)]
QV4: Don't heap allocate blockNumbers.

Analysis of the allocations in BasicBlockSet show a huge amount of time spent in
allocating and freeing BasicBlockSet, which involves heap allocations. Most of
the time, blockNumbers is tiny (at least in my testing) - 0 to 1 in size at
deletion time. By inlining the (small) array, we save a nasty penalty.

This shaves around 400ms off the optimizer phase of my morbid QML testcase.

Change-Id: I46319173b5408a0d7a1b9663fdc516c9e5ca410e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
9 years agoQML: Remove unused field from struct.
Erik Verbruggen [Fri, 9 Jan 2015 09:44:31 +0000 (10:44 +0100)]
QML: Remove unused field from struct.

Change-Id: I574dd5de67038ecb2e4d81ed69ed535e3be9ea05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQML: fix uninitialized variable use.
Erik Verbruggen [Fri, 9 Jan 2015 09:40:19 +0000 (10:40 +0100)]
QML: fix uninitialized variable use.

/Users/erik/dev/qt5-dev/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1539:5: warning: variable 'offset' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
/Users/erik/dev/qt5-dev/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1544:15: note: uninitialized use occurs here
    *index -= offset;
              ^~~~~~

Change-Id: I92538c8a3cf2a192be4c62e29b06b2c940b6def5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoReplace InternalClass transitions hash with a sorted vector.
Robin Burchell [Thu, 8 Jan 2015 00:28:58 +0000 (01:28 +0100)]
Replace InternalClass transitions hash with a sorted vector.

In a reasonable test application, there were some 1697 transition entries. Out
of these, 1663 of them had only a single item. The remainder, with the exception
of three, had <10 items. Only one of these had a count of >50 items (86).

As can be seen, most of the time, transitions is usually quite sparsely
populated, so using a hash is a large amount of overhead considering there's
just a few elements. For the times when it isn't, the vector being sorted
should help take care of that.

Since transitions are never removed, we can use a similar trick to
ba690fb73864915b4a35bbec5b7dc134ff1dafd0 and use a sorted vector to store them.

Compared to the hash approach, this saved ~412kb according to malloc_stats on a
reasonably comprehensive test application. Coincidentally, this also improved
v8bench for me by ~10%.

Note that this undoes 132cdfa69cae45d0c02ea715ce58722bbcd57e73, but the
expectation is that the fewer allocations done by using a vector will outweigh
the need to reserve any specific allocation initially.

Change-Id: Iec57a7db7e9a60347c9683b1cb1598f6d9c866f7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoStabilize the drag related autotests for higher dpi displays
Lars Knoll [Fri, 9 Jan 2015 09:53:12 +0000 (10:53 +0100)]
Stabilize the drag related autotests for higher dpi displays

Higher DPI displays might have a larger StartDragDistance (at
least on X11), breaking the autotest on these displays.

Change-Id: I9768a245a7654665dd9f718100289e9416d8c855
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove QQmlTrace. We have a real profiler.
Erik Verbruggen [Thu, 18 Dec 2014 09:37:22 +0000 (10:37 +0100)]
Remove QQmlTrace. We have a real profiler.

Change-Id: I50d981b277187327c2c63f8372f64db1300ed9ef
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoCleanup variant conversion code
Lars Knoll [Fri, 2 Jan 2015 14:07:35 +0000 (15:07 +0100)]
Cleanup variant conversion code

Make public methods proper members of the ExecutionEngine, and
move private methods into the .cpp file only.

Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMove the variant conversion methods from qv8engine to qv4::ExecutionEngine
Lars Knoll [Fri, 2 Jan 2015 13:37:26 +0000 (14:37 +0100)]
Move the variant conversion methods from qv8engine to qv4::ExecutionEngine

Change-Id: Ibd529ae5cc3ba06f46152e9daa9119a4e7a2561c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoThis method is only used one place, so inline it there
Lars Knoll [Thu, 1 Jan 2015 14:24:33 +0000 (15:24 +0100)]
This method is only used one place, so inline it there

Change-Id: Ia8b75965208c9687163ddaf982c4081c1ee504d4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMake the remaining variant conversion methods static
Lars Knoll [Thu, 1 Jan 2015 13:25:08 +0000 (14:25 +0100)]
Make the remaining variant conversion methods static

And make most private as well

Change-Id: If215aba4985a5150aa5a901f2e50e31bf0afa709
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove most v8engine references in xhr
Lars Knoll [Wed, 31 Dec 2014 15:15:42 +0000 (16:15 +0100)]
Remove most v8engine references in xhr

Change-Id: Ibbb38d57782f8566502852a2cb3cfd4a28f9dfc3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine from qmlcomponent and canvas2d
Lars Knoll [Wed, 31 Dec 2014 15:03:34 +0000 (16:03 +0100)]
Remove v8engine from qmlcomponent and canvas2d

Change-Id: I575ba208de24ffe90bd02905aba67b0b08c5115e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine dependency in localstorage
Lars Knoll [Wed, 31 Dec 2014 14:49:59 +0000 (15:49 +0100)]
Remove v8engine dependency in localstorage

Change-Id: I69616efe6629bcae154ff36f3e1aebd2dfa87aa4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine dependency in the builtin functions
Lars Knoll [Wed, 31 Dec 2014 14:49:39 +0000 (15:49 +0100)]
Remove v8engine dependency in the builtin functions

Change-Id: If9d50709548a5295457a20907bdf5e1153f49071
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine dependency from qqmllocale
Lars Knoll [Wed, 31 Dec 2014 12:26:48 +0000 (13:26 +0100)]
Remove v8engine dependency from qqmllocale

Change-Id: Ib6f51915c5a049592c2958624017eb2f8ad962d8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMove extension mechanism over to use the v4 engine
Lars Knoll [Wed, 31 Dec 2014 12:21:39 +0000 (13:21 +0100)]
Move extension mechanism over to use the v4 engine

Change-Id: Ib329fc7bcae3c78d962a116f53b2244a71f81228
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine usage in the value type provider
Lars Knoll [Tue, 30 Dec 2014 20:47:49 +0000 (21:47 +0100)]
Remove v8engine usage in the value type provider

Change-Id: I6b26a8249175a86c6e15d000b24ba3300e112715
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoClean up JS .import/.pragma directive scanning
Simon Hausmann [Fri, 5 Dec 2014 15:32:56 +0000 (16:32 +0100)]
Clean up JS .import/.pragma directive scanning

There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so
let's get rid of extra parser that operates on a string. Instead this way we
can do the scanning all in one shot, avoid detaching a copy of the source code
string and (most importantly) bring the parser closer to the copy in Qt
Creator, which uses the directives approach to extract imports and pragma.

Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
9 years agoRemove qv8engine usage in the contextwrapper
Lars Knoll [Tue, 30 Dec 2014 20:36:00 +0000 (21:36 +0100)]
Remove qv8engine usage in the contextwrapper

Change-Id: Iaf807add5d971e96cac57e38e13385e901f9c930
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoGet rid of QV8Engine::toString
Lars Knoll [Tue, 30 Dec 2014 17:29:21 +0000 (18:29 +0100)]
Get rid of QV8Engine::toString

Change-Id: Ib51fa09ae251c1b7b8878ecdf920016f8fcc0067
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine pointer from QQmlV4Function
Lars Knoll [Tue, 30 Dec 2014 16:06:02 +0000 (17:06 +0100)]
Remove v8engine pointer from QQmlV4Function

Change-Id: I68ddd79b8866ef9b8628a2eab1118d3ee3d72759
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoGet rid of more uses of QV8Engine
Lars Knoll [Tue, 30 Dec 2014 15:38:20 +0000 (16:38 +0100)]
Get rid of more uses of QV8Engine

Change-Id: I763728b1685e8e68bcf815dda4dd8e5757f59dd2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoReduce v8engine dependency for the list model
Lars Knoll [Tue, 30 Dec 2014 15:26:18 +0000 (16:26 +0100)]
Reduce v8engine dependency for the list model

Change-Id: Ib9e39a886c918a8f6ee1477465895739f90e1a0a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFurther reduce v8engine dependencies
Lars Knoll [Tue, 30 Dec 2014 15:04:32 +0000 (16:04 +0100)]
Further reduce v8engine dependencies

Change-Id: I9f50f5ed1928de0c389c9646b308b431b51dae37
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoThe property() calls in the proeprty cache only require a QJSEngine now
Lars Knoll [Tue, 30 Dec 2014 14:54:58 +0000 (15:54 +0100)]
The property() calls in the proeprty cache only require a QJSEngine now

Change-Id: Ic4a944b4f1dd02ad2f0284acad5f3135068f66df
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoAllow importing protected modules with different major versions
J-P Nurmi [Wed, 7 Jan 2015 14:19:29 +0000 (15:19 +0100)]
Allow importing protected modules with different major versions

This allows QtQuick.Controls 1.x and 2.x imports to co-exist even
if they are two different plugins with the same module directive.

Change-Id: Idee302439e3c2fd6813ba2f41b69144fbae7902c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMake waitForRendering without item fail instead of crash
Albert Astals Cid [Wed, 7 Jan 2015 15:17:52 +0000 (16:17 +0100)]
Make waitForRendering without item fail instead of crash

Change-Id: Icd276ed19087c2a1cde8c626347c696efb21ceb3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQV4: Lower time spent in indirections and allocations.
Robin Burchell [Sun, 21 Dec 2014 19:15:09 +0000 (20:15 +0100)]
QV4: Lower time spent in indirections and allocations.

Change data type for defsUntyped from QList -> QVector & reserve space when
creating the list. Drops ~250ms off a pretty morbid QML testcase, most, but not
all of which was spent in allocations.

Change-Id: I2ed8c62e7d41ab353a0194da268a2b430f079474
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoV4 IR: Change data type used in RemoveSharedExpressions pass.
Robin Burchell [Sun, 21 Dec 2014 18:44:41 +0000 (19:44 +0100)]
V4 IR: Change data type used in RemoveSharedExpressions pass.

Profiling the loading of a pretty morbidly large QML file consistently showed
that this was quite slow, around 1300ms in removeSharedExpressions, of which a
good >600-700ms (I didn't count exactly, but it was a very large amount) was
down to allocating and freeing QHash nodes.

As we don't require removals, leaving insertion and lookup as the only two
remaining options, a sorted vector becomes a viable alternative (credit to JoĆ£o
Abecasis for the idea).

An additional benefit of this change is that the two hash lookups are now
compressed into a single 'hash' lookup (via the lower_bound call) instead of
separately using contains() / insert().

Measuring the exact saving is difficult, but it looks like this saves between
700-1000ms off the runtime RemoveSharedExpressions. After this patch, malloc and
free are dominating the optimizer run, instead of any particular method.

Change-Id: I6c0bb8495eac4dd3613ba0274e8802d7bd609460
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix property access and method invocation on value types that use inheritance
Simon Hausmann [Wed, 7 Jan 2015 10:51:37 +0000 (11:51 +0100)]
Fix property access and method invocation on value types that use inheritance

For gadgets/value types we use moc's static_metacall, which doesn't call the
parent class implementation. Therefore before placing a static metacall we
must resolve the indicies and find the right meta-object.

Change-Id: I258e3d9ecfc704498c68772dc42b16134a3bfd83
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
9 years agoUnify QQmlDirParser version parsing and error reporting
J-P Nurmi [Wed, 7 Jan 2015 12:32:33 +0000 (13:32 +0100)]
Unify QQmlDirParser version parsing and error reporting

Add a parseVersion() helper function to avoid duplicating
the same version parsing logic three times.

Change-Id: I4e5b6a8c86ee3a26c4eb91c660a81176ac0346cf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
9 years agoPrevent windows outside the gui thread in rendercontrol example
Laszlo Agocs [Tue, 16 Dec 2014 11:49:08 +0000 (12:49 +0100)]
Prevent windows outside the gui thread in rendercontrol example

In the multithreaded case we attempted to create QWindows outside
the gui thread on platforms where QOffscreenSurface is backed by
the hidden QWindow in the absence of a better solution. This has
to be avoided. Therefore, pass a suitable surface from the gui
thread instead.

This will avoid "Attempting to create QWindow-based QOffscreenSurface
outside the gui thread." type of warnings when running on OS X with
--threaded.

Change-Id: Ie3ebeeeaa9e6bdf83e763e40213e2940fbfde667
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: JĆørgen Lind <jorgen.lind@theqtcompany.com>
9 years agoqmltime: Correct module name in error message.
Robin Burchell [Tue, 6 Jan 2015 18:36:02 +0000 (19:36 +0100)]
qmltime: Correct module name in error message.

Change-Id: Icccad866bdbaf53bf2cb3f1aff30ecd9ff6d06a5
Reviewed-by: Michael Brasser <michael.brasser@live.com>
9 years agoFix the vertex ordering of merged triangle strips
Jocelyn Turcotte [Mon, 5 Jan 2015 17:14:56 +0000 (18:14 +0100)]
Fix the vertex ordering of merged triangle strips

Culling and gl_FrontFacing depend on the vertex order matching the
value set through glFrontFace. To match the default counter-clockwise
order we need to preserve the parity of triangles relatively to the
start of the indices argument of glDrawElements, but we break this
parity because of the degenerate triangles between merged strips.

Fix the issue by skipping the first degenerate triangle, the parity
of following strips will be preserved since they are then separated
by two triangles.

This fixes a regression of
tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
triggered by 38cab579a0c5398b7621221fd8609bc43cf1f3c5.

Change-Id: Iefa7eaab68112d31be9d8646bd288eb000528cd5
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
9 years agoReuse the memory we use for vertex uploads.
Gunnar Sletta [Tue, 6 Jan 2015 07:40:21 +0000 (08:40 +0100)]
Reuse the memory we use for vertex uploads.

Every batch would have its own buffer with its own memory
and the original idea was that it would stabilize so that
the same batch would be used over and over, so the memory
allocatd for each batch's buffer would be reused. In practice
batches get discarded and recycled in somewhat arbitrary
order so we always end up reallocating.

Instead, use a single buffer for all uploads. This saves us several
reallocations per frame, and also prevents pooling of several
potentially large allocated blocks inside the renderer.

The exception is when using visualization or for drivers
which have broken index buffer support (nouveau only currently),
where we keep the existing behavior as the buffer data is
needed during rendering and visualization.

Change-Id: Id29095e00128ec1ee6d4ac3caa8f2c17cc7bbd27
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
9 years agoSome minimal changes to make qmlpuppet compile again
hjk [Tue, 6 Jan 2015 09:35:32 +0000 (10:35 +0100)]
Some minimal changes to make qmlpuppet compile again

Access to QJSEnginePrivate::createCache and the previous
signature of QQmlPropertyCache::invalidate is used.

Change-Id: Ie2578eee33ee4ebb2cdc4574d8d1cb7c8209868e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
9 years agoRemove bogus assert.
Gunnar Sletta [Mon, 5 Jan 2015 12:21:45 +0000 (13:21 +0100)]
Remove bogus assert.

It is perfectly valid to reparent nodes to a parent
that is part of an existing hierarchy.

Change-Id: Icf2dbe6030d399047e7ebe735e3096d1a8cd8c0e
Task-number: QTBUG-43278
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
9 years agoTraverse children correctly when reparenting.
Gunnar Sletta [Mon, 5 Jan 2015 11:38:18 +0000 (12:38 +0100)]
Traverse children correctly when reparenting.

Since the children are being removed from the parent, using
nextSibling on the child won't work. We need to extract the
first child from the parent until there are no more children
left.

Change-Id: Ifca5f2760e2b1c7ba56c198623c5dc9d82c7560f
Task-number: QTBUG-42530
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
9 years agoAdd propertyName to error
Albert Astals Cid [Fri, 19 Dec 2014 10:21:00 +0000 (11:21 +0100)]
Add propertyName to error

May help a bit to the reader, even if the line is already there
sometimes it can be confusing if it is a default property like data

Change-Id: I5cb8e8833c78a784ad4f5541d094840477e8f350
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse QV4::ScopedObject typedef instead of actual type
Oleg Shparber [Wed, 31 Dec 2014 18:37:47 +0000 (10:37 -0800)]
Use QV4::ScopedObject typedef instead of actual type

Change-Id: I0b68c534ea513a7c230b12114f6b42b069f9864b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse QV4::ScopedArrayObject typedef instead of actual type
Oleg Shparber [Wed, 31 Dec 2014 18:40:16 +0000 (10:40 -0800)]
Use QV4::ScopedArrayObject typedef instead of actual type

Change-Id: I975536745ac6c264aca074f84d223fbec7682d3d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse QV4::ScopedContext typedef instead of actual type
Oleg Shparber [Wed, 31 Dec 2014 18:43:46 +0000 (10:43 -0800)]
Use QV4::ScopedContext typedef instead of actual type

Change-Id: I71c6c9cf030e347fbc5e4073e9ca338a9ce95999
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse QV4::ScopedFunctionObject typedef instead of actual type
Oleg Shparber [Wed, 31 Dec 2014 18:42:15 +0000 (10:42 -0800)]
Use QV4::ScopedFunctionObject typedef instead of actual type

Change-Id: I6b4effaa5bef992b4ae9402eea7fe655bc7b18f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse QV4::ScopedString typedef instead of actual type
Oleg Shparber [Wed, 31 Dec 2014 18:34:52 +0000 (10:34 -0800)]
Use QV4::ScopedString typedef instead of actual type

Change-Id: I64ecbf6cea463387a70e909ecc5f9165d22a7b0f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix build: include <qdatastream.h> before using QDataStream
Thiago Macieira [Fri, 19 Dec 2014 03:58:58 +0000 (19:58 -0800)]
Fix build: include <qdatastream.h> before using QDataStream

Change-Id: I779e0cd705f664368b47763d4367b9dc377c1770
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove unused variable
Lars Knoll [Tue, 30 Dec 2014 14:52:06 +0000 (15:52 +0100)]
Remove unused variable

Change-Id: I399e66822f52e35d122d3a20bb8de20206e5864d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoAdd a direct accessor to retrieve the JS engine from the ExecutionEngine
Lars Knoll [Tue, 30 Dec 2014 14:31:09 +0000 (15:31 +0100)]
Add a direct accessor to retrieve the JS engine from the ExecutionEngine

Change-Id: I2617143e39f354657e12541f3796a583e9934118
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoReduce v8engine dependency in the type wrapper
Lars Knoll [Tue, 30 Dec 2014 14:21:16 +0000 (15:21 +0100)]
Reduce v8engine dependency in the type wrapper

Change-Id: I3a50aa3c0929c14ad856463635bf2fb2188f5c9f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoReduce v8engine dependency in qv4include
Lars Knoll [Tue, 30 Dec 2014 14:13:29 +0000 (15:13 +0100)]
Reduce v8engine dependency in qv4include

Change-Id: Idc50e7ed9e0de5c8742688c8493c2124075450ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine dependency in fromVariant conversions
Lars Knoll [Tue, 30 Dec 2014 10:54:59 +0000 (11:54 +0100)]
Remove v8engine dependency in fromVariant conversions

Change-Id: I3427129dc7a0e68c8fa0b61f353835e2bee179a0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove v8engine dependency in toVariant conversions
Lars Knoll [Tue, 30 Dec 2014 10:39:53 +0000 (11:39 +0100)]
Remove v8engine dependency in toVariant conversions

Change-Id: I0f2f77c9cc268a0c5ca3ffe0cd66fc98bb1964b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoDo not cause SegFault when importing empty javascript
Nobuaki Sukegawa [Sun, 14 Dec 2014 17:33:05 +0000 (02:33 +0900)]
Do not cause SegFault when importing empty javascript

Change-Id: I31f6571e73b5dd74bf3ade5cadc2daa02475b5cb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoEnable gadget wrapping for custom value types
Simon Hausmann [Thu, 20 Nov 2014 09:42:34 +0000 (10:42 +0100)]
Enable gadget wrapping for custom value types

[ChangeLog][QtQml] Custom C++ value types annotated with Q_GADGET are now fully
accessible in the QML and QJSEngine JavaScript environment.

QJSEngine::toScriptValue can be used for injection and fromScriptValue to
extraction. The QML "built-in" gadget wrappers for QPoint and the gui types are
not exposed this way, toScriptValue(point) will still return an opaque QVariant
wrapper. We could expose the core types right away, but then we would be
lacking an API to enable use of the Gui types that are registered in QtQuick.

It would be better to make the core types in qtbase gadgets and thus enable
them without the need for hooks and init functions to be called by the user.

Task-number: QTBUG-29769
Change-Id: I8179cd599bdc1209ff61cfdbdda419cb400296bb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoRemove v8engine dependency from qv4serialize.*
Lars Knoll [Tue, 30 Dec 2014 10:15:18 +0000 (11:15 +0100)]
Remove v8engine dependency from qv4serialize.*

Change-Id: I5b4c1247286bf18c96df3b68b7bae9feefbbdbc9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoDon't store a v8engine pointer in qqmllistwrapper
Lars Knoll [Tue, 30 Dec 2014 09:59:43 +0000 (10:59 +0100)]
Don't store a v8engine pointer in qqmllistwrapper

Change-Id: I21b055deb74aafff8b2ee1cdce776e06f154dcaa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoRemove unused enum value
Lars Knoll [Tue, 30 Dec 2014 09:59:13 +0000 (10:59 +0100)]
Remove unused enum value

Change-Id: I1e1a34a974cea129fcf4513c0a163254d6c114cd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix constructions of QJSEngine objects
Lars Knoll [Thu, 1 Jan 2015 15:33:04 +0000 (16:33 +0100)]
Fix constructions of QJSEngine objects

The private class is not empty anymore, so calling the wrong
constructor would lead to memory corruption

Change-Id: I6d477fc63bba46be733273f548397c2a50ef2bf4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMake QV4::Value::isNaN() inline
Oleg Shparber [Tue, 30 Dec 2014 22:11:59 +0000 (14:11 -0800)]
Make QV4::Value::isNaN() inline

Change-Id: Ia80d3b150822ec9b3965c981d58660567ca73ec1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQV4::InternalClass: reserve space for transitions.
Robin Burchell [Thu, 18 Dec 2014 11:43:18 +0000 (12:43 +0100)]
QV4::InternalClass: reserve space for transitions.

Profiling of allocations shows that this is one of the most frequent allocators.

Change-Id: Iae0350c61bfe37381577642b9a93064377f45c1d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoMake QQmlPropertyCache available in QJSEngine
Simon Hausmann [Thu, 20 Nov 2014 08:07:52 +0000 (09:07 +0100)]
Make QQmlPropertyCache available in QJSEngine

The QQmlEngine has two containers for property caches, one for QML types and
one for all-purpose meta-objects. The latter is rather useful and now being
moved to QJSEngine to be available there.

Change-Id: Ieab65c400b8a2e410e5f9eee6d603162dbb864d9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoPrepare for QQmlPropertyCache to become available in QJSEngine
Simon Hausmann [Thu, 20 Nov 2014 07:56:36 +0000 (08:56 +0100)]
Prepare for QQmlPropertyCache to become available in QJSEngine

The cache is seemingly tied to QQmlEngine, but it isn't. A lot of
times a QQmlEngine parameter is unnecessarily dragged around and the
engine member is option as well as it turns out.

Change-Id: Iffd2a5046e9785249689ebfcbc8a0ad509f76aea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix build on MinGW
Konstantin Ritt [Tue, 2 Dec 2014 15:33:39 +0000 (19:33 +0400)]
Fix build on MinGW

- alloca() needs malloc.h
- crtdbg.h couldn't be found on MinGW

Change-Id: Ibbf91a58d39ef1e2572baae3c409393acf7aa5df
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoRemoved usage of QQmlValueType in QQmlValueTypeWrapper
Simon Hausmann [Wed, 19 Nov 2014 17:12:21 +0000 (18:12 +0100)]
Removed usage of QQmlValueType in QQmlValueTypeWrapper

QQmlValueType doesn't have anything really necessary :). Some code it has, but
that was only called from the wrapper, so it was moved there. This also reduces
one level of memory allocation for the wrapper.

In theory the allocation for the JavaScript wrapper could be changed to be the
size of the wrapper _plus_ the size needed for the gadget. However in
anticipation of wanting to be able to move objects, we can't do that as we
can't memmove() gadgets around - they might contain pointers to memory areas
within.

Change-Id: Icb5a6f5513e3b2c87f6639f6f7b1fb572af08137
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoMake QV4::CallData::argument() method constant
Oleg Shparber [Sat, 27 Dec 2014 07:13:54 +0000 (23:13 -0800)]
Make QV4::CallData::argument() method constant

Change-Id: Id2640f6a0c08069764baeac606a25fdb53b23419
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agosupport XMLHttpRequest sync mode
Tasuku Suzuki [Sat, 29 Nov 2014 16:40:42 +0000 (01:40 +0900)]
support XMLHttpRequest sync mode

[ChangeLog][QtQml][XMLHttpRequest] Supported synchronous requests

Change-Id: Ia38fcf97f212a14657bb519240d8406368a72390
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoPrepare method invocation in QObject bindings for gadget support
Simon Hausmann [Fri, 14 Nov 2014 20:53:20 +0000 (21:53 +0100)]
Prepare method invocation in QObject bindings for gadget support

In order to support calling invokable methods in gadgets from JavaScript, the
wrapper code needs to be able to operate on gadgets and not only QObject
pointers. The minimal abstraction for that - QQmlGadgetOrObject - is passed
through the relevant invocation methods in the wrapper for that.

Change-Id: I94f939c942241f49dce4d32d05bf24822b2d331b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoMove methodParameterTypes and methodReturnType helper functions
Simon Hausmann [Fri, 14 Nov 2014 20:39:08 +0000 (21:39 +0100)]
Move methodParameterTypes and methodReturnType helper functions

These can extract the type information from either a property cache (through
QQmlData from a QObject) or (fallback) from a QMetaObject.  The difference
between a QMetaObject and a QQmlPropertyCache is what QQmlMetaObject abstracts
and therefore we can move the functions there.  This is in preparation for
gadget support and also avoids the repeated QQmlData::get() dance but allows
the re-use of a QQmlMetaObject instance in the future to do that dance only
once.

Change-Id: Ibff6ce498d09fabc97e0801653edc5b1ff446c6a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoReduce dependencies on QQmlValueType being a QObject
Simon Hausmann [Tue, 18 Nov 2014 18:21:07 +0000 (19:21 +0100)]
Reduce dependencies on QQmlValueType being a QObject

Don't rely on caching the property cache in the QQmlData of the value type,
instead we can cache is in the engine and store it in our object data.

Change-Id: I5f31313c066cd7918caf33e3fabdf5aac71f1adb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoPhotosurface example: scale and rotate the frame, not the image
Shawn Rutledge [Tue, 9 Dec 2014 09:41:47 +0000 (10:41 +0100)]
Photosurface example: scale and rotate the frame, not the image

The size of the border around the image could otherwise change
dramatically, because the PinchArea was zooming the image.
It's conceivable that the frame could follow the image in scale and
rotation, but that doesn't work as long as the image is inside the
frame, because changing scale and rotation of the parent affects the
child too.  So it follows that the scale and rotation of the image
should never be directly set.  This helps the apparent size of the
white border around each image to be visually consistent.  Another
advantage is that the the image centroid doesn't tend to move,
so compensation is not necessary.

Change-Id: Ib7767e369097b32f006274add73ac544aedaf839
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
9 years agoFurther value type wrapper cleanups
Simon Hausmann [Tue, 18 Nov 2014 17:41:45 +0000 (18:41 +0100)]
Further value type wrapper cleanups

Removed the QV8Engine * member in QQmlValueTypeWrapper.

Change-Id: I37cc131a3ff0279240b227c11a6b74bfc7bf4960
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoBegin cleaning up QQmlValueTypeWrapper
Simon Hausmann [Tue, 18 Nov 2014 16:28:40 +0000 (17:28 +0100)]
Begin cleaning up QQmlValueTypeWrapper

Get rid of the objectType member. Instead of checking for it and then
static_cast'ing to the specific class, it's easier to use Managed's as<>
template cast.

Also elimiate the QVariant value member for ValueTypeWrapperCopy. In fact, the
entire class is folded into ValueTypeWrapper itself as d()->type has the one
copy of the data.

Change-Id: I0d9c794400095830540d313187623b98b686f4cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoCleanup: Fix value type wrapper class name
Simon Hausmann [Tue, 18 Nov 2014 16:15:10 +0000 (17:15 +0100)]
Cleanup: Fix value type wrapper class name

It's supposed to be QQmlFoo instead of QmlFoo. While all this code is being
touched, we might as well fix the name.

Change-Id: Ia8be0c6ec46e114f7559c1e7a07a9d368932999e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoFix QQmlProperty to work correctly with deeply nested objects.
Michael Brasser [Fri, 12 Dec 2014 03:18:00 +0000 (21:18 -0600)]
Fix QQmlProperty to work correctly with deeply nested objects.

Don't keep reusing the top-level object to look up nested properties.
This allows code such as the following to work correctly:

PropertyChanges {
    target: myObject
    textChild.font.pixelSize: 24
}

Change-Id: I39e52dbc20d2409fc756a36e668fcf664eb1905f
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoInitial work on gadget support
Simon Hausmann [Mon, 10 Nov 2014 10:39:03 +0000 (11:39 +0100)]
Initial work on gadget support

Changed built-in QtQml value types to use gadgets. This is in preparation for
supporting external gadgets.

This replaces the mostly direct inheritance of the concrete value types with
gadgets and "dynamic" inheritance through QQmlValueType being generic. Over
time as some of the value types may become gadgets, we can remove the ones
here. It's important that these "separate" gadgets have the same memory layout
as the actual types (QPointF, etc.).

Also while QQmlValueType remains practically a singleton, it's not required
anymore to be one. Consequently the JS wrappers for value types keep their own
instance of QQmlValueType. This allows eliminating the qobject_cast in various
places that dealt with the singleton nature. This comes at a cost, making the
JS wrappers slightly heavier. However that is meant to be a temporary situation
and finally the value type wrapper should merely store the meta-object in
addition to the data and the type.

Change-Id: I15071ded0a1e54203f29ec1ecf7a9ab646d1168e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
9 years agoAdd files generated by tests to gitignore
Nobuaki Sukegawa [Sun, 14 Dec 2014 17:57:45 +0000 (02:57 +0900)]
Add files generated by tests to gitignore

Change-Id: I1fac4df1e00cbe37c0c9ea69562dffc1eb4d5111
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoResolve type names inside guard property of SignalTransition
Nobuaki Sukegawa [Sun, 14 Dec 2014 10:31:25 +0000 (19:31 +0900)]
Resolve type names inside guard property of SignalTransition

SignalTransition's guard is evaluated against ad-hoc QQmlContext because
it needs signal args added to its contextProperty.
Since QQmlContext created this way does not have import type cache, we
could not use type names inside guard.
To avoid this problem, this patch makes guard's context inherit parent's
type cahce.

Change-Id: I4ddd559779681b53d4ee42f4820d05438addb5ac
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMake Managed inherit Value
Lars Knoll [Tue, 18 Nov 2014 20:22:44 +0000 (21:22 +0100)]
Make Managed inherit Value

This completes the first milestone towards being able to move
objects across the GC heap.

Change-Id: I8e6ce90254ea767188a31f0dc85b133534c87eb0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoMake Property uses GC safe
Lars Knoll [Mon, 15 Dec 2014 07:46:38 +0000 (08:46 +0100)]
Make Property uses GC safe

Change-Id: I5aa41a07a2d25e5c8a2d64bfa58a55fcd7aaf77e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoStore a heap object in the qmlextensions
Lars Knoll [Fri, 12 Dec 2014 11:35:52 +0000 (12:35 +0100)]
Store a heap object in the qmlextensions

Change-Id: I5ad9236378ff1e037945d024ee5bd6629dddec4d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoStore a pointer to a heap object in the context wrapper
Lars Knoll [Thu, 11 Dec 2014 11:24:52 +0000 (12:24 +0100)]
Store a pointer to a heap object in the context wrapper

Change-Id: I2555e3e78e429260129d83894ca94d158c5e1704
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse pointers to Heap object to avoid recursion
Lars Knoll [Thu, 11 Dec 2014 09:55:32 +0000 (10:55 +0100)]
Use pointers to Heap object to avoid recursion

Change-Id: If491b35ba43758bd4792166f7213cd5a11d227d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoUse Scoped values a bit more consistently
Lars Knoll [Wed, 3 Dec 2014 09:42:50 +0000 (10:42 +0100)]
Use Scoped values a bit more consistently

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 <simon.hausmann@digia.com>
9 years agoReturn a Heap object from the getter()/setter() methods of Property
Lars Knoll [Wed, 3 Dec 2014 09:42:07 +0000 (10:42 +0100)]
Return a Heap object from the getter()/setter() methods of Property

We actually need to put the returned value into a ScopedFunctionObject
before calling it, as the Property could get deleted during the call
leading to a dangling pointer. With a GC that moves objects this will
become even more important.

Change-Id: I43bece6f80eb3501c1291065846e230a59ae8aed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoQQmlJS::Codegen: Short circuit in qmlErrors to avoid QUrl allocation costs.
Robin Burchell [Fri, 19 Dec 2014 19:45:55 +0000 (20:45 +0100)]
QQmlJS::Codegen: Short circuit in qmlErrors to avoid QUrl allocation costs.

This takes the time taken in qmlErrors for my (admittedly terribly morbid)
testcase from ~104ms to ~1ms.

Change-Id: I288086caa6e6b58f67e9feb6f1761c3310f01ead
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix crash when setting proto to 0
Lars Knoll [Tue, 2 Dec 2014 13:04:44 +0000 (14:04 +0100)]
Fix crash when setting proto to 0

Change-Id: Id0621c51466721c503f1a54156e21e1671a13561
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix JSON stringification to work with heap objects
Lars Knoll [Tue, 2 Dec 2014 11:54:53 +0000 (12:54 +0100)]
Fix JSON stringification to work with heap objects

Change-Id: Ifbd7332602d67daa945da5ebbca797d0045aff68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix Context::getPropertyAndBase to use Heap based objects
Lars Knoll [Tue, 2 Dec 2014 11:46:20 +0000 (12:46 +0100)]
Fix Context::getPropertyAndBase to use Heap based objects

Change-Id: I4f885a8af5e963445959871b7f26f3bcb3dfa654
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
9 years agoFix comparisons between Object pointers
Lars Knoll [Tue, 2 Dec 2014 11:23:49 +0000 (12:23 +0100)]
Fix comparisons between Object pointers

Change-Id: Icedbe32984b5b8bcb807411aa9945436b4bffca9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>