platform/upstream/qtdeclarative.git
11 years agoFix ownership of JS value returned by QJSEngine::newQObject
Simon Hausmann [Thu, 13 Jun 2013 15:10:35 +0000 (17:10 +0200)]
Fix ownership of JS value returned by QJSEngine::newQObject

As documented, the ownership should be JavaScriptOwned, which means:
Keep the QObject alive if there's a parent or some other JS object is
referencing it.

Fixes three QJSEngine auto-tests

Change-Id: I75503273b34e78355b08526da591b8d307a1c6e6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::propertyVarOwnership
Simon Hausmann [Thu, 13 Jun 2013 14:49:34 +0000 (16:49 +0200)]
Fix qqmlecmascript::propertyVarOwnership

Don't rely on o = new Date in the test-case to really clear the last "reference"
on the stack. As it turns out, in v4, we sometimes allocate the result of "new Date"
in a different slot and the old slot is still around (and thus the object is
visible and marked).

Instead work with separate scopes, which requires a little helper function in JS.

Change-Id: I5f318feaccfc7d83dbe28be043a0ee83e0c16355
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRework QObject deletion mechanism
Simon Hausmann [Thu, 13 Jun 2013 13:27:00 +0000 (15:27 +0200)]
Rework QObject deletion mechanism

Instead of the qv4mm knowing about different ways of deleting the QObjects
of the QObject JS wrappers (and their timing!), provide an interface between
the two.

Before destroying a managed object, we allow for the object to register a
Deletable instance in a singly linked list of deletable objects that will be
deleted right after the sweep, but before the gc returns to application.

This allows for a behavior that is identical with V8: When GC runs, the
QML Component.onDestruction callbacks are called _after_ the sweep but
before returning to the application. The QObject however is deleted later,
unless this is the very last run of the GC (as indicated by the lastCall
property).

Change-Id: I1a2f127f4634c7ecc8c89b45e8b0a575c0ef772e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDon't allow for a QJSValue to be taken from one engine to another through QVariant
Simon Hausmann [Thu, 13 Jun 2013 12:36:32 +0000 (14:36 +0200)]
Don't allow for a QJSValue to be taken from one engine to another through QVariant

Change-Id: I21127d22f595b0ff88f6073bddf617423ad17867
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix Array.prototype.splice to not require the instance to be a true array
Simon Hausmann [Thu, 13 Jun 2013 12:22:49 +0000 (14:22 +0200)]
Fix Array.prototype.splice to not require the instance to be a true array

Use putIndexed instead of arraySet, so that it also works with "host" arrays.
Fixes tst_qqmlecmascript::sequenceConversionArray, which calls splice on a
JS-wrapped QList<QString>

Change-Id: Ic9cbf12d625adf7c3c47ce4a7996d2623f843601
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix for..in with duplicated properties
Lars Knoll [Thu, 13 Jun 2013 15:15:57 +0000 (17:15 +0200)]
Fix for..in with duplicated properties

Properties that already appeared earlier in the
proto chain should get skipped by for..in (as they
are inaccessible from JS).

Change-Id: Ia0d9cc8582f96df4b2aaaa409d884f206456fe89
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a few spec compliance issues with Number.toExponential/Precision
Lars Knoll [Thu, 13 Jun 2013 14:13:10 +0000 (16:13 +0200)]
Fix a few spec compliance issues with Number.toExponential/Precision

Fixes an autotest in qjsengine as well.

Change-Id: I6f30d360d4f43ec50a11bed669ff84d84db59589
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix test case. QDateTime actually writes milliseconds since 5.2
Lars Knoll [Thu, 13 Jun 2013 13:36:53 +0000 (15:36 +0200)]
Fix test case. QDateTime actually writes milliseconds since 5.2

Change-Id: I21a7b63175b173a5036892dd932614a299d519c3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRevert "Simplify JS bindings generation"
Simon Hausmann [Thu, 13 Jun 2013 11:46:48 +0000 (13:46 +0200)]
Revert "Simplify JS bindings generation"

This reverts commit f227c3392beda68beb2792eb9fec467d9a0794da.

Conflicts:
src/qml/qml/v4/qv4object_p.h
src/qml/qml/v4/v4.pri
src/qml/qml/v4/v4classgen

Change-Id: I8aba402878a460ac612c853d14650efc6cb21761
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPort the QVariant wrapper away from v4classgen
Simon Hausmann [Thu, 13 Jun 2013 11:45:23 +0000 (13:45 +0200)]
Port the QVariant wrapper away from v4classgen

Replaced with four new lines of code :)

Change-Id: Ie48608d332f8eb0c5ab6615aa62e5865d307c7bd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPort the sequence (QList) wrapper away from v4classgen
Simon Hausmann [Thu, 13 Jun 2013 11:43:09 +0000 (13:43 +0200)]
Port the sequence (QList) wrapper away from v4classgen

This also gets rid of the QQmlSequenceBase base class.

Change-Id: I8cccc6c8924843ae37a4ee4ea95807f2b459d55b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoProperly implement Object.prototype.__proto__
Lars Knoll [Thu, 13 Jun 2013 12:11:23 +0000 (14:11 +0200)]
Properly implement Object.prototype.__proto__

Change-Id: I5c3247f46cd86020425f6df8674f8bda7410757b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoPort ErrorObject away from v4classgen
Simon Hausmann [Thu, 13 Jun 2013 11:20:22 +0000 (13:20 +0200)]
Port ErrorObject away from v4classgen

Not worth it for one single line :)

Change-Id: I67fa8d222f1a382c4304c7d86cae98cf7842eb6f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRevert "Ported string object over to the class generator"
Simon Hausmann [Thu, 13 Jun 2013 11:17:45 +0000 (13:17 +0200)]
Revert "Ported string object over to the class generator"

This reverts commit 678417bd473b68834747684edb6fd2b9628050b9.

Conflicts:
src/qml/qml/v4/v4.pri

Change-Id: I927514f20ec5417dd0280a3868f3a0b71b752eca
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRevert "Ported boolean prototype over to class generator"
Simon Hausmann [Thu, 13 Jun 2013 11:17:20 +0000 (13:17 +0200)]
Revert "Ported boolean prototype over to class generator"

This reverts commit b6263687dd876959379022090eb8d43a0dbcdd08.

Conflicts:
src/qml/qml/v4/v4.pri

Change-Id: Iebaad46adea26c788b541a111e881af3d305e46a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRevert "Ported RegExp object to class generator"
Simon Hausmann [Thu, 13 Jun 2013 11:14:59 +0000 (13:14 +0200)]
Revert "Ported RegExp object to class generator"

This reverts commit 551282c220a554f269ada23bf842d8d023c7395c.

Conflicts:
src/qml/qml/v4/qv4regexpobject.cpp
src/qml/qml/v4/v4.pri

Change-Id: Ib853de8427fff3c75feb11d1b4d1db91acb26b8a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoStop using v4classgen in the context2d bindings
Simon Hausmann [Thu, 13 Jun 2013 11:10:15 +0000 (13:10 +0200)]
Stop using v4classgen in the context2d bindings

Change-Id: Ib117468f2755495eab13f39d72682780a68305c0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoStop using v4classgen for QQmlLocale
Simon Hausmann [Thu, 13 Jun 2013 11:01:14 +0000 (13:01 +0200)]
Stop using v4classgen for QQmlLocale

It's easy enough now to just define the properties by hand.

Change-Id: I6a053bf22f606280d21e9985928d7c69252611d4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of memberAccessorGetter
Simon Hausmann [Thu, 13 Jun 2013 10:52:41 +0000 (12:52 +0200)]
Get rid of memberAccessorGetter

The new defineAccessorProperty is much simpler, so change v4classgen
to generate that.

Change-Id: I5578ef33c2e1735933ec6f10a23e3a69db9b1984
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCosmetic: Silence the with statement warnings, in addition to the XFAIL
Simon Hausmann [Thu, 13 Jun 2013 08:17:07 +0000 (10:17 +0200)]
Cosmetic: Silence the with statement warnings, in addition to the XFAIL

Change-Id: I8a89acc93f1446a5ef6cb8441a8ad9b48c4fb752
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix tst_qqmlecmascript::callQtInvokables
Simon Hausmann [Thu, 13 Jun 2013 06:53:34 +0000 (08:53 +0200)]
Fix tst_qqmlecmascript::callQtInvokables

Make sure to set inheritContext to true, to run the sample scripts the
same way as we run QML right now: with lookups disabled. Lookups with
custom get() don't work right now and cause the tests to fail lookup
properties in QObject.

Change-Id: I22a1133d5d568935c64fc5162445a438665713b8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix exception type when trying to assign to read-only QObject properties
Simon Hausmann [Thu, 13 Jun 2013 06:24:25 +0000 (08:24 +0200)]
Fix exception type when trying to assign to read-only QObject properties

[[Put]] throws a type error, and so should the put operation on a QObject

Change-Id: I8fad91f3969c1889381d67d8d0ff751a91f8239e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix diagnostic error message when put fails because of a read-only property
Simon Hausmann [Thu, 13 Jun 2013 05:46:26 +0000 (07:46 +0200)]
Fix diagnostic error message when put fails because of a read-only property

Change-Id: I9310c160386e9610d76ae0a8b3228b22757d5a02
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix toString lookups on QObject bindings (And thus qqmlecmascript::toObjectString)
Simon Hausmann [Wed, 12 Jun 2013 18:43:45 +0000 (20:43 +0200)]
Fix toString lookups on QObject bindings (And thus qqmlecmascript::toObjectString)

Change-Id: I20e5788e8810d9354ca51245ee05181c9f4648ae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix syntax error propagation
Simon Hausmann [Wed, 12 Jun 2013 15:03:01 +0000 (17:03 +0200)]
Fix syntax error propagation

For syntax errors we use the DiagnosticMessage type in qv4context.cpp,
that contains detailed information about the error. We must catch that
error correctly in QQmlVME::run and report it to the engine.

Change-Id: I8f53c7db8dbdc6afa72396f3c25537690a6f5841
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMark test using with statement as expected failure
Simon Hausmann [Wed, 12 Jun 2013 13:58:04 +0000 (15:58 +0200)]
Mark test using with statement as expected failure

We run QML bindings in JS strict mode now, where with is not supported

Change-Id: I7e1b2747c50f9affdb6b7cfa80287f1f198ad930
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix build errors with intptr_t
Simon Hausmann [Wed, 12 Jun 2013 13:36:52 +0000 (15:36 +0200)]
Fix build errors with intptr_t

Simply use qintptr

Change-Id: Ic99d3ea67cc95c5d15bae7080262d997cef9558e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove last traces of v8 API and v8 compatibility layer
Simon Hausmann [Wed, 12 Jun 2013 13:25:20 +0000 (15:25 +0200)]
Remove last traces of v8 API and v8 compatibility layer

The debugger and profiler service remain as bigger parts that need to
be ported properly to v4.

Change-Id: I68e72d6db66fe497eb58ed60df417ffe4662d115
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoConvert v8::Array usage in particles to V4
Simon Hausmann [Wed, 12 Jun 2013 13:02:42 +0000 (15:02 +0200)]
Convert v8::Array usage in particles to V4

Change-Id: Ib3c39903bf8f8507d68f94baea81b3bf642ce8f6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove some more v8 leftovers
Lars Knoll [Wed, 12 Jun 2013 12:43:59 +0000 (14:43 +0200)]
Remove some more v8 leftovers

Change-Id: Ie025cf45444bdf42936c588997c2baa3b0d4fd05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFinally get rid of qv8objectresource
Lars Knoll [Wed, 12 Jun 2013 12:39:48 +0000 (14:39 +0200)]
Finally get rid of qv8objectresource

Change-Id: I3f157148a71cc2f36e51eb8007bfb03cfb5d08af
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove the remaining v8 usage from the xmlhttprequest implementation
Lars Knoll [Wed, 12 Jun 2013 12:33:11 +0000 (14:33 +0200)]
Remove the remaining v8 usage from the xmlhttprequest implementation

Change-Id: Id1b9e125627a1289e8e855be3ac594139f21cf0c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoPort ParticleData to V4
Simon Hausmann [Wed, 12 Jun 2013 10:36:08 +0000 (12:36 +0200)]
Port ParticleData to V4

Change-Id: Ifc48b73a2fbfda22d3c4419cb34dd5307107f688
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoConvert most getter methods over to v4
Lars Knoll [Wed, 12 Jun 2013 09:04:35 +0000 (11:04 +0200)]
Convert most getter methods over to v4

Change-Id: I92677cb47a89319fd69ca708b1b88cf573a150ad
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert NodeList and NamedNodeMap to v4
Lars Knoll [Wed, 12 Jun 2013 07:32:06 +0000 (09:32 +0200)]
Convert NodeList and NamedNodeMap to v4

Change-Id: I7d5d02e5c7b895a748e27566b1f7a9c153b976db
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmall fix in tst_qqmlecmascript
Simon Hausmann [Wed, 12 Jun 2013 07:19:54 +0000 (09:19 +0200)]
Small fix in tst_qqmlecmascript

EVALUATE_ERROR is supposed to return true if an exception was caught

Change-Id: I8371206e4a4e9d0c3d40ef09cf61d28ed19e40aa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement iteration on QObject properties
Simon Hausmann [Wed, 12 Jun 2013 07:19:37 +0000 (09:19 +0200)]
Implement iteration on QObject properties

Change-Id: I036e3d835f1c0375460acf142738123c1728279e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix prototype chain in XHR
Simon Hausmann [Wed, 12 Jun 2013 08:41:07 +0000 (10:41 +0200)]
Fix prototype chain in XHR

Fix variable typo that caused Node::prototype to always return a null value.

Change-Id: I453685952a870c7b7ba4607a151d5b7834f553b9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix various xhr auto-test failures
Simon Hausmann [Wed, 12 Jun 2013 08:26:37 +0000 (10:26 +0200)]
Fix various xhr auto-test failures

In the v8 compatibility layer accessor wrappers, forward v4 exceptions
instead of silently eating them. We don't use the v8 TryCatch layer anymore.

Change-Id: I43596c58b6f51a481a11e33a87d5294f1336471b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix this object in constructor callbacks through the v8 compatibility layer
Simon Hausmann [Wed, 12 Jun 2013 08:18:21 +0000 (10:18 +0200)]
Fix this object in constructor callbacks through the v8 compatibility layer

Make sure that the thisObject is set, so that the XHR constructor can
set an external resource correctly.

Change-Id: Id217247cafcee42806dd75b5f461df87c296b81b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove v8 usage in two places
Lars Knoll [Wed, 12 Jun 2013 07:10:59 +0000 (09:10 +0200)]
Remove v8 usage in two places

Change-Id: I26343f3aaa89ea956a890955ce84894f96ebd67d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement query (aka hasProperty) in QObject bindings
Simon Hausmann [Wed, 12 Jun 2013 05:27:51 +0000 (07:27 +0200)]
Implement query (aka hasProperty) in QObject bindings

Fixes tst_qqmlecmascript::in() auto-test.

Change-Id: Ic42cc566f6ed8077f7aa7d75c0c92236c34c91b8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused stuff from qv8objectresource.
Lars Knoll [Tue, 11 Jun 2013 14:17:34 +0000 (16:17 +0200)]
Remove unused stuff from qv8objectresource.

Change-Id: Idb24297ff2b518cc3d928c0cf01ee9feb8223eee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRegression: Fix various failures in test262
Simon Hausmann [Tue, 11 Jun 2013 13:47:17 +0000 (15:47 +0200)]
Regression: Fix various failures in test262

The stack property added to Error objects must not be enumerable.

Change-Id: Ie163cff2d9c41997e95afa6dd32275be6b4b310d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement objectiterator on top of an iterator method in the vtbl
Simon Hausmann [Mon, 10 Jun 2013 15:11:52 +0000 (17:11 +0200)]
Implement objectiterator on top of an iterator method in the vtbl

This makes it easier to implement the array-like wrapper classes
for qml lists and qt lists.

Change-Id: I169025a3e9c76951c0778bcda4bbb1f9a8afc8a0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove the last bits of v8 usage in context2d
Lars Knoll [Tue, 11 Jun 2013 13:54:56 +0000 (15:54 +0200)]
Remove the last bits of v8 usage in context2d

Change-Id: Ie1c5adf0db1eabf36a30bcb61e353a3477533f2b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove debug output
Lars Knoll [Tue, 11 Jun 2013 13:20:11 +0000 (15:20 +0200)]
Remove debug output

Change-Id: Ic2011366d7606761f4327f1b4e92c9741a5f30ef
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the prototype method of context2d to v4
Lars Knoll [Tue, 11 Jun 2013 12:58:43 +0000 (14:58 +0200)]
Convert the prototype method of context2d to v4

Change-Id: Id00238adc3ecca8f5008ee1a1015d6b25eb29d6a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoClean-up the linearize function.
Erik Verbruggen [Mon, 10 Jun 2013 14:35:43 +0000 (16:35 +0200)]
Clean-up the linearize function.

Change-Id: I75982638dd90ceb776064b3cd0153b96523a70e1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd type conversion nodes to the IR.
Erik Verbruggen [Mon, 10 Jun 2013 14:32:48 +0000 (16:32 +0200)]
Add type conversion nodes to the IR.

Change-Id: I5a5a69ccd2e2f2f3c9f8592c4b04455d6a567e83
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the instance methods of context2d to v4
Lars Knoll [Tue, 11 Jun 2013 11:42:18 +0000 (13:42 +0200)]
Convert the instance methods of context2d to v4

Change-Id: Ic2b80ab828a0f96a72850b0672f5c085a4cfae0a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert some of the subobjects of context2d to v4
Lars Knoll [Mon, 10 Jun 2013 21:38:55 +0000 (23:38 +0200)]
Convert some of the subobjects of context2d to v4

Change-Id: I0ad5b466e65da41a7acf8a0a89e7cf26ce2df76d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the first canvas subobject over to v4 style
Lars Knoll [Mon, 10 Jun 2013 14:44:04 +0000 (16:44 +0200)]
Convert the first canvas subobject over to v4 style

Change-Id: Idb99d4081358b46df6a0b5340c9b4fa220d48e80
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd convenience method for creating accessor properties
Lars Knoll [Mon, 10 Jun 2013 14:16:40 +0000 (16:16 +0200)]
Add convenience method for creating accessor properties

Change-Id: I982cd16e6069e444a9311fe7695a56b7fbdfb161
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup: Get rid of dynamic property enumerator callbacks in QV4::Object
Simon Hausmann [Mon, 10 Jun 2013 14:29:53 +0000 (16:29 +0200)]
Cleanup: Get rid of dynamic property enumerator callbacks in QV4::Object

These are not needed anymore with the most recent portings away from v8.
Implemented Object::__hasProperty__ by means of query/queryIndexed.

Change-Id: Id02057a34c44a8c4e71912a5b5379740f09ef05d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUse QStringLiteral instead of QLatin1String
Lars Knoll [Mon, 10 Jun 2013 14:05:45 +0000 (16:05 +0200)]
Use QStringLiteral instead of QLatin1String

Also fix one place where v8::Value was used

Change-Id: I78745954fc987c7b3f247654706493d90cf91149
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't include v8.h from qv8engine_p.h anymore
Lars Knoll [Mon, 10 Jun 2013 13:59:06 +0000 (15:59 +0200)]
Don't include v8.h from qv8engine_p.h anymore

Change-Id: Idb0f5744f65b28acbe878a3e9d33b4a3946ecab8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove usage of v8 from the context2d header
Lars Knoll [Mon, 10 Jun 2013 13:52:04 +0000 (15:52 +0200)]
Remove usage of v8 from the context2d header

Change-Id: Icfcae6d55d5f912a756630d10e6a098adada0591
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8 usage from qquickglobal
Lars Knoll [Mon, 10 Jun 2013 13:39:00 +0000 (15:39 +0200)]
Remove v8 usage from qquickglobal

Change-Id: I75c803d8dd997703b64f5b75226d76cf498d03d3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8 API usage in qquickitem
Lars Knoll [Mon, 10 Jun 2013 13:18:26 +0000 (15:18 +0200)]
Remove v8 API usage in qquickitem

Change-Id: Iddea91433afaa7f269c66294a500465bd53c40cd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove two more places where we used v8
Lars Knoll [Mon, 10 Jun 2013 13:10:02 +0000 (15:10 +0200)]
Remove two more places where we used v8

Change Value::isInt32() to convert to an integer if possible.
Use this to avoid casting doubles to ints twice. usage of
v8::Value::IsInt32() in two places.

Change-Id: I5b9d8be7d90b461c11440bf54660ceef7e8f0f1b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanups
Simon Hausmann [Sat, 8 Jun 2013 11:29:40 +0000 (13:29 +0200)]
Cleanups

Remove some more QV8Engine usage and fix the header guards

Change-Id: I6894fb8b55b254406c192e7c8d0c2ac466643f43
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::enums and nonNotifyable
Simon Hausmann [Fri, 7 Jun 2013 21:21:27 +0000 (23:21 +0200)]
Fix qqmlecmascript::enums and nonNotifyable

In the v8 bindings in expressionIdentifier we used to print the url with line
number and only in the base class we printed the expression itself. With
qv8bindings.cpp gone, we can do that now in the base class, as expected by the
test.

Adjusted the test also by columns.

Change-Id: I8d532d21baf5bf2fbfcca56c2657a1d65025fe84
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix two qqmlecmascript tests (assignSequenceTypes one of them)
Simon Hausmann [Fri, 7 Jun 2013 20:43:14 +0000 (22:43 +0200)]
Fix two qqmlecmascript tests (assignSequenceTypes one of them)

In various places in the engine we do QVariant(v4Value.booleanValue()),
which unfortunately constructs a QVariant from an unsigned int.

IIRC we used Bool(uint) as type in the run-time to ensure that the compiler
allocates an entire general purpose register for JIT calls on all platforms, so
those functions remain untouched. But I think it's safe to at least change the
getters in Value, as those are never called directly from generated code.

Change-Id: Ia235141b8bcfc38403a7967436c68e73e7eee669
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::sequenceConversionBindings
Simon Hausmann [Fri, 7 Jun 2013 20:11:18 +0000 (22:11 +0200)]
Fix qqmlecmascript::sequenceConversionBindings

Adjust the expected error message with the missing column

Change-Id: Iac6be0cdf7322bfb4289925c4bb67b5b2f0437f5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix equalitySemantics sub-test in qqmlecmascript::sequenceConversionArray
Simon Hausmann [Fri, 7 Jun 2013 20:09:28 +0000 (22:09 +0200)]
Fix equalitySemantics sub-test in qqmlecmascript::sequenceConversionArray

Implement Managed::isEqualTo correctly

Change-Id: Ife4e2bf368037910614401e2ffa0c334b6581e30
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::sequenceConversionIndexes
Simon Hausmann [Fri, 7 Jun 2013 18:49:28 +0000 (20:49 +0200)]
Fix qqmlecmascript::sequenceConversionIndexes

Fix line number and source file in generated warnings

Change-Id: Id7a96f67325ad43fd88499359b41944130a46f60
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove failing test
Simon Hausmann [Fri, 7 Jun 2013 18:35:42 +0000 (20:35 +0200)]
Remove failing test

This test doesn't seem to make sense anymore, as it tested an implementation
aspect of the previous engine with the expression rewriter and v8 compilation.

Change-Id: I17a83b82080ab567431d8dc403f14f5266a81ba4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::signalWithJSValueInVariant
Simon Hausmann [Fri, 7 Jun 2013 18:31:57 +0000 (20:31 +0200)]
Fix qqmlecmascript::signalWithJSValueInVariant

Don't use arguments.callee as we're now in strict mode :)

Change-Id: I9992fd6d39a170ce6f6d751aa49393e50ca0e636
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix qqmlecmascript::nonExistentAttachedObject
Simon Hausmann [Fri, 7 Jun 2013 18:09:55 +0000 (20:09 +0200)]
Fix qqmlecmascript::nonExistentAttachedObject

Add column to the expected error message output

Change-Id: I585fdcedd7a78f1a208770765851f04ee5a5b207
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix tst_qqmlecmascript::propertyAssignmentErrors()
Simon Hausmann [Fri, 7 Jun 2013 14:59:32 +0000 (16:59 +0200)]
Fix tst_qqmlecmascript::propertyAssignmentErrors()

Implement the non-standard but yet widelysupported stack property
in Error objects, that this test requires.

Change-Id: I37effb3c918498ba0d89014fbdcac9b2f623b1fa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix a few more QJSValue autotests
Lars Knoll [Fri, 7 Jun 2013 15:53:44 +0000 (17:53 +0200)]
Fix a few more QJSValue autotests

Change-Id: Ie870da8f6b8f9e34221bbfd10f328df1dc363294
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoQJSValue::property should return the exception if one was thrown
Lars Knoll [Fri, 7 Jun 2013 12:34:41 +0000 (14:34 +0200)]
QJSValue::property should return the exception if one was thrown

Change-Id: If87af8b6562d97a490950212a455ee46631d18f6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix more QJSValue autotest errors
Lars Knoll [Fri, 7 Jun 2013 12:31:19 +0000 (14:31 +0200)]
Fix more QJSValue autotest errors

Fixes to setPrototype and setProperty

Change-Id: I72a5c754e65e4795c1c293525118191f78d91bbe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix various errors in the qjsvalue auto test
Lars Knoll [Fri, 7 Jun 2013 12:06:36 +0000 (14:06 +0200)]
Fix various errors in the qjsvalue auto test

Fix creation of Array's from a QStringList
Properly implement toVariant()
Fix VariantObject::toString()
Fix conversion of variant lists to JS values
Remove an XFAIL

Allow comparison of QJSValue objects created from different
engines. There's no reason why we can't simply do this with v4.

Change-Id: I8d8c597dbb032926501508d60bd80622ec964d67
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove the last v8 dependency from the delegate model
Lars Knoll [Fri, 7 Jun 2013 11:10:29 +0000 (13:10 +0200)]
Remove the last v8 dependency from the delegate model

Don't use a qv8objectresource for the items anymore.

Change-Id: I5aadd58bf432e0a8984234c03a369aaea92c5f9e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the qml adapter model to v4
Lars Knoll [Fri, 7 Jun 2013 05:53:21 +0000 (07:53 +0200)]
Convert the qml adapter model to v4

Change-Id: Ief02791fd5391653477b0a6031a5e8e644afcfd4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert more of the delegate model to v4
Lars Knoll [Wed, 5 Jun 2013 21:52:56 +0000 (23:52 +0200)]
Convert more of the delegate model to v4

Change-Id: Ie74d092d9e4fbe66131a61ca7e2e713ef797214d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix tst_qqmlecmascript::scriptErrors()
Simon Hausmann [Fri, 7 Jun 2013 14:20:54 +0000 (16:20 +0200)]
Fix tst_qqmlecmascript::scriptErrors()

* In the context wrapper, throw a real JS exception that when serialized
  to a string includes the "Error:" prefix (due to the error object's name)
* Added column information to one of the expected error messages

Change-Id: I4c1bc749f01425efb0a27121f7f1b8cf4946d644
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix tst_qqmlecmascript::signalEmitted
Simon Hausmann [Fri, 7 Jun 2013 13:59:55 +0000 (15:59 +0200)]
Fix tst_qqmlecmascript::signalEmitted

This test executes code in the Component.onDestruction signal handler that ends
up doing things like allocating new V4 objects on the GC heap. Since Component.onDestruction
is called (indirectly) from QV4::QObjectWrapper::~QObjectWrapper(), we have a slight
problem:

From within the destructor of a garbage collected object, _during_ a sweep, we
end up trying to allocate new managed objects. Instead of adding more
complexity to the memory manager, this patch avoids doing clever things in the
destructor, by delaying the emission of the destructed signal to the point
right before the real deletion of the QObject (which was already delayed with a
deleteLater).

Change-Id: I15d5ad36feee930745e1a3a0efb5be9a302426d3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused code from QV8Engine
Simon Hausmann [Fri, 7 Jun 2013 10:47:12 +0000 (12:47 +0200)]
Remove unused code from QV8Engine

Change-Id: Idb327cc50f0058e67f5c91d6ca35191b9ae64320
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix tst_qqmlecmascript::signalArguments
Simon Hausmann [Fri, 7 Jun 2013 10:05:42 +0000 (12:05 +0200)]
Fix tst_qqmlecmascript::signalArguments

Don't check for arguments.callee, which is only available in non-strict
mode

Change-Id: I90851862e36e5bc7c518198f9fe5672178a3ec58
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMove QV4::QObjectWrapper into the v4/ subdirectory
Simon Hausmann [Fri, 7 Jun 2013 09:21:18 +0000 (11:21 +0200)]
Move QV4::QObjectWrapper into the v4/ subdirectory

Change-Id: I1c5b3e343e259adbf2f1ff3fa7b2ff225eb9b192
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove last traces of v8:: API from QObject bindings
Simon Hausmann [Fri, 7 Jun 2013 09:02:03 +0000 (11:02 +0200)]
Remove last traces of v8:: API from QObject bindings

Change-Id: I41ed89c6a21dba67ad28f201e8f444bbcb039142
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of QV8QObjectWrapper
Simon Hausmann [Fri, 7 Jun 2013 08:47:07 +0000 (10:47 +0200)]
Get rid of QV8QObjectWrapper

Change-Id: I3205a85cb9163d7b51cc58ba17f9056a2d50451c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of QV8QObjectWrapper:setProperty and SetProperty
Simon Hausmann [Thu, 6 Jun 2013 14:11:23 +0000 (16:11 +0200)]
Get rid of QV8QObjectWrapper:setProperty and SetProperty

Fold it all into QV4::QObjectWrapper::setQmlProperty and remove
a lot of otherwise unused code.

Change-Id: Ic28233fa7d4df898ff39ac065044319e01d47b88
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify QObjectWrapper calls from within other type wrappers
Simon Hausmann [Thu, 6 Jun 2013 13:59:41 +0000 (15:59 +0200)]
Simplify QObjectWrapper calls from within other type wrappers

... with the help of a getQmlProperty static function.

Change-Id: Ia823ba9ac995cb1a0591081bf18418f48d60e04d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of QV8QObjectWrapper::GetProperty
Simon Hausmann [Thu, 6 Jun 2013 13:18:03 +0000 (15:18 +0200)]
Get rid of QV8QObjectWrapper::GetProperty

Fold it completely into QV4::QObjectWrapper::getQmlProperty

Change-Id: I95093ce0b3d56a3a0b641f57ce2232bb5d4f0091
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of QV8QObjectWrapper::getProperty
Simon Hausmann [Thu, 6 Jun 2013 12:52:07 +0000 (14:52 +0200)]
Get rid of QV8QObjectWrapper::getProperty

Replace the call sites with calls to getQmlProperty on the QObjectWrapper.

Change-Id: I3dbc3788c8d1631d817f65c738f0a8a31deb2866
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove signal & slot related code from QV8QObjectWrapper
Simon Hausmann [Thu, 6 Jun 2013 12:18:11 +0000 (14:18 +0200)]
Remove signal & slot related code from QV8QObjectWrapper

The code isn't needed anymore. Also moved ExtractQtSignal/QtMethod
out, too.

Change-Id: I8d7a0ef89ad5ea1ca102a416b70e27597c0279b7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement QObject Signal <> JS Slot connections using QSlotObjectBase
Simon Hausmann [Thu, 6 Jun 2013 06:18:53 +0000 (08:18 +0200)]
Implement QObject Signal <> JS Slot connections using QSlotObjectBase

This eliminates the need for any extra bookkeeping.

This change relies on https://codereview.qt-project.org/#change,58112 in qtbase.

Change-Id: I873b77da342b5f7cbb862f13b53582ffd363e2c8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix build failure introduced by the SSA
Peter Varga [Fri, 7 Jun 2013 08:00:41 +0000 (10:00 +0200)]
Fix build failure introduced by the SSA

Initialize DominatorTree::N in the constructor.

Change-Id: I9bf2e4f9a08253e024d3e0ff93cb45c279daf808
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImproved block scheduling with "tuned" DFS.
Erik Verbruggen [Wed, 5 Jun 2013 14:30:44 +0000 (16:30 +0200)]
Improved block scheduling with "tuned" DFS.

Properties:
- all predecessors of a block are located before this block
- all blocks that are part of the same loop are contiguous, i.e., there
are no non-loop blocks between two loop blocks.

This is done by doing DFS, and preferring the "if-true" for CJUMP. Also,
any block with multiple incoming edges can only be scheduled if all
those edges have been scheduled, except for loop conditions. All loop
conditions are marked in the IR with "group containers", which in turn,
is used to schedule them contiguously.

This layout should minimise the life-ranges for variables.

Change-Id: I3c9fb4f18bb0fc89048e71905f48eb889d763ba0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMark loop blocks as belonging to a group.
Erik Verbruggen [Wed, 5 Jun 2013 14:19:48 +0000 (16:19 +0200)]
Mark loop blocks as belonging to a group.

This will be used for block scheduling.

Change-Id: I071c2107c0303d09dfd595c9825256a5167a1514
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoIntroducing SSA.
Erik Verbruggen [Thu, 2 May 2013 13:40:35 +0000 (15:40 +0200)]
Introducing SSA.

Change-Id: Id3315f3560a8a7c996147eb070876b0065a23c76
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMore verbose error message
Lars Knoll [Wed, 5 Jun 2013 23:38:16 +0000 (01:38 +0200)]
More verbose error message

Also fixes one auto test.

Change-Id: I165d7f00b43ee923f1f1f84cf772afa5dae0dcd7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8 usage in a few places
Lars Knoll [Wed, 5 Jun 2013 23:16:49 +0000 (01:16 +0200)]
Remove v8 usage in a few places

Change-Id: Ib9885d395dd799c0f9dc68e16efea44b60cb1418
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove reliance on delayed template parsing.
Erik Verbruggen [Wed, 5 Jun 2013 12:51:31 +0000 (14:51 +0200)]
Remove reliance on delayed template parsing.

Change-Id: I11e7fd994123de9b947a51001f36dd8bf3938b44
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoPort the first half of the delegate model code to v4
Lars Knoll [Mon, 3 Jun 2013 21:01:00 +0000 (23:01 +0200)]
Port the first half of the delegate model code to v4

Change-Id: Ieda3de0a297ba15e4d6634a1123df27347830cfa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of the QV8Engine pointer in QV8QObjectConnectionList
Simon Hausmann [Wed, 5 Jun 2013 08:04:16 +0000 (10:04 +0200)]
Get rid of the QV8Engine pointer in QV8QObjectConnectionList

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