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>
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>
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>
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>
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>
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>
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>
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>
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>
Simon Hausmann [Wed, 5 Jun 2013 07:59:18 +0000 (09:59 +0200)]
Improve type error messages when reading properties
This fixes the expected output of the qobjectConnectionListExceptionHandling and
while we're at it this patch also re-enables the importScripts test. The test
expects similar output that now passes. importScripts_data produces two failures
though, that are unrelated to expected error message but indicate real bugs.
Change-Id: I606b8791524d19a4bb20a81c30abc2285a1a0a0f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 14:35:00 +0000 (16:35 +0200)]
Move QV8QObjectWrapper::newQObject into QV4::QObjectWrapper
...where it is just called wrap(), because it doesn't always create a new
JS wrapper for the QObject.
Change-Id: Ieed0fc97174eb51cd04df0149e715c234a5822bd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 14:00:13 +0000 (16:00 +0200)]
Fix crashes in workerscript tests (qqmlecmascript and qquickworkerscript)
We need access to the QNam for a worker and other bits from the v8Engine,
so for that it's easiest right now to store the v8engine pointer directly.
There aren't many occurrences of v8engine left and we're gradually getting rid
of them, but this let's the tests not crash at least :). Once the transition
is complete, QV8Engine should collapse and v4->v8Engine->jsengine should become
v4->publicEngine again.
Change-Id: I98558dd687875f20f1dbe25381ee7efe502c7f24
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 13:42:38 +0000 (15:42 +0200)]
Cleanup: Get rid of v8engine pointer in QObjectWrapper
Change-Id: I3a077c6a8ed61ce6dc6a06cf4c4d181509ee8565
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 12:56:56 +0000 (14:56 +0200)]
Removed unused typedef
Change-Id: I17a3fcbbad5169999125aad11ec90cfbd7d4a456
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 12:28:13 +0000 (14:28 +0200)]
Move handling of multiply wrapped QObjects from QV8QObjectWrapper into QV4::ExecutionEngine
The bookkeeping is annoying to do, but it should be a rare case. The common case of a
QObject being wrapped only once is still lightweight as-is.
Change-Id: I12e9b67270ca2afbd77b4395246eef0dfc324f8f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 10:02:29 +0000 (12:02 +0200)]
Move internal QV8QObjectWrapper::newQObject helper to QV4::QObjectWrapper
Change-Id: Ieb1a36ce240b894d19c410b94eccfa79150054c7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 08:05:51 +0000 (10:05 +0200)]
Cleanups in QObject bindings
* Rename v8object to jsWrapper in QQmlData
* Rename v8objectid to jsEngineId, as that's the identifier of the engine
that currently owns the primary JS wrapper
This is in preparation for moving newObject away from QV8QObjectWrapper
Change-Id: I6432365e849d159600e22f09e7e2ab2ae2117db6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 4 Jun 2013 08:36:39 +0000 (10:36 +0200)]
Simplify the object iterator API
We were really missing methods to get both the key and the value
in one go.
Change-Id: I996bde79265f45312e68fcc6bdce76704385ea5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Mon, 3 Jun 2013 11:32:51 +0000 (13:32 +0200)]
Fix VALUE/VALUEPTR macros in the interpreter.
Change-Id: I04f7625979974809bd62006520f67c5cb2d9c5fd
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Simon Hausmann [Tue, 4 Jun 2013 07:52:39 +0000 (09:52 +0200)]
Remove unused QV4::Executionengine member
Change-Id: I38b1e860bc9f2333d0c4a1a53557753e0a07c1ca
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Mon, 3 Jun 2013 20:12:36 +0000 (22:12 +0200)]
Convert QQmlListModel to v4
Remove all usages of v8 API in the list model.
Change-Id: I9dc8acecbbc77a97cf3c2a318e222bdb4b05c7c5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 3 Jun 2013 19:35:51 +0000 (21:35 +0200)]
Remove unused variable
Change-Id: I8dbd4307b0b5dad1d35e28d13703ceeeeaaa66c5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 3 Jun 2013 19:28:07 +0000 (21:28 +0200)]
Fold the qv4jsonwrapper into the json object
Removes the need for an extra file, and cleans up the QV8Engine
a bit more.
Change-Id: I25e4c9252357a098041ecb188960777094c6b959
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 20:25:39 +0000 (22:25 +0200)]
Another property query fix for the QObject bindings
Include attached properties only for lookups coming through JS, not
when going through the context wrapper. (This doesn't feel quite
right, but preserves behavior right now)
Change-Id: I2fedfd3343614733c8d556f56e604118e19314dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 14:41:14 +0000 (16:41 +0200)]
Get rid of inner MethodClosure object in QV8QObjectWrapper
Instead let's have a convenient create function in QV4::QObjectMethod
Change-Id: I7369e614993eebcf9cbb5bc186979dcaa2b2593c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 14:29:16 +0000 (16:29 +0200)]
Fix regression with meta object revision checking
Commit
00a07bcbd7a592072822b0e55ab2e75e90c3f9f5 replaced the CheckRevision
parameter on the call GetProperty on the scope QObject with a get that
would do IgnoreRevision.
This adds a property getter on the QV4::QObjectWrapper that allows for checking
the meta object revision. The plan is to move all of the property getter code
from QV8QObjectWrapper into QV4::QObjectWrapper incrementally.
Change-Id: I8e5a93ce3351a8c5dba13f14cd43e4036875b792
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 13:51:45 +0000 (15:51 +0200)]
Get rid of QV8Engine::toQObject and QV8QObjectWrapper::toQObject
Change-Id: I8726148093079b3385c6b0f16284af0b5ba92066
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 13:23:20 +0000 (15:23 +0200)]
Get rid of QV8Engine::isQObject and QV8QObjectWrapper::isQObject
The goal is to ultimately get rid of those wrapper instances
Change-Id: I77d806e09c163e4e41915dd6cee3082099f1a3b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Mon, 3 Jun 2013 13:59:00 +0000 (15:59 +0200)]
Remove some more v8 usage
Change-Id: I00c4a2403e12bc87743a073f245c38b007e9531d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 3 Jun 2013 13:15:40 +0000 (15:15 +0200)]
Remove last v8 dependency in qqmlvmemetaobject
Change-Id: If3b45ea3048f6167a121011191aa5f42b2fe2e88
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 2 Jun 2013 20:58:56 +0000 (22:58 +0200)]
Convert the localstorage plugin to v4
Change-Id: I397c3a7e67a65696bb7cb35502e59b49f3928a05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 3 Jun 2013 12:56:12 +0000 (14:56 +0200)]
Get rid of the QV4FUNCTION macro in qv8engine_p.h
Change-Id: I4fdff5159c2443dab232d90a906cfb8203bf9c05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 12:41:17 +0000 (14:41 +0200)]
Initial port of connect/disconnect from V8 to V4
Change-Id: I289a49ab60cce33bf03724e93df9a9cac2b2aa1a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 10:52:53 +0000 (12:52 +0200)]
Fix failing QJSValue test for QObject JS wrapper prototype
We need to initialize the prototype correctly.
Change-Id: I466c132b5f6bd5761b5943aaea91ed811b82a8f7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 3 Jun 2013 11:27:38 +0000 (13:27 +0200)]
Fix tst_qqmlecmascript::signalHandlers auto-test
Provide a more elaborate error message when a type error is thrown as
the result of trying to call a property as function.
Change-Id: Ie4cd56e2f0d16b90060af1f596a48914a868244a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 2 Jun 2013 21:25:52 +0000 (23:25 +0200)]
Implement QJSValue::toQObject and isQObject
Change-Id: I03c4dc285039503762c65936a7e66714754ea2e1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 2 Jun 2013 20:56:59 +0000 (22:56 +0200)]
Set the Lexer into qml mode when parsing binding expressions
Binding expressions allow multiline strings and digits starting
with 0. Simply setting the lexer into qmlmode when parsing them
will allow these expressions to pass.
Fixes 3 more test failures in qqmlecmascript
Change-Id: Ia14ec6d3facaf31883bb824c57096e59df3efea2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 2 Jun 2013 14:58:01 +0000 (16:58 +0200)]
Allow return statement when parsing bindings
An explicit return statement was allowed in bindings with v8 (as
they were rewritten as function closures. There's no reason to forbid them
now.
Fixes two tests in qqmlecmascript.
Change-Id: I27a6f88d17d8c35b37735ad321b7607f09b1e67c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Sun, 2 Jun 2013 12:12:26 +0000 (14:12 +0200)]
Implement line number resolving of stack traces in the interpreter
Change-Id: I18fc141c4cf8a38036ec78e45fe380c2c1fa3055
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 1 Jun 2013 19:47:43 +0000 (21:47 +0200)]
Fix uninitialized memory read in tst_qqmlecmascript::include auto-test
Make sure to initialize the callback variable, in the unlikely (but possible)
event of it not getting initialized otherwise.
Change-Id: Ic8bbf90b825157e55bb93dd9e600ff22ca11b911
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 1 Jun 2013 13:08:17 +0000 (15:08 +0200)]
Fix missing object markings in QV4::Script
Store the qml activation object as Persistent value, as the script object is
often stored on the heap. Also make sure to mark it in QmlBindingWrapper. Fixes
various valgrind errors in tst_qqmlecmascript.
Change-Id: I7edf1e18db0e6a5ab9dcbfd57e258d72fe62cd77
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 1 Jun 2013 12:27:45 +0000 (14:27 +0200)]
valgrind support: Destroy mempool when memoryManager is destroyed
Fixes "impossible situation!" abort in valgrind when running tests that
create and destroy a lot of engines.
Change-Id: I58cfd2380b0149d25ebecdb270be428ec6b8a64f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 1 Jun 2013 12:25:32 +0000 (14:25 +0200)]
Fix uninitialized return value for QQmlJavaScriptExpression::evaluate
In case of an exception, we'd return an uninitialized value.
(visible when running tst_qqmlecmascript in valgrind)
Change-Id: I2c95a112b09ba527e61088904fa7daff003be05d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 1 Jun 2013 12:07:44 +0000 (14:07 +0200)]
Port QObject bindings to use new cast
Change-Id: Ib0a8ba76df51276d53cf251b0ed979176e1fba01
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 31 May 2013 20:59:42 +0000 (22:59 +0200)]
Convert qqmlcomponent to use v4 API
Change-Id: I070053d6d66e289d6d737f2a33e18b5c41a49843
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 31 May 2013 07:41:54 +0000 (09:41 +0200)]
Fix crashes when running tst_qqmlecmascript with MM_AGGRESSIVE_GC
Make sure to initialize the property data (especially setter/getter) in
insertMember() right away to zero, to avoid marking uninitialized objects
in code like this when the GC happens in code like this:
Property *pd = o->insertMember(...)
f = someFunctionThatAllocates();
pd->setSetter(f);
Change-Id: I55e4846c0e5027bb95a1da13df30bcf9eca28645
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 30 May 2013 08:55:41 +0000 (10:55 +0200)]
Make debug annotations more robust against statement re-ordering
As suggested by Erik, instead of storing debug annotations as separate
statements in the IR, annotate the Stmt itself instead.
Change-Id: I690ae602fba500a39909eb3ef71b50f39b98ec86
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 31 May 2013 14:40:12 +0000 (16:40 +0200)]
Allow construction of array with a predefined length
The execution engine was missing this method for a long
time. This should simplify some code and allow more optimised
paths in other places.
Change-Id: Iaf576beb3bc006cdcfd65b518a2121a13629f462
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 14:32:19 +0000 (16:32 +0200)]
Remove last v8 dependency in the testlib
Change-Id: I68fa531a3db0becf0a449265562e8d20b9fa967f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 14:06:42 +0000 (16:06 +0200)]
Clean up more stuff in qv8engine
Change-Id: Ia31d5abd4694b1c67115e75f0d0f134a65d4d775
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 13:54:43 +0000 (15:54 +0200)]
Remove some unused code
Change-Id: Ie865cdf564e2562db7febbdef6b7bfa75e44859c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 12:02:15 +0000 (14:02 +0200)]
Convert more subclasses of Managed to the new casting scheme
Change-Id: I4105f61d8b1d32b59281eb28fc31002a0ac4e4eb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 11:39:15 +0000 (13:39 +0200)]
Move Variant and QtObject over to new casting scheme
Change-Id: Ie9e5e40b4bea4d4379dc9bdd103852c32d6ae478
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 11:05:37 +0000 (13:05 +0200)]
Start converting casting of Managed to subtypes to a better scheme
There is now a template based as<Foo>() method available in
Managed, that'll allow casting to the proper subclass. It uses
the pointer to the vtable and compares it to the classes static
vtable for type checking. Like this we can avoid that Managed has
to know about all subclasses.
Change-Id: Ic966bbe00d85224b8d96cc0ff00f69a6ac67129e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 31 May 2013 08:58:24 +0000 (10:58 +0200)]
Fix a wrong sign in timezone parsing
This fixes a few test cases in qqmlecmascript
Change-Id: Id1cb2205bd47ff656c50a8e49fabc690b7623a91
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 30 May 2013 19:53:27 +0000 (21:53 +0200)]
QObject bindings: Cleanups
Remove some uses of v8 API.
Change-Id: Ie888ff8a183de0dea82f358365c70650fb09d6c4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 29 May 2013 12:58:52 +0000 (14:58 +0200)]
Fix tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy
When destructing the JS engine and deleting the JS wrappers, we may decide
to delete the QObjects of JS owned JS QObject wrappers. During this phase
(engine destruction) we need to delete the QObject instantly instead of
deferred (the default when _running_ the engine).
* Delete the memory manager first in the ExecutionEngine destructor, as
some of the user code destructors we may end up calling still expect
a somewhat functioning engine unfortunately.
* Fixed also some bugs in Persistent/WeakValue: When assing a value,
detach properly if refcount > 0
* Fixed a bug when clearing a weak value during sweep, when we wouldn't
pick up the correct next pointer for a weak value that didn't have the mark
bit set
Change-Id: I960e58ecbb40b0ecf2bc07fe661a1ec706fcca61
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 30 May 2013 20:57:15 +0000 (22:57 +0200)]
Get rid of v8::UserObjectComparisonCallback
Add a isEqualTo Method to the Managed's vtable, that will be
used for comparing.
Change-Id: I4d253db93851c16a57aa1412fa7142913d1744e6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 20:24:22 +0000 (22:24 +0200)]
Remove the remaining v8 usage in qqmlbuiltinfunctions
Change-Id: Ia643b9d5011f374d6a36045beef5cb0fb1dbb17a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 20:09:46 +0000 (22:09 +0200)]
Port the list wrapper over to v4
Also fix two places where we did a wrong type check.
Change-Id: Ibc988b1b38803ca6acf6914487415026910f744e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 17:16:21 +0000 (19:16 +0200)]
Smaller cleanups
Change-Id: I7c3ec27b2910a98f667d13011192cbe57bb1d7c7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 16:56:47 +0000 (18:56 +0200)]
Fix all autotests related to value types
Fix 3 bugs in the new implementation, and adjust two expected error
messages in the auto test.
Change-Id: Ic3c08e54f9babc7e4779d67829e36f3ff805e127
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 13:42:44 +0000 (15:42 +0200)]
Port the value type wrapper over to use V4
Change-Id: I0c566d0ab8cdd0ddbc688b7a1462c4b21084b30a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 11:45:23 +0000 (13:45 +0200)]
Cleanup the context wrapper code
Remove the QV8ContextWrapper class and move the code out
of the v8 directory.
Change-Id: I00c02f7310a3e43bd105c5bc5af034ce652cfd49
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 30 May 2013 11:16:44 +0000 (13:16 +0200)]
Port the type wrapper over to v4
Change-Id: Id442281a366914be818b068f70ebe5200c527254
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 29 May 2013 13:54:50 +0000 (15:54 +0200)]
Move v8contextwrapper implementation over to v4.
Change-Id: I82a3f79c3d9e7727a35aa08a6ba48d9df9364b90
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 29 May 2013 13:46:59 +0000 (15:46 +0200)]
Fix tst_qqmlecmascript::switchStatement()
Adjust the expected error message output to include the column number
instead of just the line number.
Change-Id: Ie8064d6a26f875d8da5b0d68c503d632b6afc69e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 29 May 2013 13:06:54 +0000 (15:06 +0200)]
Cleanup: Remove dead code in QObject ownership handling
The ownership management of QObject JS wrappers is implemented in the engine
now and doesn't require external GC callbacks anymore or extra book keeping
data structures.
Change-Id: If04a09deec6c0342274daa4ed82a34d3503e32e9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 29 May 2013 10:18:31 +0000 (12:18 +0200)]
Fix failing tst_qqmlecmascript::deleteRootObjectDuringCreation unit test
Respect the rootObjectInCreation flag in QQmlData. Centralize the checking code
for that through the places in the engine where it is checked, along with the
indestructible flag.
Change-Id: Ie977b34ac8d070f6dcd7bab11a95dd27ca25145e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 29 May 2013 10:30:34 +0000 (12:30 +0200)]
Remove now unused subcontext functionality
Change-Id: I63b1803397dc79a671bd4cf35fb667ecacb10cab
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 29 May 2013 07:59:40 +0000 (09:59 +0200)]
Fix Qt.include related autotests
Resolve relative file names correctly. This works, but is
not how it should look finally, as the whole context handling
for include() and imports will still change somewhat.
Change-Id: I64cdda222f13c3ca650a1dfe2f97e97adafe53a8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 28 May 2013 11:33:50 +0000 (13:33 +0200)]
Remove some leftovers from the v8bindings
The shared context concept was only used there, so remove
code that was referring to it.
Change-Id: I5ae56049a83818c898ef1cc4e68a5333a9374656
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 28 May 2013 20:18:54 +0000 (22:18 +0200)]
Fix compilation on linux and clang
Change-Id: I49b71ca6f48b849db9c8bbc1fd8a0687a0a05bb1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 27 May 2013 18:23:13 +0000 (20:23 +0200)]
Fix toString and destroy on QObject JS bindings
The auto-tests requires these member functions to not rely on the
thisObject at all.
Also fixed lookup of QObject properties through the context wrapper
to go through get() as the new interface (to catch destroy/toString).
Change-Id: Iacbe8b5ce1895195a84a1224faba3f3bd34cd03b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 28 May 2013 07:36:04 +0000 (09:36 +0200)]
Implement stack trace support for Windows
Using StackWalk64
Change-Id: I8a4e1fe8f9338da60bd4b93b26f2cdfac2cf3cbb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 28 May 2013 07:46:12 +0000 (09:46 +0200)]
Fix crashes in some worker threads auto tests
Replace the crashing use of QV4::ExecutionEngine::publicEngine from within
worker threads (null pointer there) with direct pass-through of the QQmlEngine
pointer. It will be null within worker threads, but that the code can handle.
Change-Id: I8eff9d2cc6ca6f2afd9c0eef203975be9119b9b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 28 May 2013 07:01:00 +0000 (09:01 +0200)]
Cleanup handlReferenceManagement auto test
Replace the vtable hacks with a simple property to maintain a GC visible
object reference.
Change-Id: Iae178d59dac23114353c152ef86224c9373a6025
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 28 May 2013 06:54:59 +0000 (08:54 +0200)]
Fix uninitialized reads during GC
Make sure to initialize both setter and getter fields for accessors
Change-Id: Ic1187da9e97694e58d4dd7634988dabd55b0700b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 27 May 2013 18:40:33 +0000 (20:40 +0200)]
Fix crash in various qqmlbuiltinfunctions
These functions use QV8Engine::callingContext(), which relies on QV4::ExecutionEngine::qmlContextObject()
to retrieve the correct QML context. That function relies on outer, which isn't set for the SimpleCallContext
objects we set up.
Added a quirk to start the outer traversal with the parent if the current context is a SimpleCallContext.
Change-Id: Iebc3a6b68c9966ad7278a05bf37a6fb55523bff4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 27 May 2013 12:19:35 +0000 (14:19 +0200)]
Fix file and line number reporting of QML/JS errors
* Replace QUrl with QString in V4 for the source location (we don't need URL parsing)
* Replace line number and file in QV4::Exception with the information we retrieve from
the stack trace of the exception.
Fixes about five tst_qqmlecmascript tests that relied on correct file/line number information
Change-Id: I2a3daa72be6c5587fd965211ea8f6fb77142e7ee
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 25 May 2013 13:31:23 +0000 (15:31 +0200)]
Add support for line numbers in stack traces (Linux/Mac OS X only at this point)
* Add support for debug annotations on statement boundaries to the
IR, to get accurate line/column information
* Use binary search to retrieve the function and line number for a given
program counter
* Save the stack trace in the exception class and print it in v4
* Fix initial line number in QV4::Script to start a 1, just like the initial column
in QQmlJS::Lexer also starts at 1
The native stack frame tracing is currently only implemented on Linux and Mac OS X.
The implementation for Windows using StackWalk64 is still missing.
Change-Id: I771fe44816397e29c69952772a772bf0d985236f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sat, 25 May 2013 13:38:27 +0000 (15:38 +0200)]
Convert builtin methods from v8 to v4
Change-Id: I37006c60f0de131eefa53d8ee81844c2fb47f8b9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Mon, 27 May 2013 12:10:50 +0000 (14:10 +0200)]
Initialize vmFunction.
Change-Id: I7047bd221f00a121af9e515257863e3d326b5e82
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sat, 25 May 2013 12:32:31 +0000 (14:32 +0200)]
Remove template argument from MemberAccessorGetterSetter class
Like this we don't need to have the call method inline. This is bad, as the
method uses try/catch, and leads to compile errors with clang if the header is
included from libs compiled without exceptions enabled.
Change-Id: I801e21aafafc255836dfa19b81c84f884de0b395
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 17:56:58 +0000 (19:56 +0200)]
Small cleanup
We don't do rewriting for bindings anymore.
Remove a method overload that's not really needed
anymore.
Change-Id: I9d57d30dce4848cb06c88c3f042ccf30e6d41aab
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 16:14:58 +0000 (18:14 +0200)]
Remove some unused code
Change-Id: I2d3d4cbc69d2a6e5d8b33a5ac23f24bcf19418ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 24 May 2013 15:12:57 +0000 (17:12 +0200)]
Implement JS ownership policy for var and variant properties
Instead of a GC callback, let's keep the lifecycle of the var properties and
the QObject wrapped variants in sync with the lifecycle of the JS QObject
wrapper, through a markObjects re-implementation.
handleReferenceManagement test passes now, fixed a few incorrect gc() calls
in there.
Change-Id: I78e8ca700e41bba788b61d3816a77cfb3a7c5e58
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 24 May 2013 15:02:48 +0000 (17:02 +0200)]
Port method closures over to V4
Replace the JS/V8 based closure wrappers for invokable Qt methods with
a simple QV4::FunctionObject subclass.
Change-Id: Ibd16cf8a871ce2bf0692c7c0032527109065aa8a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 24 May 2013 12:33:19 +0000 (14:33 +0200)]
Cleanup: Get rid of special toString and destroy handling in QObject bindings
These are meant to go through the regular V4 binding layer
Change-Id: I23743e183b0c85cad2e047eb99dca1a9382597fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 24 May 2013 13:25:20 +0000 (15:25 +0200)]
Port Qt.include() over to v4
Still doesn't quite work as it should, but that's no regression to
before neither. The reason is that the context handling is still v8
based and needs to be rewritten.
Change-Id: I51216f93d6db4ba26f8adddaeb39d8a8c62df7ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 12:50:03 +0000 (14:50 +0200)]
Fixup list model serialization
We need to properly refcount the agent, so it doesn't get
deleted when it's still in use.
Change-Id: Id9a0764e15c10e7b15a216523d6b22764ac863dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Fri, 24 May 2013 12:28:13 +0000 (14:28 +0200)]
Fixed struct/class friend decl.
Change-Id: I779126401b36a1a20dc93d0f88317f9632849276
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Fri, 24 May 2013 11:19:49 +0000 (13:19 +0200)]
Add symbolification for MacOS.
Change-Id: I95fc25afef56dad7c51f417959728397e63a8dc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 11:26:38 +0000 (13:26 +0200)]
Get rid of Get/SetHiddenValue in the v8 API
It was only used to mark an object as something to be used as a binding.
Simply use one of the free bits in QV4::Managed for that.
Also changed a bit more code over from v8 to v4.
Change-Id: I6e787e611041e058fe109df1d7a13598655f8eba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 24 May 2013 11:19:15 +0000 (13:19 +0200)]
Implement QObject ownership policy for QObject JavaScript wrappers
A parent with C++ ownership keeps its children alive. We know that all
QObject wrappers are kept in a QWeakValue inside the QObject's QQmlData.
As the weak values are registered to the MM, we can traverse there and
mark the children if necessary in one extra pass.
The handleReferenceManagement auto-test that covers this was actually
testing the addGCRelationship implementation as well as the overal behavior.
Some of the tests verify that a handle based overload of addGCRelationship
works, so since those tests don't make sense anymore, I've removed them.
Also fixed some cases where the test ran gc(engine) when it should've called
gc() on the specific local QQmlEngine instance used in the test. This worked
in V8 because the GC was "global".
Change-Id: Ib394b46e034b016196804a9e73682507fa791445
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 24 May 2013 10:45:13 +0000 (12:45 +0200)]
Get rid of some v8 based code
Change-Id: Iee910dcc1d3148922d2f92055eb06cdb0b889502
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 10:10:46 +0000 (12:10 +0200)]
Remove the remaining dependencies onto the binding rewriter
Remove the remaining places that were rewriting bindings. Remove the
binding rewriter class.
Change-Id: Ib1e9121dc10f4526ddb7cf0ae32fecd8ce2d4993
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 24 May 2013 09:21:10 +0000 (11:21 +0200)]
Remove QV8Bindings class
This class tries to optimise binding compilation with v8. With the
approach in v4 where we don't rewrite binding expressions anymore,
this is not required anymore.
Change-Id: I616aeeba85bc17a950d4c7341b3042ed8aa42bff
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 23 May 2013 20:56:38 +0000 (22:56 +0200)]
Add support for direct binding evaluation in QV4Script
This way there is no need to rewrite the binding expressions
anymore, instead we can directly compile them into a
binding function.
Change-Id: I91a0c540d066976e363590fe9ccde6a81ee92b1d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 23 May 2013 20:13:42 +0000 (22:13 +0200)]
Fix QObject ownership
Implement the JS vs. C++ ownership policy. QV4::WeakValue is a weak
reference that's now used instead of PersistentValue in QQmlData.
Whether or not to delete the QObject when the JS object is garbage
collected is decided in the ~QObjectWrapper destructor (conveniently).
Fixes four ownership tests.
Change-Id: Iedeb498f510295b5e656d0bb3b324084efa98f0f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>