Prevent concurrent access to v4 debugger

Without this new engines can be added to the QV4DebugService while
breakpoints are set from the debugger thread. In rare cases this leads
to a situation where the DebuggerAgent::addDebugger() doesn't see the
new breakpoint and DebuggerAgent::addBreakPoint() doesn't see the new
debugger. Thus the breakpoint will never be set.

This effect is easily reproducible by repeatedly (about 100 times)
running the setBreakpointInScriptOnTimerCallback autotest.

Change-Id: I5da27478bf579ab24f81aebabbdd321f38fae3f4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
[new compiler] Fix propagation of imported scripts for anonymous components

We must take the imported scripts from the creation context. Fixes various
errors in Qt Quick Controls.

Change-Id: I336d8ffa0537cefd4eeac15f98bbf1b0a5c784af
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
[new compiler] Fix crash in qml delegate model

qmlContext(this) is expected in re-implementations of classBegin(), so just
like the VME we have to be careful that we call it after setting the context
on the ddata.

Change-Id: I38ad8d1a4e4093368f62f9d57718de3b8cd0cfd2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
[Regression] Fix lazy binding evaluation

Commit 04774bb14c81688f86a2b31b8624bde8ebf59062 long time ago introduced the
concept of fixed order binding initialization with lazy evaluation, where a bit
is reserved for each binding that indicates whether it's been initialized the
first time or not. When reading a property on a QObject, we'd check if the
corresponding binding for the property has been initialized or not and flush
(i.e. execute) the binding if necessary.

As part of the V4/V8 clean-up, commit 1eb41200948ab414f1c47d93123b41c547a993df
removed the StoreV8Binding instruction, which made the call for setting the
this-binding-is-not-evaluated-yet bit. Nowadays we only use StoreBinding, for
which this optimization was never implemented (and not needed really). Now that
we have a unified JS code path, we need to set the pending binding bit and also
make sure that we call flushPendingBinding for any JS side property access
(accelerated or not).

Also flushPendingBindingImpl had two bugs:

   * In an attempt of trying to find the binding to flush, it could happen that
     we'd try to flush a previously destroyed binding (m_mePtr is null), so
     the b variable would remain the first binding in the object and we'd flush
     the wrong one (instead of none). Added a missing check to verify that the
     property index matches.
   * Also resetting the mePtr must be done through clear(), to ensure that the
     pointer in bindValues in the VME is also cleared, to avoid re-enabling the
     same binding again in complete();

Task-number: QTBUG-36441

Change-Id: Icdb0c8fb036051fd5d6c4d33b10cd0c0ed9a9d5c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Improve Scene Graph - Simple Material example documentation.

Change-Id: I5b77f7590c9f2cea9305014b8a9d4ab3a387eaa3
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Fix alignment exception in newCallContext on ARM

CallContext::locals was not at multiple of 8, which caused
an alignment exception on ARM. Size for the context is
also increased.

Change-Id: I136418f89945cd3fec74463659107c6dab7cad0a
Reviewed-by: aavit <eirik.aavitsland@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Avoid renderlist rebuilds in the scene graph renderer.

Transform, material, opacity and geometry changes all used to trigger
full rebuilds, which meant that very little geometry could be retained
between frames. For instance, a rotating spinner on top of a gridview
this would cause a full rebuild where nothing is retained.

This change introduces new concept to the renderer: partial rebuilding
based on render order ranges. Since the render order of nodes is
strictly defined by their position in the tree and nothing else, we
should use that for the majority of rebuilds. When a change comes in
for a node, we invalidate its batch and all batches which it has
overlapping render orders with.

Render order rebuilds only happen when nodes are added and removed.

Change-Id: Ib4cb284164892b409e3fff5c492a54d60a5de2d7
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Doc: Merge duplicated example directories

examples/quick/customitems contains all the examples found in
examples/quick/ui-components, plus 2 more (maskedmousearea and
painteditem). There are some very minor differences between the
duplicated files, regarding the "smooth" property. Apart from that, the
examples are identical.

The only file that is unique to examples/quick/ui-components is
example-slideswitch.qdoc. Moving it does not change the generated HTML
filename. The other examples do not produce any documentation.

Change-Id: I507d9064a60fd1f3a1469c1e423d4c0a72c7dc41
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Fix scenegraph backend API for material shaders.

Without this change, it is not possible to implement a custom renderer
(it has no way to compile or initialize material shaders).

Change-Id: Ie8778f739f3551f88f0d44ccb9769063a87ff276
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Fix memory management issue with accessors

The earlier pattern of
    Property p;
    p.setSetter(new (mm) setterFunction);
    p.setGetter(new (mm) getterFunction);
carries the risk of the second allocation garbage collecting the first one.
Consequently we need to put these values onto the JS stack, using a simple
ScopedProperty wrapper.

Change-Id: Ib29ea3b1eab95595dd6dfbb86fea282d23e3d899
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Android: Fix crash when using images in QML

Because qtdeclarative was merged back from stable and qtbase is
still lagging behind, they have become unsynchronized, causing
crashes when trying to get the device name from the platform
plugin and failing. To work around this until the merge goes
through, I've added a simple guard.

Task-number: QTBUG-36658
Change-Id: Ibc399ed325a1fbdeccad85ed8d4841edb7b2ba5d
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Add a test HTTP server as manual test.

Task-number: QTBUG-36573

Change-Id: Ib930f7c44db4170dfcff30e221c1cc7d94a13de5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Accessibility: respect password state

Better don't leak passwords via accessibility

Change-Id: Ibdb0f63101dbd71f51de6f1b8ddaceb359f01e30
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Move Referenced together with Managed

The two classes belong logically together (as the Managed base
type and a generic pointer to a Managed object).

Change-Id: I65691669a7169a4514cadf7ab3e744c090851c6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Rename Referenced to ManagedRef

First step of removing the templates here and turning this
into a class hierarchy. This is required, so we can move all
member methods into the Ref classes and make objects movable
during GC.

Change-Id: Ie14af07fd3e72a7d84a528d0042189ff12ba21bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Make the Ref classes not template based

Move to a class hierarchy that mirrors the main classes. This will
allow moving functionality over into the Ref classes, as the current
Managed classes become mainly something that holds the data. This
is required to make objects movable by the GC.

Change-Id: I4ca88ab0e5d8c88c8dc56d51937990500a33e0d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add a MoveConst instruction to the interpreter

This simplifies and speeds up loading of constants

Change-Id: I05b4f7a34abd4ed6416fa800a31debbb28b37104
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove two unused parameters from VME::run()

These parameters are not used outside the function itself
anymore, so we can safely remove them.

Change-Id: I1694481c05a9927fc78a59ffb7fec43a88e85ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simplify some runtime methods

This gives as performant but simpler code, as the first line
in toInt() checks if the value is integercompatible.

Change-Id: I15d0ade231719116ca1c6c03a86106b7f5aaa9aa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add specialized instructions for right and left shift

These give a measurable speedup as the critical code
paths are now inline.

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