Commit Graph

7565 Commits

Author SHA1 Message Date
Simon Hausmann b5991ce2a6 Avoid exception checks after calls to some run-time functions
We know that some run-time functions won't thrown an exception, so this
patch annotates them with a tricked NoThrowContext* instead of
ExecutionContext*, which allows the masm isel to detect calls to them
and avoid generating the exception handling checks after the call.

Change-Id: Ida1c9497edda14f26e1d6389b0144f6abeeba654
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 23:01:30 +01:00
Simon Hausmann aff3202b9f Avoid unnecessary saving of the instruction pointer in the JIT
We only need to save it when the line number changes, not for each and every
call.

Change-Id: I1a6fdf97abd3dd654bbd97d2a99cd09e9c20f64f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 23:01:27 +01:00
Simon Hausmann 2c078cc291 Improve debugging of QML expressions
Add the name of the property to the generated IR function ("expression for x")
to make it easier to debug.

Change-Id: If35f42764774e6d7f40d3bf080e1fbdb12321ed5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 23:01:24 +01:00
Gunnar Sletta b7f6382b1e Say hello to the scene graph sanity-tests for rendering
Change-Id: I5d975735b0975f284b8aee15541f208e3deb704f
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-11-01 22:57:27 +01:00
Liang Qi 50a3ddcbbf tests: fix tst_qqmlmoduleplugin::incorrectPluginCase()
It gives different error message based on the case sensitivity of
the file system on Mac.

Task-number: QTBUG-32652
Change-Id: I52415126e63978c9f80b7652e0116e0e07703fd8
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-11-01 21:18:56 +01:00
Erik Verbruggen 599b70c51b V4: make Scope uncopyable.
Copying will result in a dangling pointer.

Change-Id: I7f7e0df87326f43cf0ee5da6562726a5e3d2ca9c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 17:53:07 +01:00
Richard Moe Gustavsen f82e2df554 QQuickWindowPrivate: implement clearFocusObject
Ref change: cfa85c7 (qtbase)

Implement QQuickWindowPrivate::clearFocus()
to enable platform plugins to remove focus from the
focus object when the virtual keyboard closes.

On mobile platforms line edits etc are not supposed to
be drawn with focus and blinking cursors unless the
virtual keyboard (or another keyboard) is open. With the
new virtual QWindowPrivate::clearFocus() the
platforms can remove focus without deactivating the
whole window.

The old implementation on iOS deactivated the whole window
when the keyboard was closed. But this was unfortunate,
especially in QtQuick, since a qquicktextinput would
not get active focus unless the window was active. But
the platform would not activate the window unless the
keybaord was open. So, a classic chicken - egg problem.

Change-Id: I62e652a3cd85f1313713c5d086d9537cc2f9826f
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2013-11-01 17:53:07 +01:00
Lars Knoll 51a2943c01 Fix a bug in the inserting setters
Make sure we have allocated enough storage for
properties before writing them.

Change-Id: I3232ad1c4f17c21b48e8b444dc9ca604745dc799
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-01 16:05:25 +01:00
Lars Knoll c542686675 Don't assert on (++1), rather throw a ReferenceError
Also fix up the generated string for the reference error.

Change-Id: I327a8eb682017297a799f8bae650267727039616
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-01 16:05:21 +01:00
Simon Hausmann 13ebff257c Fix valgrind errors in tst_qqmlecmascript::revision
The QML code looks like this:

    MyRevisionedClass {
        prop1: prop2
    }

and MyRevisionedClass is C++ based. We need to return an initialized value when
reading prop2.

Change-Id: I33792c04aa1ba0d8e38c1351b8fb4de7abbe4891
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 16:05:08 +01:00
Tobias Hunger e1d2cafc06 Fix build using clang
Change-Id: I59ceac7b3b68a92f128b0ee78076182d191e09e9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-01 12:29:44 +01:00
Frederik Gladhorn a7415035ed KeyNavigation should use forceActiveFocus
It would only set focus which works fine as long as the target is in the
same FocusScope. But as user one would expect that the target actually
receives the focus. Using forceActiveFocus is sensible since the current
item needs to have the "activeFocus" anyway and within the same focus
scope setting focus=true on another item will take away the active
focus.

Task-number: QTBUG-34209

Change-Id: I824f15fd0d4d42eb2f0c6c1b02660f2e007b3362
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2013-11-01 12:25:04 +01:00
Gunnar Sletta 5b05a78d00 Added private API for enabling sharing between the QQuickwindow instances.
This API is primarily a hook which is needed by the Qt WebEngine to
set up sharing with the scene graph's OpenGL contexts.

Change-Id: I5bb03abd9ab99f502db8e413fe838a8b30365b8d
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
2013-11-01 12:00:18 +01:00
Gunnar Sletta 2192e5005b Fix rendering bug with batched translucent elements.
When one item in a batch of other translucent items would
change opacity, we need to rebuild batches under the current
root as all items in a batch are expected to have the same
opacity.

Task-number: QTBUG-34311
Change-Id: I2b9db19f05bd3a82be65cfa8a91e9398e8d58d0f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-11-01 11:59:53 +01:00
Alan Alpert 0d5ef23ee7 Fix qml runtime when loading files that imported other files
QQmlComponent::setData does not perform any URL processing. Consequently
when using that function we need to 'normalize' the URLs ourselves to
ensure that the engine finds them acceptable.

Task-number: QTBUG-34301
Change-Id: Ia0f3a51129423020f7e4d7003ca356af3f89b441
Reviewed-by: Antti Piira <apiira@blackberry.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2013-11-01 08:06:15 +01:00
BogDan Vatra 6ecf0f00dd Fix compile.
Change-Id: Iee1280462bec296de1ff2f7572cfc98035195235
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-01 08:05:38 +01:00
Simon Hausmann bbc36ebbc3 Speed up lookups of imported scripts
The QQmlContextData stores the JS objects of imported scripts in a
QList<PersistentValue>. Instead of indexing into that list, this patch changes
ctxt->importedScripts to be a JavaScript array, that in the IR we can index via
subscript.

Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 21:49:21 +01:00
Liang Qi 7d850df7e6 tests: replace nokia with qtproject in tst_qqmlmoduleplugin
Change-Id: I674da7f77dde380fb0772d5077da84de875b6ce8
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-10-31 20:16:11 +01:00
Lars Knoll 02a8fc6249 Optimize string additions
QV4::String can now either hold a pointer to a QStringData,
or a pair of pointers to a left and right string. This
reduces the overhead of an addition to allocating a new
GC'ed object.

To avoid huge chains of linked strings, we use a depth counter,
and flatten the string once the depth reaches 16.

Change-Id: If7192b8a9f67f0e36a9a8ea34a156c5222f127f4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-31 20:16:11 +01:00
Lars Knoll a02863c6ce Optimize lookup code
Simplify code slightly and allow the compiler to
generate more efficient code.

Change-Id: I2fbb060dc8969cf17813157d9c15e088a61e5de4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-31 20:16:11 +01:00
Simon Hausmann f0ad3a5943 Implement loading of resolved imported scripts
We can resolve the use of names that refer to imported scripts at compile
time and load them at run-time by index through context->importedScripts.

Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 18:55:14 +01:00
Simon Hausmann b0afac3daf Implement setting of values to resolved QObject properties
After the resolution of a property, we can set it by index at run-time instead
of via name resolution.

Change-Id: I479599dabe343cf9e6582dcda12291aebfcce418
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 18:54:59 +01:00
Gunnar Sletta c7a3089c14 Be consistent when checking for blocked subtrees.
This code was a leftover from before we started sending notifications
for changes in QSGNode::isSubtreeBlocked. It would accumulate opacity
and return blocked for nested blocks, even when
QSGNode::isSubtreeBlocked would return non-blocked. The result is that
the renderer would not respond correctly to DirtySubtreeBlocked and
would not add/remove shadow nodes for that subtree.

Change-Id: Iea83e89c6da4d0a3cb3ee7ea74cd96b7cda9fd6d
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2013-10-31 16:01:25 +01:00
Kai Koehne ce3e8f93c3 Fix compilation with Mingw.org headers
Mingw.org (gcc 4.7.2) does not provide an implementation of
localtime_r. Anyhow, the localtime() in the Windows runtime
is thread safe, so we can use localtime() instead.

Change-Id: I387e0dcc22e519777fa9ceb9ad6a8b030d0438c1
Task-number: QTBUG-34038
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-31 16:01:21 +01:00
Simon Hausmann b566c9121c Propagate bool/int/double/string types from QML into the IR
... by mapping the property type to the IR type if possible. In an expression
like parent.width * 0.5 this avoids a to-double conversion for parent.width but
instead we can rely on the result of the property read for the width property
to always be a double.

Unfortunately integer propertyes are currently not propagated, because upon
assignment from a double we would do the ECMAScript compliant truncation while
QML actually expects a round to happen. This needs to be solved separately.

Change-Id: I9c8f58416201d406e6e11d157cae12a686b774e5
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 16:01:03 +01:00
Simon Hausmann 71338b4b2f Resolve member expressions of QObject members
...when the base is a QObject property itself or an ID referenced object.

This patch resolves for example the width property in a parent.width expression
to be a per-index lookup at run-time. That requires the base ("parent") however
to be a final property or come from an object where expected revision is known, i.e.
a QML imported object (scope or context).

Change-Id: Iaa1f57ace452da5e059c1d4e63b52b316e1a6b08
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 16:00:58 +01:00
Shawn Rutledge 76684fd3ed QtQuick.Dialogs DefaultFontDialog: visual improvements
Layout is taller and less wide, by putting weight, style and sample
below the other list views.  It's more resolution-independent and
looks reasonable by default on Android.  Renamed Others to Style.
Made column headings bold.  Text in selected ListItem delegates
are in a contrasting color.  Delegates are taller so they are
easier to select by touch.

Task-number: QTBUG-34157
Change-Id: Ia0c96c8556835d689d3c2fd5e2c0d34e421aff76
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-10-31 13:17:46 +01:00
Simon Hausmann 04bd467271 Fix hanging debug engine auto-tests
* Move the debugger agent to the same thread as the debug service. It cannot
  live in the gui thread where it is created.
* When the debugger is paused, resume immediately for now. This should be removed
  once the "counter" part propertly responds to V4_BREAK and resumes us through
  a separate message.

Change-Id: I64ea5a4e95c07763dd87736fbc72fc8927a669e3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-10-31 13:09:05 +01:00
Sean Harmer 426f6aa672 Refactor shaders into seprate GLSL source files
The default implementation of QSGShaderMaterial::vertexShader() and
fragmentShader() now loads the GLSL source from a list of source files
that can be specified via the setShaderSourceFile() or
setShaderSourceFiles() functions.

Multiple shader source files for each shader stage are supported. Each
source file will be read in the order specified and concatenated
together before being compiled.

The other places where Qt Quick 2 loads shader source code have
been adapted to use the new QSGShaderSourceBuilder, which is also
used internally by QSGMaterial.

This puts Qt Quick 2 into a better state ready to support OpenGL
core profile and to load different shaders based upon OpenGL version,
profile, GPU vendor, platform, etc.

Change-Id: I1a66213c2ce788413168eb48c7bc5317e61988a2
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-10-31 12:54:28 +01:00
Simon Hausmann 34c85bb56c Initial support for resolving meta-property access for the scope and context objects at QML compile time
This avoids having to do a string lookup for ids and in the import cache at
run-time, before we can do a string hash lookup in the property cache. Instead
we resolve final properties in the context and scope object at compile time and
look them up at run-time using their index instead. The dependencies to these
properties are also tracked separately and recorded in the compiled data.

This is merely the initial patch. There's a lot left to do, such as having
specialized getter and setters for specific property types. Setters are missing
altogether right now and will fall back to name lookup.

Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 10:50:38 +01:00
Simon Hausmann bb7d26ebb0 Fix crash in QObject tree destruction
This issue was discovered while running the QtQuick Controls auto-tests
in valgrind. The issue is that the QObject based property in the VME meta
object is deleted as a child, after its parent (that had the property)
was deleted. At that point it's not safe anymore to emit the notify signal
in the already-deleted object (m_target->object).

Change-Id: I54e81dfedb6e712b8cbf182a72254e33e82910e3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-31 10:50:31 +01:00
Alan Alpert 2c750b4570 Load image data on main thread
QQuickPixmap use should be done on the main thread, if not it can lead
to an exception when creating the file loading thread (owned by the
engine).

Change-Id: Id59cec4312ecdee537dcba85778bd90ea4433b2e
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-10-30 23:33:08 +01:00
Shawn Rutledge 639553f024 QtQuick examples make use of the new pixelDensity property
Change-Id: I273fc08405724158fbf7c7d410bfa38fef4600b1
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
2013-10-30 15:29:59 +01:00
Shawn Rutledge 7af741357b QtQuick.Dialogs DefaultFileDialog: visual improvements
Make spacing of controls consistent with the other dialogs.  It was
too conservative for high-resolution displays anyway.

Change-Id: I095d0c8f136b6692cc9c4ac01db748dbef205867
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-10-30 15:29:47 +01:00
Shawn Rutledge 8ff9b182b3 QtQuick.Dialogs MessageDialog: use Flow for button layout
On mobile platforms the dialog can have more buttons than horizontal
space to show them, so it's better to let them wrap around to ensure
they are all visible.  But Flow does not try to maximize its
implicitWidth, so we have to calculate it at the right time before
showing the dialog.

Change-Id: I5667aa90539f291ae040f2e125abc2dea968f9ac
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-10-30 15:29:38 +01:00
Shawn Rutledge d4ba7223a8 QtQuick.Dialogs: fake window decoration clips, is opaque for touch
This is the wrapper for dialogs on platforms that don't have top-level
windows.  Mouse events over any unused area in the dialog would fall
through to the surrounding mouse area and close the dialog.  Now they
don't.  Clipping is enabled to ensure that dialog contents don't
overflow the "window" frame.

Change-Id: Ia3c0ae44bb47d46981daac9febd4cc93228dd20f
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-10-30 15:29:32 +01:00
Shawn Rutledge 5e4fc4b97a QtQuick.Dialogs: handle more keyboard shortcuts
The Back button on Android should close the dialog, but there is a bug
that Qt only receives the release, not the press.  Otherwise Esc should
do the same, Enter should accept, it should be possible to copy the
text from the MessageDialog, copy colors to and from the ColorDialog,
etc.

Change-Id: Ib4d4c58cde9f4bb00ce3d46e2f9ea1aad9d52bb0
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-10-30 15:29:18 +01:00
Gunnar Sletta 4a7f1326e3 Work around Nouveau driver bugs
Change-Id: I25311a2bd88f41087352e0a43ba505f4e27b7e85
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2013-10-30 15:18:33 +01:00
Jan Arve Saether 388fc07cf2 Don't let contentItem be FINAL in order to allow shadowing.
For subclasses that adds menubars, toolbars etc, the plan is to expose
another item (the item excluding the menubars, toolbars) as a
contentItem.

Task-number: QTBUG-32443

Change-Id: Id12fc50efde3fdf363e4528dd5de17177ddef24f
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2013-10-30 15:06:21 +01:00
Lars Knoll 0a3e9a41b1 Remove the last C++ exceptions from QtQml
Also clean up and compile the repository with exceptions
disabled again.

Change-Id: I653ae89353284b2f4ab884384f8ea6a5d100785d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 12:16:25 +01:00
Liang Qi 64eadc4aab Test: qmltest/fontloader were fixed
The commit 3745b0ca126f46eadfeeb7e3d1d53360dbf800cd resolved this
issue.

Task-number: QTBUG-32650
Change-Id: I084b326c19e7c0de303b05b2f3fb788c380a1ba0
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-10-30 09:37:59 +01:00
Lars Knoll af5dc0d9d8 Fix a regression introduced in I6e141a425c2b4cc0cd64c7f0011e7028b9147f69
Change-Id: I34840795cf280f6872a330e4949062f3ee692afa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 08:29:49 +01:00
Lars Knoll b59751b146 Use lookups in the interpreter
Implement lookup calls for the interpreter. This
significantly reduces overhead by avoiding repeated
name lookups on the same object type.

This doubles the speed of quite a few of the v8
benchmarks, and brings the interpreter up to close
to 40% of the speed of the JIT.

Change-Id: Ie8c2f5b1ca71a7329bc643c3d2158a6301a392ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 08:29:49 +01:00
Lars Knoll 928a7d3e3e Optimize some unops and binops for moth
Optimize unops for ints/bools and add some
special binops where one side is constant.

Change-Id: I4f5639e36458560e5614371733abaafd94909ab1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 08:29:49 +01:00
Lars Knoll 53a6d572e5 Moth: Inline a couple of binops
This gives another 10-15% for v8-bench

Change-Id: Iaea90402179813af23008c35d344fa7f5353cf5f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 08:29:49 +01:00
Gunnar Sletta 906d5c5c40 Use one render loop per QQuickWindow
See the task for the full reasoning behind this patch.

The threaded renderloop has been refactored to have one window per
thread. This is mostly a simplification of the current code path where
for loops over multiple windows are turned into if (window).

The QSGContext has been split into two classes, QSGRenderContext
for which there is one per OpenGLContext.

The rest of the patch is name changes and a couple of cleanups
in the hopes of simplifying this change.

Task-number: QTBUG-33993

Change-Id: I31c81f9694d7da7474a72333169be38de62613c4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2013-10-30 08:29:49 +01:00
Shawn Rutledge c084d32d92 qml tool: compiles with clang
The error was that app can be uninitialized if the switch goes into
the default branch.

Change-Id: Ic690e1dd257cf88ee04d019b5b81121cecb48564
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-10-30 08:29:49 +01:00
Alan Alpert 2f26ea3637 Fix qqmllocale test
Test was only passing the time to the format function, thinking it was
the only part under test, but the date is also relevant due to DST being
part of the formatted output.

Task-number: QTBUG-34406
Change-Id: I1f542b58907281632ee3c96b9b5b38426936953e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-30 06:55:43 +01:00
Simon Hausmann 1fc951da6a Cleanup QML specific JS code generator
Move parameters global to the entire QML file to the constructor, pass
component/context specific parameters to the generate function.

Change-Id: I6c3ab41b3bab19b066bbe20f971c5cafaeb70b98
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-29 23:05:33 +01:00
kakadu 4d33a38f4b Fix adding created objects to instantiator.
Before all new objects were pushed into the end of QVector,
i.e. if item model changes object with low index newly created object
will be added like it has big index. So, removing objects from
instantiator was buggy.

Task-number: QTBUG-33847.
Change-Id: I49fba53a40fce72060b629f737c10b525c67cc86
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2013-10-29 23:04:18 +01:00