platform/upstream/qtdeclarative.git
10 years agoFix qv4jsir_p.h warnings
J-P Nurmi [Wed, 4 Sep 2013 08:56:00 +0000 (10:56 +0200)]
Fix qv4jsir_p.h warnings

Apparently CONST is not defined on MSVC 2010, so the unbalanced
push/pop macro usage leads to tons of such warnings:

qv4jsir_p.h(922) : warning C4602: #pragma pop_macro : 'CONST' no
previous #pragma push_macro for this identifier

Change-Id: Ia34ef00e79b4f7a3abf682e1e78dfa3193e30838
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
10 years agoFix a crash in Function.apply()
Lars Knoll [Tue, 3 Sep 2013 12:41:08 +0000 (14:41 +0200)]
Fix a crash in Function.apply()

Change-Id: Ida44280b9d5408285de63841a17cd1491e52f977
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
10 years agoRevert "Temporarily pin qtbase to a working version..."
Simon Hausmann [Tue, 3 Sep 2013 07:16:51 +0000 (09:16 +0200)]
Revert "Temporarily pin qtbase to a working version..."

This reverts commit 57c81a2b4b67bc001a28060527325f4016e42ffb

qtbase should be fixed now

Change-Id: I8179509d7549955ee9f78b3213f59c3a1f5e5c59
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoOptimize String.replace and RegExp.exec
Lars Knoll [Mon, 2 Sep 2013 12:25:15 +0000 (14:25 +0200)]
Optimize String.replace and RegExp.exec

This speeds up the v8 regexp benchmark by a factor 2.5 :)

Change-Id: Ibd6b18ee28181aa712429cbec4598984e0c69820
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimize ScriptFunction::construct() and creation of FunctionObjects
Lars Knoll [Sun, 1 Sep 2013 19:22:57 +0000 (21:22 +0200)]
Optimize ScriptFunction::construct() and creation of FunctionObjects

Change-Id: I7df04171a26cbe659e85f14878cc4e51030e8a5a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInline identifier lookup where it makes sense
Lars Knoll [Sat, 31 Aug 2013 22:47:28 +0000 (00:47 +0200)]
Inline identifier lookup where it makes sense

Change-Id: I42ac6f4232fec2ce1535a007007542d8cc116433
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUse Q_ASSERT instead of assert to get rid of the checks in release builds
Lars Knoll [Sat, 31 Aug 2013 22:46:51 +0000 (00:46 +0200)]
Use Q_ASSERT instead of assert to get rid of the checks in release builds

Change-Id: Ia4b5bda273d44ec4c25ba955018a0f6fe220551e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimize Function.apply()
Lars Knoll [Sat, 31 Aug 2013 22:46:14 +0000 (00:46 +0200)]
Optimize Function.apply()

Change-Id: I693413e7be5520e13139594f7654a36ce54a59ce
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimise property lookups on primitive types
Lars Knoll [Fri, 30 Aug 2013 12:39:40 +0000 (14:39 +0200)]
Optimise property lookups on primitive types

This gives a large speedup on code such as "foo".charAt(2), or
(5.).toString().

Change-Id: I8b6c46f2f69a4b00f82048a9368d8e9baf4d89ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a small bug in ExecutionContext::getPropertyAndBase
Lars Knoll [Fri, 30 Aug 2013 11:13:28 +0000 (13:13 +0200)]
Fix a small bug in ExecutionContext::getPropertyAndBase

Don't return the activation object as base, as it's only a helper
for mutable properties in regular call contexts

Change-Id: I2c36a4aff9cf82d87f80e541b4ec21ef17e18e8d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove more usages of Object::setPrototype()
Lars Knoll [Fri, 30 Aug 2013 09:22:00 +0000 (11:22 +0200)]
Remove more usages of Object::setPrototype()

Change-Id: I33383baf14e764ce79252a100a6d769bde75331a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove more usages of Object::setPrototype()
Lars Knoll [Fri, 30 Aug 2013 07:18:03 +0000 (09:18 +0200)]
Remove more usages of Object::setPrototype()

Change-Id: I8c49f61bc85e3d98dea90bf05db1a3f22d08f7b1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup calls to Object::setPrototype()
Lars Knoll [Thu, 29 Aug 2013 19:23:04 +0000 (21:23 +0200)]
Cleanup calls to Object::setPrototype()

Rather use the correct internalClass directly when constructing
the objects.

Change-Id: I8e916f1ce8f83d291c08ca6332fe85b1f57b90b5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove prototype pointer into QV4::InternalClass
Lars Knoll [Thu, 29 Aug 2013 12:31:32 +0000 (14:31 +0200)]
Move prototype pointer into QV4::InternalClass

The prototype is actually the same for most objects. By
moving it into the internal class, we can save 8 bytes
per object, as well as allowing for some future
optimizations.

Also fix a bug in the implementation of the Error
prototype objects.

Change-Id: I4d4b641055f644a9b088f27be34bfdb0446279b7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd the object's prototype to the InternalClass structure
Lars Knoll [Thu, 29 Aug 2013 11:24:38 +0000 (13:24 +0200)]
Add the object's prototype to the InternalClass structure

Change-Id: Ifa97d3354a7a7afadf70f9ba540716bd5b1eef44
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused arvument from Object constructor
Lars Knoll [Thu, 29 Aug 2013 11:06:22 +0000 (13:06 +0200)]
Remove unused arvument from Object constructor

Change-Id: I2c26bd8af9b352baed9b84a6b6401633ded4da85
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused variable
Lars Knoll [Thu, 29 Aug 2013 10:58:30 +0000 (12:58 +0200)]
Remove unused variable

Change-Id: I163baea9105c6241a7d162a7e7468a70a29b3eaf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused constructor
Lars Knoll [Thu, 29 Aug 2013 10:58:18 +0000 (12:58 +0200)]
Remove unused constructor

Change-Id: Ibba688aea338c9f3deb33ae7488b7239ec9a485c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some bugs in the code generator
Lars Knoll [Wed, 28 Aug 2013 07:06:34 +0000 (09:06 +0200)]
Fix some bugs in the code generator

arguments can't be used as lvalue in strict mode. We however also threw
an error in some cases where it was used as an rvalue, e.g. in
(arguments < 10)
the delete operator should throw a syntax error in strict mode on all
unqualified variables
Optimize the identifier() code a little: arguments and local variables
inside eval do not need to be looked up by name.

Change-Id: If3e9305187acf72820c5164aa9754927a2c4d5d5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd Value::isNullOrUndefined()
Lars Knoll [Tue, 27 Aug 2013 12:41:47 +0000 (14:41 +0200)]
Add Value::isNullOrUndefined()

Allows for some smaller optimization in the call stack.

Change-Id: Id5beeb04e9f9dbf9e61280cee7bf6758a4c02310
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix incorrect implementation of Array.toString()
Lars Knoll [Wed, 21 Aug 2013 17:06:10 +0000 (19:06 +0200)]
Fix incorrect implementation of Array.toString()

The spec says we need to call join with empty arguments if it's
callable, otherwise fall back to Object.toString()

Change-Id: I36aed164b60fad89b7d23b8a6993964c344a9ed3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agochange calling convention for JS function calls
Lars Knoll [Wed, 21 Aug 2013 15:31:22 +0000 (17:31 +0200)]
change calling convention for JS function calls

This allows faster pass through of the data if we have
nested calls.

Also make sure we always reserve at least
QV4::Global::ReservedArgumentCount Values on the
stack to avoid stack corruption.

Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agomove methods to create a new context into the ExecutionContext class
Lars Knoll [Wed, 21 Aug 2013 13:00:09 +0000 (15:00 +0200)]
move methods to create a new context into the ExecutionContext class

This avoids one indirection when calling the methods and cleans up
the engine a bit.

Change-Id: I426f41e23f6a7262af95b9807b00920530fef642
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd a SimpleScriptFunction class
Lars Knoll [Wed, 21 Aug 2013 12:52:15 +0000 (14:52 +0200)]
Add a SimpleScriptFunction class

Choose whether we use a stack based context for a function, when
the actual closure is generated, not at call time. This speeds up
function calling for leaf functions.

Change-Id: Ibcbf3acb5610a7f59b6474e982122df03c1c5298
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove call context creation into the ExecutionContext class
Lars Knoll [Wed, 21 Aug 2013 08:32:50 +0000 (10:32 +0200)]
Move call context creation into the ExecutionContext class

Change-Id: Ie66a5892b0e5ab74bead1fcb59ffad5a867e0509
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoTemporarily collect a map of all functions in the engine
Simon Hausmann [Fri, 30 Aug 2013 08:29:16 +0000 (10:29 +0200)]
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>
11 years agoFix crashes when running tst_qqmlecmascript::importScripts with aggressive gc
Simon Hausmann [Mon, 26 Aug 2013 13:25:47 +0000 (15:25 +0200)]
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>
11 years agoNew scenegraph renderer and atlas textures.
Gunnar Sletta [Wed, 14 Aug 2013 05:27:07 +0000 (07:27 +0200)]
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>
11 years agoMake sure text is output to console on windows
Jan Arve Saether [Fri, 30 Aug 2013 13:59:23 +0000 (15:59 +0200)]
Make sure text is output to console on windows

Change-Id: I33a8a000fb14e2006475c54f3c5bc4e2dd8f0751
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
11 years agoFix the header guard for the ARM unwinder helper
Thiago Macieira [Sat, 31 Aug 2013 00:04:19 +0000 (17:04 -0700)]
Fix the header guard for the ARM unwinder helper

Make it match the file name, instead of being exactly the same as the
DWARF2 header. This way, it's possible for both headers to be included.

Change-Id: I9a386d3203c8f1482d28b1d1074206cf354db33e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRename the DW2 and ARM unwinder helpers to standard _p.h
Thiago Macieira [Sat, 31 Aug 2013 00:01:32 +0000 (17:01 -0700)]
Rename the DW2 and ARM unwinder helpers to standard _p.h

The Qt convention is that private headers end in _p.h. A great deal of
our build automation relies on this, including the choosing of which
headers to install and which ones not to.

Change-Id: I03ab6021e0a8a68d5a9cbc9d9387a9c5331f7bb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix bad cast from non-const QMap iterator to const_iterator
Thiago Macieira [Fri, 30 Aug 2013 23:56:14 +0000 (16:56 -0700)]
Fix bad cast from non-const QMap iterator to const_iterator

At that point in the ARM unwinder, the non-POD QMap global static (!)
is not const, so QMap::lowerBound returns a regular iterator.

Change-Id: Ia4dad7ee1a9cf593b0e1d273d193337fac7d9b69
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix generation of headers by syncqt.pl outside git builds
Sergio Ahumada [Fri, 30 Aug 2013 12:01:51 +0000 (14:01 +0200)]
Fix generation of headers by syncqt.pl outside git builds

This seems to be a left over from 3cefb43441a9879cc512dc3fcc7dca0d42e9ca8c

Change-Id: Ib229c69e42140e073b9dd375d0fc2ede658c4ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoTemporarily pin qtbase to a working version...
Simon Hausmann [Mon, 2 Sep 2013 06:32:06 +0000 (08:32 +0200)]
Temporarily pin qtbase to a working version...

... so that we can continue to develop while qtbase is being fixed to
allow compiling qtdeclarative on mac with no-framework debug builds.

Change-Id: I2e1f4c1b82560a2f49205035aaca3078f9d28061
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agowince: Build fix, assert() is not present in this platform.
Sérgio Martins [Thu, 29 Aug 2013 09:17:12 +0000 (10:17 +0100)]
wince: Build fix, assert() is not present in this platform.

Change-Id: Ib29f1411b9829bc9bf6a94e4fb23a33f955ee1b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agowince: Build fix, disable the assembler when JIT is disabled.
Sérgio Martins [Thu, 29 Aug 2013 08:35:34 +0000 (09:35 +0100)]
wince: Build fix, disable the assembler when JIT is disabled.

Change-Id: Ibd22f27401c3751bc64749c6f1eea3aba57d66eb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGenerate code for conversion to signed int32.
Erik Verbruggen [Fri, 23 Aug 2013 13:10:36 +0000 (15:10 +0200)]
Generate code for conversion to signed int32.

Change-Id: I862a8c9c262b658859cc9b57ea0b6e9eb60e32e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGenerate code for conversion to boolean.
Erik Verbruggen [Wed, 21 Aug 2013 12:13:46 +0000 (14:13 +0200)]
Generate code for conversion to boolean.

Change-Id: I59e24264325b6560ee1c0dbdafacb1f08c3671d5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoqmltest: Add QTestDefinedVariables
Caroline Chao [Fri, 23 Aug 2013 10:57:03 +0000 (12:57 +0200)]
qmltest: Add QTestDefinedVariables

QTestDefinedVariables is used by the QTestRootObject to check
is a preprocessor variable is defined.

Adding QT_OPENGL_ES_2_ANGLE. It can be useful to know
if it is defined (Win32 + Angle) while running a test.

Change-Id: I2f9ffb1028c94095c711ab64737b53b60c055312
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
11 years agoqmltest: Register test object as a singleton
Caroline Chao [Thu, 22 Aug 2013 11:13:00 +0000 (13:13 +0200)]
qmltest: Register test object as a singleton

Change-Id: I5f6c404ff2901082f22b953b29aed08d3488f31d
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
11 years agoV4 regalloc: fix off-by-one in availability calculation.
Erik Verbruggen [Tue, 27 Aug 2013 13:13:03 +0000 (15:13 +0200)]
V4 regalloc: fix off-by-one in availability calculation.

Simplified the algorithm, and use it to iterate over all registers. The
previous version did not initialize bestReg correctly, thereby skipping
the first register (which could also be the best one).

Change-Id: I7e33f93a27e8fe64cd00acac755cf67ca5f0b1b8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoV4 regalloc: do not overwrite register availability in hole.
Erik Verbruggen [Tue, 27 Aug 2013 13:10:51 +0000 (15:10 +0200)]
V4 regalloc: do not overwrite register availability in hole.

When a fixed interval for a register is inactive, the register is free
until that interval becomes active, or (and this was missing), until
another interval uses it before that position. So instead of blindly
overwriting the freeUntilPos, take the qMin of the existing one with
the intersection position.

Change-Id: I2730a748ef1e46b4782fbb9814e800eca52172f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agowince: Build fix, abort() is not available on this platform
Sergio Martins [Sun, 25 Aug 2013 19:13:55 +0000 (20:13 +0100)]
wince: Build fix, abort() is not available on this platform

Change-Id: I0962f8b89de465d84d913b46ba482a538fe25495
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGenerate code conversion to double.
Erik Verbruggen [Wed, 21 Aug 2013 11:45:24 +0000 (13:45 +0200)]
Generate code conversion to double.

Performance improves by about 15% on fact.3.js when Qt is build in
debug mode.

Change-Id: I4a1c868fe211c1e0f9e7d9a5652f7726b37405d1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agowince: Build fix, CONST conflicts with Windows macros.
Sérgio Martins [Wed, 28 Aug 2013 07:44:52 +0000 (08:44 +0100)]
wince: Build fix, CONST conflicts with Windows macros.

Don't #undef system macros in header files, they propagate quickly
through other headers and make it very difficult to fix these problems.

Change-Id: Id5efdfa69d0eefa8c740b14f839194039bd9752b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix unused variable warning
Kai Koehne [Mon, 26 Aug 2013 09:50:33 +0000 (11:50 +0200)]
Fix unused variable warning

Fix gcc warning: unused parameter ‘newEffect’

Change-Id: If4ca8058b5b637518a868947226c834d571f7037
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoQQuickPlatformFileDialog: fix directoryEntered() signal connection
J-P Nurmi [Tue, 27 Aug 2013 14:49:51 +0000 (16:49 +0200)]
QQuickPlatformFileDialog: fix directoryEntered() signal connection

Task-number: QTBUG-33008
Change-Id: I8c4d06bb9dded7b894ca576efd0a64dce9f9a720
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
11 years agoThe fast and the furious, register drift.
Erik Verbruggen [Fri, 23 Aug 2013 12:40:33 +0000 (14:40 +0200)]
The fast and the furious, register drift.

Enable the register allocator for X86_64 on Linux and MacOS. The
implications are:
- handle as much as possible with current code with as few changes as
possible
- temporarily force the register allocator to spill unop/binop arguments
to the stack by doing a call in the implementation (as is the current
case), so no change is needed here
- only have loadThis and loadConst handle registers
- have any method that might need to handle registrers actually cope
with them
- the inline versions of binops are not generated, as they cannot cope
with registers. This will change when ISel for binops is added in the
next patch.

This means that we are still running with the handbrakes on, but allow
for full-throttle in certain/limited cases.

Note about the changed test: multiplication always returns a Number
(double), so the operands are passed as doubles, so __qmljs_mul will
return a double. For addition this is different: because it might return
a Number or a String, the operands are passed as whatever fits best. So
__qmljs_add will return an int when both operands are ints. Hence the
change to the tests.

Change-Id: If5bd7dffca8f7de5ba45af700b9c7bb568fc74b7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImprove reliability of propertyVarOwnership test
Simon Hausmann [Tue, 27 Aug 2013 10:11:18 +0000 (12:11 +0200)]
Improve reliability of propertyVarOwnership test

In the last expect-to-collect-a-QObject test, avoid calling gc() from within
JavaScript and call it from C++ instead with zap stacking. That reduces the
probability of finding an old reference on the stack that would keep the
object alive.

Change-Id: Ia9c66dd188f31264a70ad4dbd20356d16aa7a057
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agowince: vsnprintf is not available, use qvsnprintf
Sergio Martins [Sun, 25 Aug 2013 14:53:12 +0000 (15:53 +0100)]
wince: vsnprintf is not available, use qvsnprintf

Change-Id: I42c87b2c319ce5b530ac5dc673edc99b067fafd7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
11 years agoSilence MinGW/gcc-4.8.1 compiler warnings.
Friedemann Kleint [Mon, 26 Aug 2013 13:07:38 +0000 (15:07 +0200)]
Silence MinGW/gcc-4.8.1 compiler warnings.

Reorder V4::Object's and V4::Value's private object inline functions
such that its definitions are visible from where they are being
referenced.

qv4object_p.h:418:13: warning: 'uint QV4::Object::arrayLength() const'
redeclared without dllimport attribute after being referenced with dll
linkage

qv4object_p.h:430:13: warning:
'void QV4::Object::setArrayLengthUnchecked(uint)' redeclared without
dllimport attribute after being referenced with dll linkage

Change-Id: I49a3c9d1da637eaf038f53b29ec13c35253de9f1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInterpreter fixes.
Erik Verbruggen [Fri, 23 Aug 2013 10:18:41 +0000 (12:18 +0200)]
Interpreter fixes.

- Support constants in phi-nodes
- Fix possible null-pointer dereference.

Change-Id: I7cb773f1b4469d1cda648317670d9993d5b35ca3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAllow for function declarations inside conditionals
Simon Hausmann [Thu, 22 Aug 2013 07:24:19 +0000 (09:24 +0200)]
Allow for function declarations inside conditionals

This is strictly speaking a regression from 5.1/v8, which allows for that
as real world JavaScript appears to require it.

Task-number: QTBUG-33064
Change-Id: Iceaca84373f12fb08459ed007afb25b5a705fa31
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDon't crash with deferred properties
Alan Alpert [Wed, 21 Aug 2013 20:21:03 +0000 (13:21 -0700)]
Don't crash with deferred properties

There are cases where a qmlExecuteDeferred(o) can be postponed until the
context of o is being destroyed, at which point it's too late to create
an object in that context.

Task-number: QTBUG-33112
Change-Id: I7f981b5e34e3cb8a52c00de4742a7242d7e4df54
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoTestLib: Fix regression in error location output
Caroline Chao [Thu, 22 Aug 2013 11:44:49 +0000 (13:44 +0200)]
TestLib: Fix regression in error location output

Error location returned should be given in the test file not in
TestCase.qml.

Change-Id: Ifea51fe5e39890a369c4dca6754abd46d2ee9bc2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup: Rename overloaded () operators of CodeGen to more descriptive function names
Simon Hausmann [Tue, 6 Aug 2013 12:18:57 +0000 (14:18 +0200)]
Cleanup: Rename overloaded () operators of CodeGen to more descriptive function names

Change-Id: I529c3d5c80ed7f703046a2803c492c4b15511049
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCleanup: Separate JS environment scanner class declaration from definition
Simon Hausmann [Tue, 6 Aug 2013 11:59:47 +0000 (13:59 +0200)]
Cleanup: Separate JS environment scanner class declaration from definition

This will allow the use of it from outside.

Change-Id: Ia05a17b4b4f3e772554979e215a6252a75a63273
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation with MSVC 2008 (and prospective Windows CE build fix)
Simon Hausmann [Tue, 20 Aug 2013 11:38:15 +0000 (13:38 +0200)]
Fix compilation with MSVC 2008 (and prospective Windows CE build fix)

* Only 2010 and newer ship stdint.h, so for 2008 we have to provide a little
stdint.h compat header, for some of the third-party code we import. Our own
Qt code this patch changes to use quint* types instead.

* Include math.h and float.h for some math functions.

* disable the JIT on Windows CE for now.

* Change use of intptr_t to qintptr in Qt code. intptr_t is in inttypes.h,
  except that with VS 2008 it is indirectly available through stdio.h. Let's
  avoid the mess and just use the qt type, that's always available.

Change-Id: I19055edd89e0a6b147d9edbb3b711798ed3c05a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoProspective build fix for shadow builds with MSVC
Simon Hausmann [Wed, 21 Aug 2013 08:33:19 +0000 (10:33 +0200)]
Prospective build fix for shadow builds with MSVC

Don't rely on MSVC's slightly different semantics of #include with quotes,
simply include the header files from the other directory through the
syncqt generated wrappers that always work.

Change-Id: Idebb4121e4a14732494613e9b5bc383a8f52fb00
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
11 years agoChange convertUInt32ToDouble to use an int scratch register.
Erik Verbruggen [Thu, 15 Aug 2013 11:49:40 +0000 (13:49 +0200)]
Change convertUInt32ToDouble to use an int scratch register.

Only on X86, and still untested.

Change-Id: I746daa47ed019ce0017a67a228a719983b1ebaa6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMerge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative into dev
Simon Hausmann [Tue, 20 Aug 2013 14:54:29 +0000 (16:54 +0200)]
Merge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative into dev

Conflicts:
src/qml/compiler/qv4codegen.cpp
src/qml/compiler/qv4codegen_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4runtime_p.h
src/qml/jsruntime/qv4script.cpp
sync.profile

Change-Id: I1d785e2134bffac9553a1c16eed12816cbd1ad2c

11 years agoClean up one more header dependency for the compiler
Lars Knoll [Thu, 8 Aug 2013 13:18:21 +0000 (15:18 +0200)]
Clean up one more header dependency for the compiler

Change-Id: Ibf20a4031bbaa217ddf460607bb1612cb6d76efb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove QV4::DiagnosticMessage
Lars Knoll [Thu, 8 Aug 2013 14:59:32 +0000 (16:59 +0200)]
Remove QV4::DiagnosticMessage

QQmlError provides the same functionality, so let's rather
use that where required. Remove the dependency of
codegen onto the ExecutionContext that was only
required for error handling.

Change-Id: Ib0b61c0e138f89ff989c32996c93c339e4b62223
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd the constant condition evaluation optimization.
Erik Verbruggen [Sun, 4 Aug 2013 15:13:51 +0000 (17:13 +0200)]
Add the constant condition evaluation optimization.

Change-Id: I244cfb13049466b65229095fbce97dd304ebb203
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoVarious fixes to the optimizer.
Erik Verbruggen [Tue, 30 Jul 2013 14:43:10 +0000 (16:43 +0200)]
Various fixes to the optimizer.

Mainly type inference and type propagation.

Also added constant/copy propagation pass, which is disabled for the
moment.

Change-Id: I286c1fbced0d175be76868e870ca92c0da88babd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFolderListModel: count property has countChanged notifier
Shawn Rutledge [Mon, 12 Aug 2013 16:35:37 +0000 (18:35 +0200)]
FolderListModel: count property has countChanged notifier

rowCountChanged is kept for compatibility but is inconsistent with
the usual naming convention.

Change-Id: I8ae72e4783c5edbbcc63319c266ac47e8f3fc5ad
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
11 years agoQQuickWindow: handle QWheelEvent::phase
J-P Nurmi [Sun, 4 Aug 2013 22:28:25 +0000 (00:28 +0200)]
QQuickWindow: handle QWheelEvent::phase

Change-Id: Id2540caae7e5703d352d0cb115529b1be1c21d96
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
11 years agoAdd linear scan register allocation.
Erik Verbruggen [Mon, 17 Jun 2013 14:32:21 +0000 (16:32 +0200)]
Add linear scan register allocation.

Currently disabled for all platforms. Will be enabled step-by-step when
specific platforms get supported.

Change-Id: I144c6c991b1666e1ff752d776bca0a7b57a4fe7c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup: Determine the root/entry function in isel independent code
Simon Hausmann [Mon, 19 Aug 2013 06:31:35 +0000 (08:31 +0200)]
Cleanup: Determine the root/entry function in isel independent code

Change-Id: I99004b872be9bd7d9dd0c798eb2d9bb4ddfa4cbd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix ARM build
Simon Hausmann [Mon, 19 Aug 2013 10:14:05 +0000 (12:14 +0200)]
Fix ARM build

Re-add variable only needed for ARM build and replace references
to removed codeRef variables from QV4::Function.

Change-Id: Id47fe57be2aa653bd8f81996463d970f27427f37
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix class vs. struct mismatch
Simon Hausmann [Mon, 19 Aug 2013 10:12:33 +0000 (12:12 +0200)]
Fix class vs. struct mismatch

Breaks with visual studio otherwise

Change-Id: I80ce7ec269ad750e3c9a1dcfef980f57cc395461
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoProspective MSVC build fix
Simon Hausmann [Mon, 19 Aug 2013 09:57:03 +0000 (11:57 +0200)]
Prospective MSVC build fix

It seems LoadString is somehow expanded as a macro, so call the instruction
LoadRuntimeString, which is closer to the meaning.

Change-Id: I16836b495d29db8cb1af5874762c8e66acb9c529
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused references to qtjsbackend from sync.profile
Simon Hausmann [Mon, 19 Aug 2013 09:10:42 +0000 (11:10 +0200)]
Remove unused references to qtjsbackend from sync.profile

Change-Id: Ieb42537df1f1b3f16aea77b5f1d1d98eaf1d1d18
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Mon, 19 Aug 2013 07:47:35 +0000 (09:47 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
tests/auto/quick/qquickgridview/qquickgridview.pro
tests/auto/quick/qquickitem/qquickitem.pro

Change-Id: Ic54cafbdda1ac22757d2ee65dcc63a1b167c7556

11 years agoDragging MouseArea nested in Flickable does not work with touch to mouse
Martin Jones [Mon, 12 Aug 2013 03:28:17 +0000 (13:28 +1000)]
Dragging MouseArea nested in Flickable does not work with touch to mouse

A MouseArea with a drag target nested in a Flickable does not work.
This is due to QQuickWindow calling childMouseEventFilter() twice -
once in sendFilteredTouchEvent() and later in sendEvent().

Since childMouseEventFilter() has already been called, deliver the
mouse event directly in sendFilteredTouchEvent().

Task-number: QTBUG-32920
Change-Id: I22acee3c66ee6c06e71c9c876fb02dbcb6119a8d
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
11 years agoProspective build fix for namespaced Qt builds
Simon Hausmann [Sun, 18 Aug 2013 13:35:02 +0000 (15:35 +0200)]
Prospective build fix for namespaced Qt builds

Add missing QT_BEGIN/END_NAMESPACE

Change-Id: I6beed22d8d1713be99de114ba747cf5e17223591
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoOptimize setting new properties on objects
Lars Knoll [Fri, 16 Aug 2013 08:11:20 +0000 (10:11 +0200)]
Optimize setting new properties on objects

When a property on an object is set for the first time,
this triggers a change in internal class for the object.
Record that change in the lookup, and do the same transition
in the future.

Change-Id: Ib0e8ac61ce3aaecb736532600740cec51996e3d6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup: Make isel subclass the unit generator
Simon Hausmann [Sun, 18 Aug 2013 09:29:32 +0000 (11:29 +0200)]
Cleanup: Make isel subclass the unit generator

Change-Id: Iadff4974ec6fde25c6586d03d23136ea280f9555
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of engine pointer in isel
Simon Hausmann [Sat, 17 Aug 2013 18:48:56 +0000 (20:48 +0200)]
Get rid of engine pointer in isel

Change-Id: I58759712624713cd2215621dca4ccc86fa9a9194
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix invalid reads with strings
Simon Hausmann [Sat, 17 Aug 2013 12:54:56 +0000 (14:54 +0200)]
Fix invalid reads with strings

It may happen that a dynamically created compilation unit disappears before any
QV4::Strings it created. Those strings would still have a reference to the
QString data in the compilation unit. I don't see a choice other than making a
copy of the string data ;(. But this patch adds a flag that would allow for
avoiding it if we happen to know that the compilation unit data is static.

Change-Id: Ib35a4d2a566b301a25ffe56e392809e44e7b4ae8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix eval operating on incorrect runtime data
Simon Hausmann [Sat, 17 Aug 2013 10:08:21 +0000 (12:08 +0200)]
Fix eval operating on incorrect runtime data

Moved compilationUnit and compiledFunction into the context and set it also
during eval, along with the runtime strings.

Change-Id: I627b3bea0f7c38ad91bc5e8ee85e1484d08ed3f3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused overload of newCallContext()
Lars Knoll [Sat, 17 Aug 2013 11:14:51 +0000 (13:14 +0200)]
Remove unused overload of newCallContext()

Change-Id: I9b9de585b18bf87ea256db36b320a7defdcc4ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmall typo fixes.
Erik Verbruggen [Fri, 9 Aug 2013 13:37:39 +0000 (15:37 +0200)]
Small typo fixes.

Change-Id: I4aca4e02e06700738337d92ebfc18995184a31f6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFactor out protoHasArray and hasAccessorProperty
Peter Varga [Thu, 15 Aug 2013 13:54:15 +0000 (15:54 +0200)]
Factor out protoHasArray and hasAccessorProperty

The Object::protoHasArray() function returns true if any object in the
prototype chain contains an array element. The new member
hasAccessorProperty of the Managed class is set true if the object
has any accessor property.

Change-Id: Ic29d303eb058d4faed2a47ed8fab18e376ccba68
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify __qmljs_call_property_lookup
Lars Knoll [Fri, 16 Aug 2013 20:08:31 +0000 (22:08 +0200)]
Simplify __qmljs_call_property_lookup

This was still using the older (and slower) member of Lookup. Instead
call the function pointer to resolve the lookup.

Change-Id: I840b063ce4cc71f71be9be23ea7ce164887c2a91
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoNever convert the this object when calling a builtin function
Lars Knoll [Fri, 16 Aug 2013 18:40:03 +0000 (20:40 +0200)]
Never convert the this object when calling a builtin function

When calling builtin methods, the this object should should be
passed unmodified to the method. This failed so far because some
of our buitin methods where implemented slightly wrong.

Change-Id: I725f4dc952b4af6101645cf702e01b5410406a92
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove arguments object creation into the generated code
Lars Knoll [Fri, 16 Aug 2013 10:54:30 +0000 (12:54 +0200)]
Move arguments object creation into the generated code

So far we've been creating the arguments object at runtime
in initCallContext(). It's much more efficient to simply add
arguments as a local variable in qv4codegen if it's being used
and initialize it through a builtin method.

Change-Id: I6913f3565adf3aa1917adae8dceef9f50ecf1722
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimize contruction of Arguments objects
Lars Knoll [Fri, 16 Aug 2013 06:53:47 +0000 (08:53 +0200)]
Optimize contruction of Arguments objects

Change-Id: If77bff28a25462a6069d646a2594dd903fefb9e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix two small issues when construcint Array objects
Lars Knoll [Fri, 16 Aug 2013 06:52:34 +0000 (08:52 +0200)]
Fix two small issues when construcint Array objects

When constructing from a stringlist, we need to correctly
set arrayDataLen.
init() doesn't need to malloc a memberData array, as we have
4 properties stored inline.

Change-Id: Ia35bd89fe2d58b80ebba1356ba1d16f088d111e4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimize Function.prototype.apply/call()
Lars Knoll [Thu, 15 Aug 2013 14:32:05 +0000 (16:32 +0200)]
Optimize Function.prototype.apply/call()

Use a QVarLengthArray instead of a QVector for holding
the arguments that are being passed on.

Change-Id: I41500fecb1efc94ae1735adb3c631596916ed7d2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused Function::engine member and line number mapping type
Simon Hausmann [Fri, 16 Aug 2013 19:33:03 +0000 (21:33 +0200)]
Remove unused Function::engine member and line number mapping type

Change-Id: Id227139bf385aa92e539cdb0d0012e1360679c81
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMerge Function::init with the constructor
Simon Hausmann [Fri, 16 Aug 2013 19:31:24 +0000 (21:31 +0200)]
Merge Function::init with the constructor

Change-Id: I557f8a80aa2c74398b94e87ed0f29fe8d2297150
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoEliminate all vm functions on the isel side
Simon Hausmann [Fri, 16 Aug 2013 19:25:39 +0000 (21:25 +0200)]
Eliminate all vm functions on the isel side

Change-Id: I7c0e50498c937ce554b019f98829fa8c5d96c18e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUse indices into the runtime functions array instead of function pointers in the...
Simon Hausmann [Fri, 16 Aug 2013 19:04:15 +0000 (21:04 +0200)]
Use indices into the runtime functions array instead of function pointers in the isel for closures

Change-Id: Ieaf7b112f80adc3f1041cb1397db4eab55fb0184
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDoc fix
Alan Alpert [Wed, 14 Aug 2013 22:06:50 +0000 (15:06 -0700)]
Doc fix

Grammar and word choice

Change-Id: If736f1d7a6f6396101924c9357c5235605b80b43
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
11 years agoFix tst_qquickfolderlistmodel flakiness using QSignalSpy::wait.
David Faure [Fri, 16 Aug 2013 11:05:38 +0000 (13:05 +0200)]
Fix tst_qquickfolderlistmodel flakiness using QSignalSpy::wait.

The signal is emitted in a thread, so creating the spy afterwards
is racy (due to isSignalConnected() at the beginning of QMetaObject::activate).
Creating the spy before hand fixes the race, and using QSignalSpy::wait()
leads to much smaller code, in addition.
Note that the call to wait() itself isn't racy, even if it happens "after" the
signal emission: the signal goes via the event loop so it will always be received
by the main thread within the call to wait(), never before.

In addition setPath() is called once upon creation, and again via the
setProperty call. If we don't wait for the initial listing to happen,
we're replacing it, and then folderChanged is never emitted.

Change-Id: Iab7eada2e9db8ba710f05bc3b82941c782f36467
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of the functions list in QV4::ExecutionEngine
Simon Hausmann [Fri, 16 Aug 2013 16:35:29 +0000 (18:35 +0200)]
Get rid of the functions list in QV4::ExecutionEngine

Change-Id: I97067dbb2819936a1b2029c9f63f0627cb6b8bd2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRefcount the compilation unit and remove refcount from runtime function
Simon Hausmann [Fri, 16 Aug 2013 15:25:58 +0000 (17:25 +0200)]
Refcount the compilation unit and remove refcount from runtime function

Change-Id: Iaa2f96a6814f1b39589ffcfe3c84e3c229e25f1f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReduce ExecutionEngine dependencies in the moth and masm isel
Simon Hausmann [Fri, 16 Aug 2013 14:53:36 +0000 (16:53 +0200)]
Reduce ExecutionEngine dependencies in the moth and masm isel

Change-Id: Ic3d0287e15c404c5527fa6fe0dfa759631b66dd4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of QV4::Function::lineNumberMappings by porting moth to the new mapping
Simon Hausmann [Fri, 16 Aug 2013 14:43:14 +0000 (16:43 +0200)]
Get rid of QV4::Function::lineNumberMappings by porting moth to the new mapping

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