Prospective fix for crashes when sorting JS arrays on Windows

std::sort doesn't seem to like sorting empty arrays, so check the
size before sorting.

Task-number: QTBUG-33658

Change-Id: I841259939ea3bf850d23c129744c322ed46a95fe
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Delay renderWindow with a timer

Add an exhaust delay to QSGGuiThreadRenderLoop. Some updates
may be done with posted events, and maybeUpdate event competed
with those, leading to partial updates and frames drawn twice.

Change-Id: I532bff692c597eeba5bbd6def89ae68c80fdd69b
Done-with: Mikko Harju <mikko.harju@jollamobile.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
TextInput: call fixup() when appropriate

[ChangeLog][QtQuick] Fixed TextInput to call fixup() on its validator
when being accepted or losing focus, and the validator reports that the
input is in "intermediate" state ie. the input should be fixed up.

Task-number: QTBUG-35128
Change-Id: I4b15406c584a9647bcf892badfaf6d845868fbf1
Reviewed-by: Liang Qi <liang.qi@digia.com>
tests: update tst_qquicktextinput

* add signal_accepted() with validator
* update signal_editingfinished() with validator
* cleanup many qWait() and etc

Change-Id: Ic0a8f1cdc4f1f811501c06513efff9b6217fc749
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Add support for accelerated property access to QML types and namespace support

* Resolve lookups in namespaces at compile time and instruct the SSA optimizer
  to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example
  access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem)
  requires neither reading the namespace nor the type.
* Add support for accelerated lookup of attached properties

Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add a QML debug config option QML_LOOKUP_HINTS to find non-final properties

This helps to optimize property access, especially for attached properties.

Change-Id: Id47a9c5f184f84ce5ab813d3b01d1a6c6031233e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Slightly accelerate access to value type properties

We can't do a fast property index based access on them, due to the inability to
read individual fields from the original object (i.e.  the logic in
QQmlValueTypeWrapper). However what we can determine and propagate is the type
information of the individual properties, i.e. that the x and y properties of a
QPointF are always doubles.

Change-Id: Iee71ece2117294b7bc0b93deb0a77d7c51148b11
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Set sampler precision in shifted distance field text shader

The precision would default to lowp and we would attempt to
call smoothstep(mediump, mediump, lowp) which was a
non-existent overload on some drivers, thus causing a compiler
failure. We can use mediump for the sampler, like in the
regular distance field shader.

Task-number: QTBUG-35122
Change-Id: Ib50325d48fe7e0d25559da97e7f53e5170f705a1
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Fix warnings: initialize Instruction variables created on the stack

GCC 4.7-4.9 are right that the "code" member is used uninitialized. In
fact, GCC 4.9 was quite assertive about it:

qqmlinstruction_p.h:538:102: error: ‘def.QQmlInstructionData<8>::<anonymous>.QQmlInstruction::instr_common::code’ is used uninitialized in this function [-Werror=uninitialized]
         static void setData(QQmlInstruction &instr, const DataType &v) { memcpy(&instr.FMT, &v, Size); } \
                                                                                                      ^

(It says "is used uninitialized" for this particular case; the "may be
used uninitialized" appears in other places)

The analysis is as follows:
 - variable declared on qqmlcompiler.cpp:1467:
     Instruction::SetDefault def;
 - type is POD, so no initialization is performed (def contains garbage)
 - on qqmlcompiler.cpp:1468 we use the variable:
    output->addInstruction(def);
 - QQmlCompiledData::addInstruction is inlined and does:
        QQmlInstructionMeta<Instr>::setData(genericInstr, data);
 - which is the call above, doing a memcpy with a source (&v) equal to
   the uninitialized "def" variable
 - result: memcpy is copying uninitialized bytes

Valgrind doesn't report this because it doesn't care about copying
uninitialized data. It will only complain if a decision is made based
on it, which we don't since the first thing we do after the memcpy is
initialize the member.

The solution is simple to not copy the common part of the
instructions. This way, we save 8 bytes of unnecessary copying and we
still keep the warning if a member of an extended instruction isn't
set.

Change-Id: I940b40ea9aa61c7386e5cced4a7865be7bfddb5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix JavaScript signal connect on alias without other handlers

The changed handlers for aliases are connected lazily in the engine.
QQmlPropertyPrivate::flushSignal is responsible for that and called in other
places, for example when installing a onSomeAliasPropertyChanged handler.
However we were missing a call to flushSignal when doing
onSomeAliasPropertyChanged.connect(...), i.e. using the JavaScript connect API.

Task-number: QTBUG-30493
Change-Id: Ia3f008626fd7af3f2cfbdd30d13fb83158bed4d5
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix accelerated property lookup on id addressed objects

For properties on id referenced objects, we can ignore the lack of the FINAL
keyword on properties, as we want the same "lexical" lookup rules like for
properties on the scope or context objects. In addition we need to initialize
the resolver on the returned temp, to ensure a successful type determination in
the use of the id object afterwards.

Change-Id: I496c942ade55aa331e6972f06b21c2c86d4b00a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Enable broken IBO fallback for Hisilicon Immersion 16 GPU

This GPU is on the Huawei Ascend D1 and exhibits crashes
in glDrawElements() when rendering scenegraph when the workaround
is not turned on.

Change-Id: Ic601d34c01e34faaa091a631cfed74c3601c9c43
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Remove old qml object creation profiling

The old way the object creation profiler works is unsuitable for
detailed profiling as it only tracks top level components.

Task-number: QTCREATORBUG-10631

Change-Id: I502d0e144f2965f5e09af8461b50b56c61de5b4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add a stack-based object creation profiler

The simple instantiate-in-context way of profiling object
creation doesn't work anymore because the VME's contexts don't
necessarily map to C++ contexts anymore. The new profiler
introduces two stacks of contexts, one for currently running
ranges (such as components) and one for ranges that will be
revived later to profile componentComplete() and similar things.

Task-number: QTCREATORBUG-10631

Change-Id: Idf19b2adf062bc9c185b3bb5ff5229381f577645
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Use the new object creation profiler in qqmlvme

There are 3 ways to create objects: "Simple", "Cpp" and "Qml". This
patch starts a new profiler whenever a new object is created.
It's assumed that everything the interpreter main loop does between
two creation instructions is related to the object just created.
The componentComplete calls are profiled by restoring saved states
of the profilers used during the creation of the respective objects.

Task-number: QTCREATORBUG-10631

Change-Id: I2645eab7ba32dfb8749cb51ec888d0f0e8fef188
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Some documentation for the VME profiler

Change-Id: Ifa36166e803e81484c6a96c732b72f0ee2412c28
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Adapt tests to new events from qqmlprofilerservice

Change-Id: I59baa1f9aa0751d4bffc6eff0332318efc6fe9a8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I4e057bf60ac718aa359750ea417377580acbfc69