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>
Lars Knoll [Thu, 23 May 2013 20:47:55 +0000 (22:47 +0200)]
Fix some leftovers from the last v4 removal patch
A few things overlooked. Also adjust the numbering in one enum
to fix a crash.
Change-Id: Iedf641452f6f14ffc36d548d970079f0d6024bb6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 22 May 2013 14:51:34 +0000 (16:51 +0200)]
Replace QV8QObjectResource with QV4::QObjectWrapper
Use a proper sub-class instead of external object resources, as a first
step towards porting the QObject bindings away from V8.
This also replaces the function template / constructor approach and the
faster getter optimization with a plain virtual get in the V4::Object.
Property lookup in QObject bindings will be subject to future optimizations
that will work very differently once we enable the faster V4 lookup mechanism
in QML.
Change-Id: Ib7c2eead5323c22290c2924de786d9cfcf308c03
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 23 May 2013 13:23:06 +0000 (15:23 +0200)]
Remove all references to the old v4 code
The old v4 files have already been removed, so cleanup
all the #ifdef'ed code that still references them.
Change-Id: Ifc5c59add5af36a61586a43b13291d7836cccd78
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 23 May 2013 12:03:03 +0000 (14:03 +0200)]
Add some null pointer checks to v4::Script
This makes all eval() related tests pass again.
Change-Id: I067f2e0acf17932ec9b212723fc8df1ffc4c4884
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Thu, 23 May 2013 10:50:39 +0000 (12:50 +0200)]
Fix failing assertion in tst_qqmlecmascript::singletonType
Don't try to call the singleton callback with the current scope but instead
execute it well-defined within the scope of the global context.
Change-Id: I6b59fad7d466a6070d1c748f909e1d8c0a1045ea
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 22 May 2013 21:10:01 +0000 (23:10 +0200)]
Fix crash in tst_qqmlecmascript::qtbug_22843()
Parse errors throw exceptions, which we must catch here. The caller will
check !m_program and return accordingly. This restores the previous
behavior also found in stable/dev.
Change-Id: Iecff94858ba12f13e581ec1664a092b3e9cd963d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 22 May 2013 20:48:38 +0000 (22:48 +0200)]
Fix failing assertion in QObject bindings when catching exception
Add missing accept() to ensure the context is unwound correctly.
Change-Id: I42f9d17c8df25beb151675377d4395f1e2b35eef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 22 May 2013 20:45:45 +0000 (22:45 +0200)]
Fix another failing assertion when running qqmlecmascript tests
Value::IsUInt32() and friends are not implemented. Port this built-in
stringArg() function over to QV4::Value.
Change-Id: I48674892c238473f1d70b2184249b0db377ae399
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 22 May 2013 14:19:52 +0000 (16:19 +0200)]
Compile fixes for clang.
Change-Id: I691347f7cbd1023ce3c9c2e116d3ca5029f4a8e1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 22 May 2013 17:37:34 +0000 (19:37 +0200)]
Fix crash in Engine::currentStackFrame()
Don't accidentally shadow c with c :)
Change-Id: I4c5022428e8dfb0cda432283decaac8edae512f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 22 May 2013 14:53:35 +0000 (16:53 +0200)]
Various fixes
Fix a regression in Script::run, and compilation for
v4 and an auto test.
Change-Id: I4026eebec0e02f4af03ca49ba714916ad90b34e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 14:35:28 +0000 (16:35 +0200)]
Remove QV8Engine::scriptValueFromInternal
Change-Id: I43d672d17c0bbb498be71d7a25f8ca1389aeadf7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 14:26:45 +0000 (16:26 +0200)]
Move evaluateScript into QV4::Script
also remove an unused method in QV8Engine
Change-Id: I1e655e714755426ac0c48ee9cc08059104ddb3b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 14:16:49 +0000 (16:16 +0200)]
Local initialization is now done in codegen
Follow up on
2bd6e240a3c2b3dc7a2c81c639d4f30e4dfd685f
for Qml contexts.
Change-Id: I0c0d417a65cf537fc56696b4f996812b368ab387
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 13:59:29 +0000 (15:59 +0200)]
Remove v8::Script and related classes
Port the last few usages of v8::Script over to the new
v4::Script class.
Change-Id: I0d117d273ca450d29a9111757603da8ae02e4ca4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 13:47:55 +0000 (15:47 +0200)]
Remove now unused QV8Engine::qmlModeCompile methods
Change-Id: I55d89f1e2bd09cde3ef8f3b99bb4138d7247649c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Mon, 13 May 2013 06:57:33 +0000 (08:57 +0200)]
Local initialisation is now done in codegen.
Change-Id: Idbc19b2e4f71adf3b6674ac2ae6064b7ea347fff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 22 May 2013 12:22:06 +0000 (14:22 +0200)]
Terminate for-condition-blocks when they are empty.
Change-Id: I21409ea43edf8b87c681b69c409d11230b205383
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 22 May 2013 12:11:59 +0000 (14:11 +0200)]
Make sure that case-blocks in a switch are terminated.
If the case is "fall-through", add a JUMP to the next case block.
Change-Id: I9e49c55dacc79d6154d4ae30db0acb3d3f457468
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 22 May 2013 08:46:09 +0000 (10:46 +0200)]
Cleanup: It's QQmlV4Function and so the flag should also be called V4Function instead of V8Function
Change-Id: I6d4d258e1fcad9097eb898f0b092f564cd4078ad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 22 May 2013 12:30:57 +0000 (14:30 +0200)]
Replace usage of v8::Script and qmlModeCompile with QV4::Script
Change-Id: I114a0b7faed39be313cde5617a0ce4a06dece7e2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 11:49:27 +0000 (13:49 +0200)]
Add a QV4::Script class
The class is a replacement for v8::Script. Start using it
in various places.
Change-Id: Ie5537639e44fa1ee23aea8605eae3c736819ef52
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 22 May 2013 13:43:27 +0000 (15:43 +0200)]
Fix memory corruption
The QString constructor taking a QStringDataRef doesn't refcount,
so we need to do it manually.
Change-Id: I076df18cfdb94ef796a42281b7bb1027798b609c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 22 May 2013 09:58:16 +0000 (11:58 +0200)]
Fix build on Windows
* Include stdint.h for uint16_t and friends
* Fix struct vs. class mismatch
* Export QV4::String as referenced by QQuick
* Eliminate declared but not defined destructor
* Fix v4classgen python script to not require argsparse, so that it works with older Python versions
* Replace the use of QStringLiteral in some places where we concatenate the
input (like "Foo" \n "Bar") and MSVC thinks that the two string literals have
a different "width" (8 bit vs. 16 bit) and therefore cannot be used with QStringLiteral
* Add src/qquick to the include search path to work around the differing include search path
semantics between MSVC and gcc
Change-Id: Iedcc21cc757c53b6c7d81b514fd857ff1f573b01
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 22 May 2013 08:47:36 +0000 (10:47 +0200)]
Add support for generating stack traces to QV4::ExecutionEngine
This makes it possible to remove the v8::StackTrace API
Change-Id: I53eee022a1030f0f6bf9a9268ca7cd3d5975724d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 22 May 2013 08:41:21 +0000 (10:41 +0200)]
Build fix for tests
This file uses uint16_t and therefore needs to include stdint.h for
the declarations.
Change-Id: Ifd95a4ade6ecb8560deca4d0118b985d939cfba2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 21 May 2013 20:46:15 +0000 (22:46 +0200)]
Add correct filename and line number info to v8::StackFrame
Change-Id: I14d4e1b78d62fd7ccf19a57d14a5a32df9385037
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 21 May 2013 20:04:36 +0000 (22:04 +0200)]
Remove v8 dependencies in qhashedstring
Also remove now unused API in v8::String
Change-Id: I2570aedf407c89ad85da01cf0e2153a52b4e562d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 21 May 2013 19:23:01 +0000 (21:23 +0200)]
Get rid of v8::String::(Ascii)Value
Change-Id: I792a94590efbec852620d101b620b263a90e1d54
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 21 May 2013 19:31:45 +0000 (21:31 +0200)]
Fix running through all tst_qqmlecmascript tests
* Implement SetHiddenField/GetHiddenField (hack)
* Fix recursive calls to SetEngine, to allow for the re-use of
the QQmlEngine member in tst_qqmlecmascript after ~QQmlEngine
was called on another instance
* Fix array sizing in function call parameter handling
* Don't try to clone the function object in Qt.binding (assert instead)
Change-Id: Ia3155dea8518348ec329037ca04e5c38e47a4f92
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 21 May 2013 15:06:36 +0000 (17:06 +0200)]
Finalize sequence wrapping
* Move into QV4 namespace
* Get rid of sequence wrapper instance, all static methods now
Change-Id: I9a9e7ce10890cfe4625b3571bdb4b0ffec34658a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 21 May 2013 14:31:05 +0000 (16:31 +0200)]
Fold qv8sequencewrapper_p_p.h into qv8sequencewrapper.cpp
Most of the implementation belongs into a C++ file instead of a header file,
it's not re-used from anywhere else.
Change-Id: Ib41e3e104d9544710343b869116368bbca999622
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 21 May 2013 14:24:00 +0000 (16:24 +0200)]
Eliminate last v8 dependency from QV8SequenceWrapper
Stub out file name and line number information in QV4::ExecutionContext,
used for warning generation.
Change-Id: I922541e1ee4a5e2211ca6c16494d2b9044a9c346
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 14 May 2013 16:58:34 +0000 (18:58 +0200)]
Port the rest of the sequence types to V4
Change-Id: Ia248f54b65b74d16e91e6ec72503eb967894586d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 21 May 2013 13:33:18 +0000 (15:33 +0200)]
Fix the build
Change-Id: I04a2e3c280b622378bf4431a77388e59eb31ad10
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 21 May 2013 10:45:12 +0000 (12:45 +0200)]
Get rid of v8::Primitive
Change-Id: Idd31a8d522119cade9bb18854e124b80f1c57123
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 21 May 2013 10:43:37 +0000 (12:43 +0200)]
Get rid of v8::Boolean
Change-Id: I10b4240db78532dfdf972bb0a6f191462d81caaa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 21 May 2013 10:37:52 +0000 (12:37 +0200)]
Get rid of v8::Number
Change-Id: I38bdf8fe4dd73c61317912ec6308a9a1e870ad99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 21 May 2013 10:33:55 +0000 (12:33 +0200)]
Get rid of v8::Integer
Change-Id: I6b9ab830c4ff3cbf986dbcf7c056648b5a16a222
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>