platform/upstream/qtdeclarative.git
11 years agoRemove unused variable
Simon Hausmann [Mon, 13 May 2013 08:30:02 +0000 (10:30 +0200)]
Remove unused variable

Change-Id: I20a17d8d1af0027e4be17eb067c61204c41b0f7c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoClean up context initialization
Simon Hausmann [Mon, 13 May 2013 08:25:01 +0000 (10:25 +0200)]
Clean up context initialization

ExecutionContext and its subclasses have various members that are
initialized differently in different call sites. This makes it difficult
to add new members (must find all call sites).

This patch attempts to centralize the member initializations and changes the
usage pattern so that after object creation the corresponding init method needs
to be called before initializing any other members by hand.

Change-Id: I37ac8462ed894c8b234915e114ed032e12bda8bd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd missing pushContext/popContext in SimpleCallContext usage
Simon Hausmann [Mon, 13 May 2013 08:06:32 +0000 (10:06 +0200)]
Add missing pushContext/popContext in SimpleCallContext usage

Otherwise engine->current isn't set correctly, and that would cause issues
if for example method_getOwnPropertyNames in this case would throw an exception

Change-Id: I6f7f9cfec864a8f39e6968ce396237638c118475
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix uninitialized context type variable
Simon Hausmann [Mon, 13 May 2013 07:38:25 +0000 (09:38 +0200)]
Fix uninitialized context type variable

Uninitialized it may lead to incorrect casts if
somebody calls asCallContext() for example.

Change-Id: I12d28bc29567563da5b382f7bc294c394033cbf0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix exports for functions used in inline methods.
Erik Verbruggen [Mon, 13 May 2013 06:53:43 +0000 (08:53 +0200)]
Fix exports for functions used in inline methods.

Change-Id: I69781c6d4697de570be9c0f91560d3bef2376625
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix QV4Engine::globalCode
Simon Hausmann [Sun, 12 May 2013 12:36:02 +0000 (14:36 +0200)]
Fix QV4Engine::globalCode

Gcc appears to optimize away the temporary assignment unless we give
the object a name ;(

Change-Id: I9c10a92ec32654fd690cfd74a0f3e0cbf363de4c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix crash when running some QML auto-tests
Simon Hausmann [Sun, 12 May 2013 13:00:48 +0000 (15:00 +0200)]
Fix crash when running some QML auto-tests

Engine identifiers are strings, which as Managed sub-classes have a pointer to
the internalClass. For strings we generally use engine->emptyClass. So before
creating any identifiers, engine->emptyClass must be initialized. Otherwise
putting any of the identifiers later into for example a QV4::PersistentValue
will cause crashes, because string->internalClass->engine will be an
uninitialized value.

Change-Id: I35a19a1701c5938b61f61e876d656e126a9b8e09
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoInitial port of JS canvas bindings to use QV4::Object subclass instead of V8 resources
Simon Hausmann [Fri, 10 May 2013 11:48:47 +0000 (13:48 +0200)]
Initial port of JS canvas bindings to use QV4::Object subclass instead of V8 resources

This patch comes with the same prototype injection as during the QML locale
patch. This will allow for incremental porting method by method for this huge
binding.

Change-Id: Ie258f021ac6f926302bb375a8ce7a12fb5e0512a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix typo in internal API
Simon Hausmann [Fri, 10 May 2013 14:49:35 +0000 (16:49 +0200)]
Fix typo in internal API

Enumberable -> Enumerable :)

Change-Id: I12afbade4c68c5bf86c3b623a1862e82483db844
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd rudimentary internal field support
Simon Hausmann [Fri, 10 May 2013 14:46:01 +0000 (16:46 +0200)]
Add rudimentary internal field support

This patch maps the internal field support somewhat hackishly through
the public JS properties by prefixing them with _internalfield_.

Internal fields are used in only a few places in QML, including the context2d
bindings, which I'm trying to port along with passing auto tests.

Change-Id: I5fe6cd7a825f437b9d5cccbee8da67336d82002c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix running various QML auto-tests
Simon Hausmann [Fri, 10 May 2013 14:41:27 +0000 (16:41 +0200)]
Fix running various QML auto-tests

The QML QTestLib support relies on listing test functions by doing
for (prop in theQmlComponentToTest) and relies on that iteration to include
the list of test functions declared. QV8QObjectWrapper does not set own
properties for all those functions but instead relies on the fallback
property enumerator and query feature of the V8 API (a patch that is Qt
specific).

This patch implements basic support for iteration over these properties.

The API also has support for named property handlers and indexed property
handlers. The former's dynamic property support is not used in QML, however
dynamic indexed properties are used in the JS sequence wrappers and not
covered by this patch.

Change-Id: Ic9ad3ac55b3c1e0a774a62154f83734255fe594d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImprove error reporting
Simon Hausmann [Fri, 10 May 2013 12:57:12 +0000 (14:57 +0200)]
Improve error reporting

Implement TryCatch::GetMessage by means of converting the exception value to a string.
That often produces rather readable error messages.

Change-Id: I50b040ffae1db19b4c9d962b2759c7eae0ebcea1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused engine pointer in QQmlLocaleData
Simon Hausmann [Fri, 10 May 2013 11:21:26 +0000 (13:21 +0200)]
Remove unused engine pointer in QQmlLocaleData

As per the comment, this is unused now and can be removed :)

Change-Id: I74e26ee46755c6c4fcfc09fa4062690852f8b6cf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix visibility of named function expressions in surrounding environment
Simon Hausmann [Fri, 10 May 2013 11:06:32 +0000 (13:06 +0200)]
Fix visibility of named function expressions in surrounding environment

Quoting from the spec: "However, unlike in a FunctionDeclaration, the
Identifier in a FunctionExpression cannot be referenced from and does not
affect the scope enclosing the FunctionExpression."

This was visible in QML start-up when evaluating helper functions: "(function
foo() { ...})" was compiled and run in the global scope and the returned
funtcion expression is executed later on. However we incorrectly also ended up
entering "foo" as a name into the global scope (which it was executed in),
causing then for example "foo" to become part of the "illegal" names in QML.

The case at point was that qv8sequencewrapper.cpp evaluates a helper script
with a named function expression "compare" and then later the QML canvas
auto-test failed because somewhere it declared a JS function in the scope
of a QML item called "compare".

All tests still pass, we do handle the case of looking up the named function
already in qv4context.cpp (getProperty, etc.).

Change-Id: Id9daaff355ce35ae4bc96dcbaba9710cd8cc2211
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation of some qquick auto tests
Simon Hausmann [Fri, 10 May 2013 06:36:07 +0000 (08:36 +0200)]
Fix compilation of some qquick auto tests

Inline functions here use std::numeric_limits, so include the header
file.

Change-Id: Ib84f41b65ee965c3e0868f85643491feecceade5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPort the of qml locale getters to V4 accessors
Simon Hausmann [Thu, 9 May 2013 12:36:32 +0000 (14:36 +0200)]
Port the of qml locale getters to V4 accessors

Added support for getters/setters to the class generator
as well as a simple help template for calling the member
function getters.

Change-Id: I3bb287a53d9f249837fa2c513d4886873476ad95
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix unsafe casting to target thisobject in class generator
Simon Hausmann [Wed, 8 May 2013 18:26:04 +0000 (20:26 +0200)]
Fix unsafe casting to target thisobject in class generator

We must also check if the asFoo() on the managed object succeeds
before calling the method.

Change-Id: I26ed56fec044b54221ca44e7789a2e9d0acec9ec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPorted over a few more locale functions
Simon Hausmann [Wed, 8 May 2013 18:11:34 +0000 (20:11 +0200)]
Ported over a few more locale functions

This code is becoming much simpler :)

Change-Id: Icd31bedd13f4a8fce145992b2a7706594ac809bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoBegin implement C++ style wrappers in QQmlLocale
Simon Hausmann [Wed, 8 May 2013 14:48:09 +0000 (16:48 +0200)]
Begin implement C++ style wrappers in QQmlLocale

The locale.currencySymbol function is converted into a member function
of the wrapper. For the time of the transition the prototype chain is
modified to be obj -> v8 proto template -> v4classgen generated proto

Change-Id: I72913e9d284a2a3678b23c7d7ce27fbb3447f1fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCleanup v8 dependencies from QQmlV8Function
Lars Knoll [Wed, 8 May 2013 14:22:39 +0000 (16:22 +0200)]
Cleanup v8 dependencies from QQmlV8Function

... and rename it to QQmlV4Function

Change-Id: Iad72347babf62691e26306877d4f229fda127eb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8 dependencies from QQmlV4Handle
Lars Knoll [Wed, 8 May 2013 13:56:03 +0000 (15:56 +0200)]
Remove v8 dependencies from QQmlV4Handle

Change-Id: I87d2183738ec7cfeea846a28f2b9aed79a233f68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoReplace V8 resource in QQmlLocale with managed subclass
Simon Hausmann [Wed, 8 May 2013 13:55:44 +0000 (15:55 +0200)]
Replace V8 resource in QQmlLocale with managed subclass

This is more lightweight and is the next step towards moving the
class binding away from V8.

Change-Id: Ic9c5901d3a6ef2f665ab22df9d2fcbb0698120eb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoConverted remaining regular QQmlLocale functions to QV4
Simon Hausmann [Wed, 8 May 2013 07:21:57 +0000 (09:21 +0200)]
Converted remaining regular QQmlLocale functions to QV4

What remains are property accessors

Change-Id: Iadc5168b7759dfd6d4fc0e8f28e286ddd684bc7f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix PersistentValue::isEmpty()
Lars Knoll [Wed, 8 May 2013 13:21:42 +0000 (15:21 +0200)]
Fix PersistentValue::isEmpty()

A PersistentValue can have a d pointer and still be
empty (because it contains an empty value).

This fixes an assertion when destructing the QML engine
and qmlscene finally doesn't crash on exit anymore :)

Change-Id: Idce2bb42f562526af8ec09d9062cce7ac825a8dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove the remaining traces of v8::persistent
Lars Knoll [Wed, 8 May 2013 13:04:25 +0000 (15:04 +0200)]
Remove the remaining traces of v8::persistent

Change-Id: Id542914c64558c1eba30a300cb10606fa499e594
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8::persistent usage from particles
Lars Knoll [Wed, 8 May 2013 12:36:48 +0000 (14:36 +0200)]
Remove v8::persistent usage from particles

Change-Id: I69cd4ccf51c40e2ee63f024a7ccc2d8b35b14ae4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8::persistent usage from local storage
Lars Knoll [Wed, 8 May 2013 12:30:24 +0000 (14:30 +0200)]
Remove v8::persistent usage from local storage

Change-Id: Ifda1ad5d4cfab86e9ced9e415d39ee392c676882
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8::Persistent usage from qquickcanvas
Lars Knoll [Wed, 8 May 2013 12:25:40 +0000 (14:25 +0200)]
Remove v8::Persistent usage from qquickcanvas

Change-Id: If714583818f894e8ac839cd35cd475deff00eafb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the QV4::Function out of qv4functionobject_p.h
Lars Knoll [Wed, 8 May 2013 12:24:30 +0000 (14:24 +0200)]
Move the QV4::Function out of qv4functionobject_p.h

QV4::Function has dependencies onto wtf. Moving it into it's
own header allows including qv4functionobject from other modules.

Change-Id: Ie6947085026a26ea250c232cc3b219737d009f5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8::Persistent usage from qquickloader
Lars Knoll [Wed, 8 May 2013 12:02:11 +0000 (14:02 +0200)]
Remove v8::Persistent usage from qquickloader

Change-Id: I0a7ffdc3ed159ec8f506cadc73ba8ae77c003a41
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAnother v8::Persistent removed
Lars Knoll [Wed, 8 May 2013 11:48:53 +0000 (13:48 +0200)]
Another v8::Persistent removed

Change-Id: I581f848730811aab7fbd36bb44ca9a71703c53d8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qqmldelegatemodel to not use v8::Persistent
Lars Knoll [Wed, 8 May 2013 11:32:24 +0000 (13:32 +0200)]
Convert qqmldelegatemodel to not use v8::Persistent

Change-Id: I337aaa546f7fa93c829ad0f3c1f651347e93f8d4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qqmladaptermodel to use QV4::persistentValue
Lars Knoll [Wed, 8 May 2013 11:29:28 +0000 (13:29 +0200)]
Convert qqmladaptermodel to use QV4::persistentValue

Change-Id: I231c166d796c64fd8a50da54893383f5241ce81d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove qqmlvmemetaobject over to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 11:16:20 +0000 (13:16 +0200)]
Move qqmlvmemetaobject over to use QV4::PersistentValue

Change-Id: Ifdf57d6cb266a7b63fec9f1f85bda8070c44036f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd more convenient get/put API to QV4::Object
Lars Knoll [Wed, 8 May 2013 11:14:40 +0000 (13:14 +0200)]
Add more convenient get/put API to QV4::Object

We can retrieve the current context from the Object
itself, so it's possible to offer a simplified
get/put API that doesn't require a context argument.

Clean up a circular include dependency between qv4engine
and qv4object.

Change-Id: I39a37d479ace1ffbfe8ac59b393cab8e4be07677
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qqmllocale to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 10:33:22 +0000 (12:33 +0200)]
Convert qqmllocale to use QV4::PersistentValue

Change-Id: I9fd82f6f1d76d6ff8cbf0e7626fb32233c563ece
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qqmljavascriptexpression to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 10:31:23 +0000 (12:31 +0200)]
Convert qqmljavascriptexpression to use QV4::PersistentValue

Change-Id: Idd704b55be61dd78c59fffdf966fc8497af852d6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qqmltypeloader to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 09:06:31 +0000 (11:06 +0200)]
Convert qqmltypeloader to use QV4::PersistentValue

Change-Id: Ifc4e2aea870a3a8ab37cd4d0674c672f0850f98f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd flag to the engine to enable/disable RegExp JITting.
Erik Verbruggen [Tue, 7 May 2013 09:54:45 +0000 (11:54 +0200)]
Add flag to the engine to enable/disable RegExp JITting.

Change-Id: I4b632e6f8ab7cf20576f94764ed506de8be63efb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove QQuickworkerscript over to QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:17:45 +0000 (07:17 +0200)]
Move QQuickworkerscript over to QV4::PersistentValue

Change-Id: I6ff1d4942eac147a5bebd4a7be0774dabae91a04
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert xmlhttprequest to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:09:26 +0000 (07:09 +0200)]
Convert xmlhttprequest to use QV4::PersistentValue

Change-Id: I9001769225323f73cf8e50823d608dd0b5a52707
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoconvert qv8sequencewrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:32:45 +0000 (07:32 +0200)]
convert qv8sequencewrapper to use QV4::PersistentValue

Change-Id: I211121a1cd389e7973ca1395e46c8f96f73d3a50
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qv8qobjectwrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:32:31 +0000 (07:32 +0200)]
Convert qv8qobjectwrapper to use QV4::PersistentValue

Change-Id: Iae8849fe105c242266ffc5e9b790d42ccd6d7955
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoconvert qv8variantwrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:31:54 +0000 (07:31 +0200)]
convert qv8variantwrapper to use QV4::PersistentValue

Change-Id: Iccccc41a031e72b7ed7ac90bf022f5e1bdea3876
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qv8Valuetypewrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:31:36 +0000 (07:31 +0200)]
Convert qv8Valuetypewrapper to use QV4::PersistentValue

Change-Id: I175bd2d84425c5ae9497a5a3644474bee34e1a5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qv8typewrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:31:24 +0000 (07:31 +0200)]
Convert qv8typewrapper to use QV4::PersistentValue

Change-Id: I6d33528fb5c7f2cd5eca1a742d6dcd217988e466
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qv8listwrapper to use QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:31:04 +0000 (07:31 +0200)]
Convert qv8listwrapper to use QV4::PersistentValue

Change-Id: I1a85ae5ca0f4688174cda6127a326aed51f64b1b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qv8include to QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:30:42 +0000 (07:30 +0200)]
Convert qv8include to QV4::PersistentValue

Change-Id: I9764ad7d28932bd67e3d284415c26f1b3b837056
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert context wrapper to QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 05:30:20 +0000 (07:30 +0200)]
Convert context wrapper to QV4::PersistentValue

Change-Id: Ied2ac64aacf92ebaa606e478f51505d97953e6c0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix possible crash
Lars Knoll [Tue, 7 May 2013 15:53:46 +0000 (17:53 +0200)]
Fix possible crash

The m_instanceTemplate member in the v8::FunctionTemplate
can in some cases be uninitialized.

Change-Id: I6d827889b17dbd4b9d26df48173cbf02c64d76b1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix the doubly linked list logic in QV4::PersistentValue
Lars Knoll [Wed, 8 May 2013 08:51:22 +0000 (10:51 +0200)]
Fix the doubly linked list logic in QV4::PersistentValue

The old code wasn't hooking the list up correctly, leading
to PersistentValues being garbage collected.

Change-Id: Id5613e35a3adb34181be9863cf1a7e994571241f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConverted the remaining locale extensions to Date and String protos to V4
Simon Hausmann [Tue, 7 May 2013 13:06:40 +0000 (15:06 +0200)]
Converted the remaining locale extensions to Date and String protos to V4

Change-Id: Iaf7de0fba8015a7de59aeeafd9ba76766945af48
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove more v8::Persistent usages
Lars Knoll [Tue, 7 May 2013 10:29:30 +0000 (12:29 +0200)]
Remove more v8::Persistent usages

Change-Id: Ifa1706e2e609ded86a8bc1a840ca2ed36b869098
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of QV8Engine::qtDateTimeFromJsDate
Simon Hausmann [Tue, 7 May 2013 11:17:08 +0000 (13:17 +0200)]
Get rid of QV8Engine::qtDateTimeFromJsDate

Change-Id: I6a748ace761661ffe40e8fa73839f974e8a0afac
QV4::DateObject has a very convenient toQDateTime() function :)
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMake the default constructor of PersistentValue not allocate a d pointer
Lars Knoll [Tue, 7 May 2013 11:17:57 +0000 (13:17 +0200)]
Make the default constructor of PersistentValue not allocate a d pointer

This is also required to change the v8::Persistent in QQmlData over
to v4.

Change-Id: Ib3164ded9c772e977f6b43ef6163a3aa74da3800
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInject the QML Number extensions directly into the Number proto and ctor
Simon Hausmann [Tue, 7 May 2013 11:04:12 +0000 (13:04 +0200)]
Inject the QML Number extensions directly into the Number proto and ctor

Change-Id: Ibb939057cbd1bf5d68972e656ddeae1e58a0d6a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPorted locale extensions to the Number prototype to SimpleCallContext
Simon Hausmann [Tue, 7 May 2013 10:56:06 +0000 (12:56 +0200)]
Ported locale extensions to the Number prototype to SimpleCallContext

Change-Id: I709b284d982b0b6c8f714d21f18b550d8380cde5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd infrastructure for changing InvocationCallback style functions to the final Simpl...
Simon Hausmann [Tue, 7 May 2013 10:35:56 +0000 (12:35 +0200)]
Add infrastructure for changing InvocationCallback style functions to the final SimpleCallContext based interface

Change-Id: Ie7f838a5469cb3f899e1a84d17c4cd81c6d8b339
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRename Value::deletedValue() to Value::emptyValue()
Lars Knoll [Tue, 7 May 2013 10:56:58 +0000 (12:56 +0200)]
Rename Value::deletedValue() to Value::emptyValue()

This reflects a bit better how this special value is being used.

Change-Id: I136c8ab648bf82102fb2627e17c574a980c4d5ff
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChange some v8::Persistent to QV4::PersistentValue
Lars Knoll [Tue, 7 May 2013 06:54:12 +0000 (08:54 +0200)]
Change some v8::Persistent to QV4::PersistentValue

Change-Id: I2c4e98cf7e778de9aafabdbd68e6682106343d12
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMore steps towards eliminating the v8 layer
Simon Hausmann [Tue, 7 May 2013 09:22:52 +0000 (11:22 +0200)]
More steps towards eliminating the v8 layer

* Changed the return type of the InvocationCallback from a v8 handle to a QV4::Value
* Removed v4 auto tests and fixed build of other tests

Change-Id: Ic927b925923ca8785170689a5c260969fd1cb794
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace v8::True()/False() with QV4::Value equivalents
Simon Hausmann [Tue, 7 May 2013 07:58:00 +0000 (09:58 +0200)]
Replace v8::True()/False() with QV4::Value equivalents

Change-Id: I8d4ff185e8d33ce3d6ee11dd9a709138e35d6a48
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace v8::Null() with QV4::Value::nullValue()
Simon Hausmann [Tue, 7 May 2013 07:56:09 +0000 (09:56 +0200)]
Replace v8::Null() with QV4::Value::nullValue()

Change-Id: I7901d5282afd71c1fd66bab223b2811f0d14b5f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace v8::Undefined() with QV4::Value::undefinedValue()
Simon Hausmann [Tue, 7 May 2013 07:54:05 +0000 (09:54 +0200)]
Replace v8::Undefined() with QV4::Value::undefinedValue()

Change-Id: I4c7bb5bcc1bc15a982bb83d2597e6ae4bc5710cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix 475 compiler warnings.
Erik Verbruggen [Tue, 7 May 2013 10:10:18 +0000 (12:10 +0200)]
Fix 475 compiler warnings.

Change-Id: I2d8f0f33da21f1f978d2d63ce2b536cedf51b3f5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoPorted RegExp object to class generator
Simon Hausmann [Mon, 6 May 2013 12:12:33 +0000 (14:12 +0200)]
Ported RegExp object to class generator

Change-Id: Ic1056b1743d4368fd4224dd0aaac22b0b81ed3fe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPorted boolean prototype over to class generator
Simon Hausmann [Mon, 6 May 2013 12:07:36 +0000 (14:07 +0200)]
Ported boolean prototype over to class generator

Change-Id: Ib8c825a6f345648951b47ca1a89a99c6d55c0a9c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of v8::Local
Lars Knoll [Mon, 6 May 2013 13:57:06 +0000 (15:57 +0200)]
Get rid of v8::Local

The class was doing exactly the same thing as v8::Handle
in our implementation. Removing it cleans up quite a bit
of code.

Change-Id: I37a3dcdef062fc388751e9ef0a158b5926ba2efb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert some v8::Persistent to v4
Lars Knoll [Mon, 6 May 2013 13:32:56 +0000 (15:32 +0200)]
Convert some v8::Persistent to v4

Change-Id: Ic6613b020dbbb1ee75e2096707d8fb1aa228083d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoLess debug output
Lars Knoll [Mon, 6 May 2013 13:25:53 +0000 (15:25 +0200)]
Less debug output

Change-Id: I55faf0ebc5926b987d47d1afa12d87da2d2bcea6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCreate and delete the QJSEngine with the QV8Engine.
Lars Knoll [Mon, 6 May 2013 13:11:46 +0000 (15:11 +0200)]
Create and delete the QJSEngine with the QV8Engine.

Change-Id: I1356ccee5400c388904bab474a6c9059ae34db2c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUse a doubly linked list for PersistentValue
Lars Knoll [Mon, 6 May 2013 13:11:01 +0000 (15:11 +0200)]
Use a doubly linked list for PersistentValue

This makes cleanup easier, more consistent and actually
work.

Change-Id: I5b58b6649ed527fd9f216c67ea609b49228c874a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert QQmlPropertyCache to use QV4::persistentValue instead of the v8 version
Lars Knoll [Mon, 6 May 2013 10:43:39 +0000 (12:43 +0200)]
Convert QQmlPropertyCache to use QV4::persistentValue instead of the v8 version

The V4 persistent values are safer to use, as the v8 ones never
implemented proper semantics when the engine gets deleted.

Change-Id: I787f8c01c70828f22ac60f0ac25201cdfa5a617f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd unreachable BasicBlock removal.
Erik Verbruggen [Mon, 6 May 2013 09:06:16 +0000 (11:06 +0200)]
Add unreachable BasicBlock removal.

This is band-aid to prevent CompressTemps crashing when trying to
allocate a stack slot for temps that are unreachable (or rephrased: they
are never live).

Change-Id: I021f319b07dd6f50553bb270aa40b0bcb48af4b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compiler error and warning.
Erik Verbruggen [Mon, 6 May 2013 09:04:50 +0000 (11:04 +0200)]
Fix compiler error and warning.

Change-Id: Ifc458df6f2804cbc4a78b0d0b3b582edd974a61d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix leakage of internal class hierarchy
Simon Hausmann [Mon, 6 May 2013 11:29:24 +0000 (13:29 +0200)]
Fix leakage of internal class hierarchy

Allocate the InternalClass instances in a memory pool and delete them
all in one shot at the end. The memory pool won't call the destructor,
so we have to introduce our own recursive destroy() method, that will
free the memory allocated.

Change-Id: I507a893475181f765acf545b5cd2bfccc8c29747
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoPorted string object over to the class generator
Simon Hausmann [Mon, 6 May 2013 10:52:25 +0000 (12:52 +0200)]
Ported string object over to the class generator

Change-Id: I1b718f4963ade13e8d9a660785070c566d5872b0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify JS bindings generation
Simon Hausmann [Sat, 27 Apr 2013 19:21:44 +0000 (21:21 +0200)]
Simplify JS bindings generation

Added a little helper script that can generate the code to
set up the prototype properties

Change-Id: I957ed4419c8b16398720fea4203c1a00434c4fba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMove the internalClass pointer from Object to Managed
Lars Knoll [Mon, 6 May 2013 09:37:53 +0000 (11:37 +0200)]
Move the internalClass pointer from Object to Managed

This allows us to get back the ExecutionEngine for all
memeory managed objects, so we can avoid lots of special
handling for String objects.

Simplify and cleanup QV4::PersistentValue and make use
of the available engine pointer in Managed.

Change-Id: Ia2e08b6207f7e706c23be219d5f6e74b414035a3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoBetter make InternalClass::addMember() safe
Lars Knoll [Sun, 5 May 2013 20:08:52 +0000 (22:08 +0200)]
Better make InternalClass::addMember() safe

The method should not get called repeatedly with the same member,
but currently this still happens (esp. as we have the v4 engine in TLS),
so let's make the call safe.

Change-Id: Icc3bce48af67f77c7b64040685b1c861c23f5b8d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix keywords test
Lars Knoll [Sat, 4 May 2013 21:57:45 +0000 (23:57 +0200)]
Fix keywords test

The reserved keywords are allowed as property names in objects.

Change-Id: I5e0025ff374e0e154df81590660fc96b5c529ea4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix QJSEngine::evaluate
Lars Knoll [Sat, 4 May 2013 21:33:23 +0000 (23:33 +0200)]
Fix QJSEngine::evaluate

if EvalFunction::parseSource returns 0, it means there wasn't
anything to parse, not that the input was invalid, so simply
return undefined in this case.

Change-Id: I13aafaba40723d4aa7c0f2e7f3eddfac86239cd0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSome fixes to the autotest
Lars Knoll [Sat, 4 May 2013 21:29:51 +0000 (23:29 +0200)]
Some fixes to the autotest

Remove an XFAIL that now passes, and some bogus code.

Change-Id: I75ef6e54c5efe30e125003e9f2946f3d4e0533ea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some bugs in converting to and from QDateTime
Lars Knoll [Sat, 4 May 2013 21:18:20 +0000 (23:18 +0200)]
Fix some bugs in converting to and from QDateTime

Use the conversion methods in QDateTime instead of trying
to do our own thing in qv4dateobject.

Change-Id: Ib44b3e0c60b14f94fd717a6954610d249a1bea66
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInitialize member
Lars Knoll [Sat, 4 May 2013 21:18:06 +0000 (23:18 +0200)]
Initialize member

Change-Id: Iaa933f34fe5a44664f22b4acac5224241c1d864c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSet the correct Object type for all date objects
Lars Knoll [Sat, 4 May 2013 20:15:04 +0000 (22:15 +0200)]
Set the correct Object type for all date objects

Change-Id: I25b229809d07cb1dda875b84e2c48e056397050c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller fixes to RegExp
Lars Knoll [Sat, 4 May 2013 20:09:55 +0000 (22:09 +0200)]
Smaller fixes to RegExp

The source property is supposed to contain an escaped version
of the literal, so that /source/ gives a valid regexp literal
again. toString() is supposed to use that same source property.

Change-Id: I2522ab76746002f6437839adacda7d453f8baa45
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd name property for function objects
Lars Knoll [Sat, 4 May 2013 08:26:54 +0000 (10:26 +0200)]
Add name property for function objects

This is an extension to ECMAScript, but implemented by both V8 and
JSC. It also fixes quite some of our auto tests.

Change-Id: Id7b868922cb64f1a881ec50f1b40397d6e85d316
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compilation of test
Lars Knoll [Fri, 3 May 2013 20:42:13 +0000 (22:42 +0200)]
Fix compilation of test

Testing interoperability between our API and v8 doesn't make
any sense anymore anyway.

Change-Id: Ice97c253974a49e4dd8890d69ec0d0bea19ae110
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUINT_MAX is not a valid array index
Lars Knoll [Fri, 3 May 2013 20:40:58 +0000 (22:40 +0200)]
UINT_MAX is not a valid array index

Make sure indexed getter and setter in QJSValue do the right
thing for UINT_MAX

Change-Id: I57bc24016d85050b30422efc18479d17ec95ba56
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix QJSEngine::newArray()
Lars Knoll [Fri, 3 May 2013 20:40:43 +0000 (22:40 +0200)]
Fix QJSEngine::newArray()

Change-Id: I1a1ab413418066f703d043101f79baf39a0d7481
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoVarious fixes to RegExp
Lars Knoll [Fri, 3 May 2013 20:38:57 +0000 (22:38 +0200)]
Various fixes to RegExp

Duplicated pattern flags in regexp literals should lead to a parse error
Make sure RegExpObjects created from a QRegExp have proper type and vtable
Fix RegExp constructor when invoked with an empty pattern

Fixes two qjsengine autotests.

Change-Id: Idbb7dde73f20cb81dea4a07cf0f2cb030aee321b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove another methods from v8:Context
Lars Knoll [Fri, 3 May 2013 14:51:32 +0000 (16:51 +0200)]
Remove another methods from v8:Context

Change-Id: I1f476931e7d09efc72e64dcb1b86335c987678ea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove some more v8 API
Lars Knoll [Fri, 3 May 2013 14:30:29 +0000 (16:30 +0200)]
Remove some more v8 API

Change-Id: Ia5283adf7aee697a297b1d1c305b376ff932d341
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove most remaining traces of v8::Context
Lars Knoll [Fri, 3 May 2013 12:31:24 +0000 (14:31 +0200)]
Remove most remaining traces of v8::Context

The class is now empty apart from two static
methods.

Change-Id: Ia474a2ebd4153e031d9a77e20ac9dfa359456f3e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove v8::HandleScope
Lars Knoll [Fri, 3 May 2013 12:14:57 +0000 (14:14 +0200)]
Remove v8::HandleScope

This class never made sense with v4... :)

Change-Id: Id597d791d1adf52cc821d6d46f57cb24d1acd343
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup v8 Context handling
Lars Knoll [Fri, 3 May 2013 12:08:55 +0000 (14:08 +0200)]
Cleanup v8 Context handling

We don't need or use v8 Context objects, so it's
sufficient to have one global context for now. Remove
all code related to entering or leaving Context's.

Change-Id: I4f7ddaa4907e59de5713368fa13bbc40e5830542
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused stuff from v8::Isolate class
Lars Knoll [Fri, 3 May 2013 11:06:50 +0000 (13:06 +0200)]
Remove unused stuff from v8::Isolate class

Change-Id: I59efbd73af2eee3e0a67c823341bea0ee9fb0ebb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compilation
Lars Knoll [Fri, 3 May 2013 11:05:27 +0000 (13:05 +0200)]
Fix compilation

Change-Id: If8a393c07953b94b16bb0cc93d56d38d6496d67c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of qjsconverter*
Lars Knoll [Thu, 2 May 2013 20:33:47 +0000 (22:33 +0200)]
Get rid of qjsconverter*

Replace the conversion methods by better API directly in the v8
objects.

Change-Id: I9d39b1db38def9aa6d1ef8673e7b1bf36e5b830a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>