New scenegraph renderer and atlas textures.

The renderer tries to batch primitives together where possible, isolate
non-changing subparts of the scene from changing subparts and retain
vertexdata on the GPU as much as possible. Atlas textures are crucial
in enabling batching.

The renderer and atlas texture are described in detail in the doc page
"Qt Quick Scene Graph Renderer".

Change-Id: Ia476c7f0f42e1fc57a2cef528e93ee88cf8f7055
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Fix crashes when running tst_qqmlecmascript::importScripts with aggressive gc

In the case of imported JavaScript files, it may happen that we parse the JS once
and then re-use it across different places where it is imported. That means we
parse and compile the JS once, keep the QV4::Script around and call it as a function
closure with different qml global objects (contexts), depending on where it is
imported from.

In this situation it is possible that the QV4::Script's run() is called once, a
new function object is created, we call it to return the JS library to "eval"
itself into the qml scope and afterwards it may happen that the function object
is garbage collected.  It is at this point possible that the compilation unit's
refcount therefore also drops to zero, and thus subsequent calls to
QV4::Script::run() that create new QQmlBinding objects will access a dangling
compilationUnit pointer.

This patch fixes that by making QV4::Script - which is holding a QV4::Function
pointer - also have a persistent, which maintainers a refcount on the
compilation unit.  If the script dies, the persistent will get collected and
the last deref will delete the unit. A script can however outlive the engine,
but PersistentValue has the mechanism built in to free itself on engine
destruction, which will also deref the unit accordingly.

Change-Id: I0a7f4e64497bde423ffa55c705af55cdb7d29cf2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Temporarily collect a map of all functions in the engine

At the moment we collect a lot of compilation units (one per binding
expression!), which for long running QML accumulates and creates a horrible
performance when trying to retrieve back traces. There is work in progress
to reduces the number of units down to one per QML file, and then the
fixed sorted QVector might proof to be a more efficient data structure
for the lookups.

But until that code lands, this patch proposes to use a QMap instead for the
time being, that tracks all functions. This brings down the qtquickcontrols
auto-test run from 2.5 minutes to just under a minute on my machine.

Change-Id: I45bf609055877081daa984de90f291a030f2f24f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>