Commit Graph

8872 Commits

Author SHA1 Message Date
Simon Hausmann cb0a47a48d Add support for translations in pure QJSEngine based environments
Re-add the QScriptEngine::addTranslatorFunctions API that brings back
qsTr() and friends to pure QJSEngine based environments.

The auto-test were also ported where applicable.

Change-Id: Ib03e3495ef09eeea9e4c8341061499768caed307
Sanity-Review: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-06-13 09:10:04 +02:00
Ulf Hermann 4d68155848 Properly initialize heap profiler when starting profiling
Change-Id: Ia994464b2150dc9a9185280ae0e2f8c615393310
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-12 18:13:45 +02:00
Topi Reinio 841f3e6ff7 Doc: Fix qmlclass selector used in documentation config
A recent change (46959875) in qdoc raised QML types from
subnodes to top-level nodes. This change modifies the
documentation configuration file(s) accordingly.

Change-Id: Ic457d20368979aa15b546dceaf84fa2fb2d31091
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
2014-06-11 19:57:18 +02:00
Dmitry Shachnev cf5961a8fd Add FreeBSD support to qv4targetplatform_p.h
Currently, that code only works on Linux, Windows, Mac OS X
and QNX on x86 and x86_64 processors.

Change-Id: I07f2cb4cb9b8556d4bcd681c6a1f997dc3897901
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-06-10 14:09:51 +02:00
Ulf Hermann ac56e7cda7 Javascript heap profiler
This profiler tracks every memory allocation and deallocation, by the
MemoryManager as well as the V4 VM, and exposes them as a stream of
events to the profiler service.

Change-Id: I85297d498f0a7eb55df5d7829c4b7307de980519
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 18:18:35 +02:00
Erik Verbruggen 4a127e3b2e V4 IR: Store positions for life-time intervals outside the statement.
The statement ids are now stable, so the life-time interval calculation
can re-use information calculated by the optimizer. This re-use will
be done in a separate patch.

It also allows for changes to the numbering in a non-intrusive way. This
will also come in a later patch.

Change-Id: Ie3a2e1d9e3537cc8070ff3e3007f3a5e8ca0579a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 14:50:52 +02:00
Erik Verbruggen f99ddc62ea V4 IR: add def statements to the worklist when removing uses.
When removing a phi node, add the def statement for the (previously)
used temps to the worklist. These statements might now be eligible for
further optimizations (specifically removal when there are no uses
left).

Change-Id: I05d7c7bc0a243d328b5f9d1c2dcc53a10bd7491d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 14:50:20 +02:00
Erik Verbruggen 0ee38bbecb V4 IR: replace hashes by vectors.
Speeds up the register allocation by another 20%.

Change-Id: I8c638d09e1b96f400e3e101a000bc73b02d79165
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 11:37:59 +02:00
Erik Verbruggen 564afa604e Remove copy and accidental detach.
Change-Id: Iedd751424ff0b651ba9e00a30f50e197ecd7967d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 11:37:59 +02:00
Ulf Hermann 2371ec96da Properly support all events in trace files and clean up a bit.
In particular, use both message and range type to identify events so
that we can get rid of the messy type aliasing.

Task-number: QTBUG-36953
Change-Id: I691a7501aa285f78f7ce5b7017ef50628f44fcf7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 09:51:33 +02:00
Erik Verbruggen 788b8bbff9 V4 RegAlloc: store, pass, and use life-time intervals by pointer.
By storing LifeTimeIntervals by pointer (instead of by value), other
data-structures can safely use pointers too. This removes a lot of
copies, especially in vectors that act as worklists.

Also change the order of the "unhandled" list of intervals to be sorted
in descending order. Not only is this more efficient, but it also
removes the need to reverse the results of the life-range calculation
(which produces the list in exactly this order).

This change speeds up register allocation by about 20%.

Change-Id: I6ea3dcd110f250d9ccc881753dc7392510a26d87
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-05 17:22:55 +02:00
Louis du Verdier 468a65c89e Optimize the way AnimatedImage display its content
Since QtQuick2, the AnimatedImage component is less efficient than it
was with QtQuick1, using more CPU and RAM.

This commit makes it upload when required each animation frame as a
cached texture (using QQuickPixmapCache) to speed up the component.

Task-number: QTBUG-38921
Change-Id: I7ab0b5f47ecec6cb3cdded0dd219d6acc1bc4148
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-05 14:09:31 +02:00
Simon Hausmann 8a71e2bd03 Cleanup: Get rid of the url and file name members in QQmlCompiledData
This is part of the effor of moving members from QQmlCompiledData into
QV4::CompilationUnit in order to eliminate the former in the long run.

Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-06-05 10:01:44 +02:00
Aleix Pol 722c063187 Process children first when delivering drag events
[ChangeLog][QtQuick][Important Behavior Changes] Drag and Drop events
now propagate to child items before their parents.

Change-Id: I22832d707c7cb2461eaa94d659c5cc83506def8d
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-05 03:48:39 +02:00
Simon Hausmann 11a11d1280 Merge remote-tracking branch 'origin/stable' into dev
The merge conflict is about the removal of "d1" from the register
set on ARM, but that was already done in dev in commit ddb33ee9ba

The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675e
was reverted to what it was before, per Laszlo's advice.

Conflicts:
	src/qml/jit/qv4isel_masm.cpp

Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
2014-06-04 17:02:55 +02:00
Simon Hausmann fea26bb294 Fix worker scripts with cached compilation units
Try to retrieve them from the compilation unit cache instead of from
the file system if possible. The evaluation code can be shared.

In the long run it would be nice to use the type loader here and allow for
worker scripts to have dependencies/imports. But that is a more intrusive
change given the typeloader's dependency on the engine.

Change-Id: I7f9d6be1ff31433d4b14607cf0c25acdf466ac67
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-06-04 08:27:50 +02:00
Simon Hausmann 52e07d564b Rework custom parser integration
The custom parser design used to be so that the custom parser operates on the "AST",
creates its own binary representation of the data it needs, stores it in a QByteArray
and gets that at object instantiation time. That meant serializing everything necessary.
With the introduction of the "binary" QML data structure, that process of serialization
becomes obsolete and would require extra work in the custom parsers for example for QQuickStates
to store the translation parameters.

The clean solution is to eliminate this unnecessary serialization process and
instead let the custom parsers do a verification pass at type compile time and
then simply operate directly on the QV4::CompiledData::Bindings at object
instantiation time. That simplifies the code, and allows for support of
translations throughout all list model properties.

Additionally this speeds up the creation of state objects and reduces memory
consumption. Previously a text: qsTr("foo") binding in states would result in
an actual java script binding. After this patch it is merely stored as a string
and translated at object instantiation time.

Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-06-04 08:25:52 +02:00
Paul Olav Tvete cca61d66e7 Make QQuickRenderControl usable (still private)
QQuickRenderControl needs a QQuickWindow in order to function. This
required the use of a private QQuickWindow constructor, meaning that
only friend classes of QQuickWindow could use QQuickRenderControl.

This change adds a factory function, QQuickRenderControl::createOffscreenWindow().

Task-number: QTBUG-38996
Change-Id: I92f6f1f60045934f3dd33c300352247852463c73
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 14:46:59 +02:00
Yoann Lopes 6e9b406fef Fix crash in QSGRenderContext::invalidate().
QSGRenderContext was holding pointers to QFontEngines without
increasing the font engine's ref count, allowing them to be deleted
before QSGRenderContext could make use of them.

Task-number: QTBUG-36573
Task-number: QTBUG-38313
Change-Id: I0ed28bb44882c55f330c27c23b533b7999d7e04b
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 12:51:27 +02:00
Ulf Hermann f45fe58ad2 Prevent initial clipping in Context2D
Don't set an initial clip path and only start clipping once a clip
path has manually been set.

Task-number: QTBUG-39114
Change-Id: Id277775d6eb0be87bead0e5d076f32a07ebdfe5c
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 12:51:27 +02:00
Erik Verbruggen 481447ae66 V4 IR: lower the number of memory allocations.
By using vectors indexed on temp-id instead of hashes.

Also record the order in which intervals are removed from the list of
life ranges. This order is the inverse of the list of ranges sorted by
start position. So instead of building _sortedIntervals and then sorting
them, reverse iterating over the finished intervals will do the same.

This speeds up the interval calculation by 40%.

Change-Id: If3c78496d7ca2d0e23f0a51302dcd1094dad7d4a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-03 11:54:10 +02:00
Laszlo Agocs d6f71a6b47 Recognize "in" keyword in vertex shaders
Checking only for "attribute" is not sufficient: with newer GLSL versions
"in" is used.

Task-number: QTBUG-39143
Change-Id: Ibdb5940f5aba1485ecaad2e2c4a3aa7150af6d99
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 10:34:39 +02:00
Laszlo Agocs a9019adc01 Destroy the FBO in QQuickWidget while a context is current
When creating the new FBO, it will try to restore the previous FBO
after initialization. The internal tracking of the current FBO goes
horribly wrong when a QOpenGLFramebufferObject is destroyed with
no context current. In 5.4 the problem is solved by removing the
tracking altogether. Here QQuickWidget is fixed to play nice and
destroy QOpenGLFramebufferObject always with the context current.

Task-number: QTBUG-39389
Change-Id: Ic6917696ed61f284d661a578c9c7f2e0673c412d
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 10:34:35 +02:00
Laszlo Agocs 31f0e3aa00 Fix QQuickWidget cleanup and invalidation sequence
Make sure the context/surface are still alive and current while destroying
the render control.

Task-number: QTBUG-39034
Change-Id: I6ff0069985a9121a63025bfb165493b3f003391d
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-03 10:34:29 +02:00
J-P Nurmi 6725bc8f16 TextInput: implement the new input method API
Change-Id: I8a2f66a6cfa346627394705741d2f47affcd0c2b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-06-02 22:19:17 +02:00
Ulf Hermann 9474bab37d Dump all received messages if tst_QQmlProfilerService fails
Without all the context we can't really tell what happened.

Task-number: QTBUG-39169
Change-Id: Ic5192498440a0d55c279549243dfce65f8168317
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-02 16:38:20 +02:00
Erik Verbruggen 5f52fee473 V4: teach the disassembler about VMUL, VCVT, and VCMP on ARM.
Change-Id: I2fee1d9d8c9b6437e6237388f2b0d93243fe601d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-02 16:13:21 +02:00
Erik Verbruggen bc9e86ef58 V4: support calling constants.
Consider:
  function f() {
    var a;
    a();
  }

Here the constant propagation will propagate the value for a (undefined)
to the call site. This was not yet handled, resulting in Q_UNIMPLEMENTED
warnings when running a debug build.

Change-Id: I5f85f681d975b54df7a9e00bd5b50e6f4350139a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-02 16:13:15 +02:00
Simon Hausmann 69c6d26488 Disable qmlscene and qmlplugindump when doing static builds
Both of these tools rely on the ability to load plugins in order to function.
QmlScene in particular can theoretically be used with just "QtQml" imports
and QObjects, but that's not very useful for the _scene_ type of applications
qmlscene is intended for ;-). And in a static build it can't load QtQuick.

Task-number: QTBUG-39003
Change-Id: I0d4328dc4eb5c4e3153668e65a12f8eb3757f660
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-02 15:36:11 +02:00
Erik Verbruggen b366e5509b V4 IR: make the local-with-temp substitution into a separate pass.
This makes it easier to turn it off when needed.

Change-Id: I1a9f2882dd7a1ad7bc76143e3c44e4677e49357a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-02 12:14:40 +02:00
Laszlo Agocs 2414f1675e Keep the internal state about the bound fbo up to date
When binding an FBO directly via glBindFramebuffer, the QOpenGLContext's
internal current_fbo, that is maintained by QOpenGLFramebufferObject,
becomes out of sync. This will lead to QOpenGLFramebufferObjects thinking
they are still bound.

This fix prevents ShaderEffect items in QQuickWidget from complaining
about "'recursive' must be set to true when rendering recursively". Ideally
the entire tracking of the current fbo should be removed, since it cannot
be done robustly enough, but that will likely happen in 5.4 only.

Task-number: QTBUG-38994
Change-Id: I39015d90bb2e0985d2a084b79ffe2004a9bc9f07
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-02 11:00:26 +02:00
Erik Verbruggen 39c8ee0db4 V4 IR: clean up DefUses(Calculator)
Previously, the DefUsesCalculator was a pass over the IR to find all
definitions and uses of temps. This is now merged with the variable
renaming when transforming into SSA form, where all definitions and all
uses are already visited (and changed). As it no longer calculates
anything, the class is also renamed to DefUses.

The interface is also cleaned up, as are all usages. This involved some
small changes to the data-structures storing return values from DefUses.

Change-Id: I40e665f5dee6144fc81066fbf6950355ebe8dfa4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-02 10:27:07 +02:00
Bernd Weimer bc59d42e0f QNX: Fix qquicktext auto test
Change-Id: I06acf7dcd6e83c6b665163f4eb9e5ee55ecf85b2
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2014-05-30 13:01:53 +02:00
Frederik Gladhorn 67a101af14 Fix potential null pointer dereferencing
These were found by
http://www.viva64.com/en/b/025
most issues are rather cosmetic.

Change-Id: I7cc12610aae6a43d26bedb9b480863c0695ddfa3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-05-30 10:38:48 +02:00
Frederik Gladhorn 9ba195479a Fix copy and paste error
Fix first error "Null pointer dereferencing" identified by static analysis from
http://www.viva64.com/en/b/0251/

Change-Id: I984d6ac2c22fddfe5ccb507f5d95d3329bed0563
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-05-30 10:38:38 +02:00
Frederik Gladhorn 40dfda760f Fix AccessibleAttached property documentation
Task-number: QTBUG-37908
Change-Id: Ib8cfa284c2be522628359f7585b0a96addfd5ed4
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-05-30 10:38:13 +02:00
Rob Hoelz cbf166d0ab Don't add the database before verification
The local storage facility exposed to QML has a bug; if you attempt to
open a versioned connection, the version is wrong, and you try to handle
that error, the connection is still stored in a connection pool, but in
an unopened state.  The next time you attempt to connect, no matter if
you have the version right or not, the database handle will complain
about being unopened.

See also http://qt-project.org/forums/viewthread/38458/

Task-number: QTBUG-38543
Change-Id: I921b94621009f4968144e1cc513c17b4924a792a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2014-05-29 09:35:49 +02:00
J-P Nurmi 0306626a4d Fix emission of QQmlListModel::rowsAboutToBeXxx() signals
Call beginInsertRows(), beginMoveRows() and beginRemoveRows() before
the change to ensure that rowsAboutToBeInserted(), rowsAboutToBeMoved()
and rowsAboutToBeRemoved() get emitted before the change as appropriate.

NOTE: This patch solves the problem for the most common use case, when
ListModel is used without WorkerScript. QQmlListModelWorkerAgent needs
similar changes in order to fix the signals when ListModel is used with
WorkerScript (QTBUG-39321).

Task-number: QTBUG-39279
Change-Id: Idec5167d70b242f6f7d8b7cff008e130afc62505
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2014-05-29 09:25:44 +02:00
Liang Jian b5cab0515b Fix QSGPlainTexture object leak
Delete m_texture in the destructor of QSGTextMaskMaterial class

Change-Id: I0f3c59d2c5f094dcbc02eafa6ed782d16315eb44
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-05-28 16:23:04 +02:00
Erik Verbruggen 4a2c3f3194 V4 IR: make statement numbering fixed and clean up statement worklists.
Every statement in the IR now gets a fixed unique number. This number
can be used to store statements or information for a statement into an
array where the number is used as an index. This removes the need for
many hashes.

In the process of changing the code the two statement worklists in the
optimizer are merged into one. A single instance can be (and is) re-used
by the various algorithms.

Change-Id: I8f49ec7b1df79cf6914c5747f5d2c994dad110b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-05-28 15:34:45 +02:00
Bernd Weimer 9bdd35b4ef Fix tst_textinput.qml
On platforms that have QT_NO_CLIPBOARD defined copy/paste/cut functions
are not available.

Change-Id: I28be021f45cd5a5fe8aaad2752d379c3eebea8cf
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2014-05-28 09:37:27 +02:00
Paul Olav Tvete 0bc54d362e QQuickWidget: Support drag and drop
Relay drag/drop events to the offscreen QQuickWindow.

Task-number: QTBUG-39167
Change-Id: Iaf59fb899d16ac96fc94f1df8c3a939e9bd0f92f
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-05-27 14:59:49 +02:00
Mitch Curtis 8d18d4d68f Fix type of AnimationController::animation in documentation.
Change-Id: I3122ba1d7e9f1c396bef347cd1fd7df8ab32ff47
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-05-27 11:27:16 +02:00
Niels Weber cc27d274f2 Photoviewer: Allow using the Android back button to go back.
Don't show back button on Android, as the system back button can
now be used.

Task-number: QTBUG-38122
Change-Id: Ia3a677f4626eaf34e23dfcc7997e4b850d8b7020
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-05-27 11:27:16 +02:00
Erik Verbruggen cc1929da58 V4 IR: replace QHash in DefUses with a vector.
Change-Id: Ibf21f5fe0f8ab035add5354f45f7869f4cdfead8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-05-27 10:29:55 +02:00
Simon Hausmann a949f79873 Fix compilation on MSVC 2008
We are using std::lower_bound on a vector where the item we search for
is of a different type than the items in the container. MSVC 2008's STL
is very happy to check all sorts of constraints and also compare the order
of items within the container. That means it tries to call the compare function
not only with the key we're searching and one item but also two items from
the container. The existing compare function can't satisfy that constraint,
so instead we'll go back to the old approach of a proper functor that
operates outside of the class scope, in order to build with older compilers.

That functor now offers all necessary overloads.

Task-number: QTBUG-38873
Change-Id: I6f350106f98cb03a4ff7e1671a84e67f629cedd3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-05-27 07:53:45 +02:00
Simon Hausmann 228fe20d82 Fix crash (failing assertion) when declaring a non-string id property
This isn't very useful QML, but the following was "legal" in 5.1:

    property int id:
    id: foo

The integer property was not set, but the object's name (id) was still set.
With 5.3 this causes a failing assertion, which shouldn't happen. We should
do the same thing as the old code in QQmlComponent::buildProperty did for
id properties: Set them only if they're of string type.

Task-number: QTBUG-38463
Change-Id: I0da58557fbfb0944f53127e0ee77117ac33ce250
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-05-27 07:53:24 +02:00
Simon Hausmann 7a5f70d6e5 Fix QQmlScriptString::isEmpty for script strings without source code
The source code is not strictly required anymore and QQmlScriptString should
return true with isEmpty() if the object is conceptually empty (not usable),
not only when the source code is empty. It can still have a valid binding id
and thus be used in QQmlExpression.

Change-Id: I777717f2217d0c46e059c382761a1044881c5978
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-05-27 07:53:01 +02:00
Oswald Buddenhagen 201c4fb670 deduplicate and decruft SUBDIRS list
Change-Id: I56266efbe1623a529c3cf3609254abda443cf940
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-05-26 21:28:57 +02:00
Simon Hausmann 91a0f71783 Fix crash when sharing data structures between 32-bit and 64-bit
The data structures in QV4::CompiledData are intended to be shareable
between different architectures (if endianness is the same). This requires
us to pack them, which is possible with MSVC and GCC (which also includes
clang)

Change-Id: I078254b9d314f60f8973a0c9404f53af41a48fb8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-05-26 21:28:35 +02:00