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>
Lars Knoll [Tue, 21 May 2013 08:56:08 +0000 (10:56 +0200)]
Remove some unused classes from the v8 API
Change-Id: I6fdb7903a3cdb3b3167144f78bd7cf58647deb67
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 21 May 2013 08:17:30 +0000 (10:17 +0200)]
Small exception handling fixes
* Don't accept the exception if we're going to re-throw it (partial unwind
is not necessary as we don't have a stack-based context to clean up)
* However do accept() it if we decided to handle it (in qqmlvme.cpp)
Change-Id: I63bfa34f30fe19ad36de746b1f15fc6b641e563b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 21 May 2013 08:27:25 +0000 (10:27 +0200)]
Fix crashes when invoking QML JS methods from C++
Make sure to size the QVarLengthArray properly to avoid out-of-bounds
access.
Change-Id: Id075730ffa2e366a729b401b8563ad7fd59597de
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Mon, 20 May 2013 22:05:52 +0000 (00:05 +0200)]
Get rid of v8::TryCatch and v8::Message
They are now unused, so let's remove them from the v8 API.
Change-Id: I9c1b39632cb88785ae6fdda671580e0426ae97ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 21:51:45 +0000 (23:51 +0200)]
Convert the remaining TryCatch statements to use QV4::Exception
v8::Script::Run doesn't catch the exception anymore. Instead we handle
this on the calling side, removing all needs for v8::TryCatch.
Change-Id: I946269a6734f50c728c4f153c00cd19db48f1a6a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 20:12:41 +0000 (22:12 +0200)]
Remove half the v8::TryCatch statements
Replacing the other half requires a replacement for v8::Script.
Change-Id: I40fe99302fba23f286773ec1adaf8d3751db901d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 18:32:58 +0000 (20:32 +0200)]
Fix return value for QQmlJavascriptExpression::evaluate
Change-Id: Idf95ee51b7d50682476371c7f49537930fdf96f1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 18:27:16 +0000 (20:27 +0200)]
Cleanup QQmlDelayedError
Remove dependency onto v8::Message and simplify conversion from
QV4::Exception to QQmlError.
Change-Id: Icfdfd7a2749210b2df9fda6cd5de94114b8adcfa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 18:24:42 +0000 (20:24 +0200)]
Add source file and line number to QV4::Exception
This will allow us to replace v8::Message properly and give
us proper error reporting for uncaught exceptions.
Change-Id: I1c03b6c21456dea06931a874bb2aa5a0b00aff62
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 16:55:49 +0000 (18:55 +0200)]
Move QQmlJavascriptExression::evaluate over to v4
Change-Id: Ic4093dc5413f43af55a74a0e0f8c316ac1c6d974
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 09:00:58 +0000 (11:00 +0200)]
Fix some parts of workerscript and convert to v4
Add some try/catch blocks around calls to v4, fixing
some crashes in the worker script auto test.
Change-Id: I591a25facc8afd5c6f99ffb7b75530c890318280
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 09:13:48 +0000 (11:13 +0200)]
Rename QV8Worker to QV4::Serialize
The class is only being used in WorkerScript, but in itself
only does serialization of JS Values.
Change-Id: Ibf1b06acf5abcfcc00cada9cc8cad9a833bd7ea3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 20 May 2013 09:00:06 +0000 (11:00 +0200)]
Comment out two lines that cause assertions
The subcontext code is only used to add debugging info
through the V8 API.
Change-Id: Ibcb3284180aca1568b44d9d387d96bfae715283d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 19 May 2013 21:50:47 +0000 (23:50 +0200)]
Fix a bug in the creation of JS Array's from variant and string lists
Correctly set the arrayDataLen or V4 assumes the array is empty.
Change-Id: I6b7454b2e7a2b459b1e41e6d6234f89460013107
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 19 May 2013 21:16:48 +0000 (23:16 +0200)]
Properly initialize regexp objects created from QRegExp's
Change-Id: Id6c9abe7e20bf91c37a6bd335117266a8e8aa8fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 19 May 2013 21:15:13 +0000 (23:15 +0200)]
Fix a bug in V4V8Object::put()
When a fallback handler returns an empty value it is not
intercepting the call, and thus the put() method of the base
obejct should get called.
Fixes most issues with worker threads.
Change-Id: I88f0fcb6349cc818163248d456e3fb916188f48f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 16 May 2013 10:17:22 +0000 (12:17 +0200)]
convert qv8workerscript to v4
Change-Id: Ifc204f53a46c857a2a7caaa4f6900d4300163dbb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 14 May 2013 06:43:45 +0000 (08:43 +0200)]
Fix connect/disconnect in QObject bindings
The hack of using ScriptOrigin to identify JS wrapper functions for Qt methods
is not possible for us to implement (or doesn't make sense). However the bindings
rely on this feature, so implement it using a semi-private property hack.
Change-Id: I6c7852f46916a9f549bf703d47546e7ddd75a1b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 16 May 2013 07:31:28 +0000 (09:31 +0200)]
Smaller cleanups in qv8engine
Change-Id: I5cc7150c37312db78ce0985fe546646a9df61258
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 14 May 2013 00:33:03 +0000 (02:33 +0200)]
Don't GC constructors and prototypes
Change-Id: Iedc894927bc93dc3f5778a4f7855eb3ec37b946b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 14 May 2013 00:01:04 +0000 (02:01 +0200)]
convert QV8VariantWrapper to v4
Implement variant support through a QV4::VariantObject
class. Port scarce resource support for the
pixmap and image variants.
Change-Id: Ib6aac8debc7f57224ccddb912ab4342c5f1dec15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 13 May 2013 16:39:57 +0000 (18:39 +0200)]
Change some APIs in qv8variantwrapper over to be v4 based
Change-Id: Idfba6a92bc23dbb8fe14d67ed4a4be901dc0e10a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 13 May 2013 16:30:16 +0000 (18:30 +0200)]
Fix QJSValue::toVariant and isVariant
Change-Id: I7360e37e34756e26f3e8936751c6b65a9d0a2167
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 13 May 2013 16:29:33 +0000 (18:29 +0200)]
More correct conversion to a QString when toString() throws
Change-Id: I0c11b5ed593593f849ec272ae17f2ef4525f3629
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 13 May 2013 16:07:44 +0000 (18:07 +0200)]
Give the QJSValuePrivate the pointer to the engine back
Unfortunately the value needs a pointer back to the engine, to keep
compatibility with the old code and have our tests pass unmodified.
Change-Id: Ibe26e6c770bd8d26dad4a26d42b40e3e1af4996c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 13 May 2013 14:11:35 +0000 (16:11 +0200)]
Another fix for getting more of the QML based tests running
The QML testlib uses the in operator on the QObject bindings, which provides
properties using the named fallback property query/enumerator. We need to
include those in Object::__hasProperty__, which is used to implement "if (foo in bar")
Change-Id: Ib30a9e9d90e0e2379e655f5282c269f1b5cceb8d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 14 May 2013 13:59:10 +0000 (15:59 +0200)]
First step towards porting sequence wrappers to V4
The idea is to wrap sequence container types such as QStringList or
QList<int> in a JS object that behaves like an array and also shares the
prototype.
The next step is to generalize the QStringList implementation to be re-usable
for the other sequence types.
This also required extending the object iterator with support for these
kind-of array types.
Change-Id: I5f0a14f904233944297708037c944964f1b74923
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 13 May 2013 14:59:40 +0000 (16:59 +0200)]
Fix build of tst_qqmlecmascript
Comment out v8 persistent and weak reference handling related bits and
tests. Otherwise this auto test contains a lot of stuff we need.
Change-Id: Ieafd9c8ea5200e5429d6354243ccaddba4f4772e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 13 May 2013 14:24:40 +0000 (16:24 +0200)]
Fix invocation of QQmlV4Functions in JS/QML
After the renaming of the class we also need to fix the two places where
we refer to the type by name.
Change-Id: I3c446cb31c2ecfc457f161f6b5cd7e30f44b2227
Reviewed-by: Lars Knoll <lars.knoll@digia.com>