platform/upstream/qtdeclarative.git
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>
11 years agoRemove the ExecutionContext from some signatures, replace it with the engine in others
Lars Knoll [Thu, 2 May 2013 19:37:20 +0000 (21:37 +0200)]
Remove the ExecutionContext from some signatures, replace it with the engine in others

Most places we actually only need the engine, not the context. Fix this
in our internal APIs. Also remove the context where it's not required.

Change-Id: Ib6281e7b9de9124612a9df24df9bedf47559b159
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller cleanup
Lars Knoll [Thu, 2 May 2013 18:48:09 +0000 (20:48 +0200)]
Smaller cleanup

Use QJSConverter to convert from QDateTime to JS Date
instead of using another implementation doing the same.

Change-Id: Id87100c2813f2617ff9f8635b02e7031a6becc8f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChange some more API in qv8engine over to v4.
Lars Knoll [Tue, 30 Apr 2013 22:00:44 +0000 (00:00 +0200)]
Change some more API in qv8engine over to v4.

Change-Id: I785e1b8682e864235e926acab758b9bdbfede114
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSimplify function signature for ExecutionEngine::newArrayObject
Lars Knoll [Tue, 30 Apr 2013 21:43:26 +0000 (23:43 +0200)]
Simplify function signature for ExecutionEngine::newArrayObject

Change-Id: Id8d79e0029816a043798feaee97e1ecb05d5c856
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert qjsconverter to v4 based API
Lars Knoll [Tue, 30 Apr 2013 21:02:33 +0000 (23:02 +0200)]
Convert qjsconverter to v4 based API

Longer term the whole class should go, but for
now this'll do.

Change-Id: I17b13848a07d415633606faa1c93ff3a9f54a45a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove QV8Engine::to/fromVariant over to a v4 based API
Lars Knoll [Tue, 30 Apr 2013 20:27:36 +0000 (22:27 +0200)]
Move QV8Engine::to/fromVariant over to a v4 based API

Change-Id: Ie44de10cbd970715345e2c428db666dc6233b39c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove the old v4 and rename v4vm to v4
Simon Hausmann [Sat, 27 Apr 2013 19:26:19 +0000 (21:26 +0200)]
Remove the old v4 and rename v4vm to v4

For archeologists v4 can still be found in the history. Otherwise
it is confusing to have both engines in the tree.

Change-Id: Ice05afb7013f0fe536aab6bb19114f696c58fc94
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoConvert QObject methods inQV8Enginer to v4 based API
Lars Knoll [Sun, 28 Apr 2013 19:40:12 +0000 (21:40 +0200)]
Convert QObject methods inQV8Enginer to v4 based API

Change-Id: I954daac83b36d4cb667ecd7923577af90cfc4f9e

Fixup newQObject

Change-Id: I7b81754165b319a7fd81838313d0d654aad1132e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd automatic conversion from QV4::Value to v8::Handle<T>
Lars Knoll [Sun, 28 Apr 2013 19:25:45 +0000 (21:25 +0200)]
Add automatic conversion from QV4::Value to v8::Handle<T>

This simplifies a lot of the code adaptations required to
move over to v4.

Change-Id: Id5454a2ecda9c3b7cbabf46638e7634968d24237
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove more methods on QV8Engine over to use v4 based syntax
Lars Knoll [Sun, 28 Apr 2013 03:36:21 +0000 (05:36 +0200)]
Move more methods on QV8Engine over to use v4 based syntax

Change-Id: I7d3501a2c4cd0d749c7c30b5c60fee12cde58aa4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of QV8Engine::toString()
Lars Knoll [Sun, 28 Apr 2013 03:09:39 +0000 (05:09 +0200)]
Get rid of QV8Engine::toString()

It's easier to use toQString() on a QV4::Value

Change-Id: I9bf22cb72607b32948e77c632d2f9b8fe120ea41
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove QV8Engine::freezeObject over to use v4 APIs
Lars Knoll [Sun, 28 Apr 2013 01:13:28 +0000 (03:13 +0200)]
Move QV8Engine::freezeObject over to use v4 APIs

Change-Id: I5ce76404db4ab386535df598a2528b0c3201f2ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix QV8Engine::getOwnPropertyNames API
Lars Knoll [Sat, 27 Apr 2013 14:28:51 +0000 (07:28 -0700)]
Fix QV8Engine::getOwnPropertyNames API

Change-Id: I0b28835e9fe51df74ca87919be63f001d4a5d090
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix conversion of values to QStrings
Lars Knoll [Sat, 27 Apr 2013 14:23:31 +0000 (07:23 -0700)]
Fix conversion of values to QStrings

Implement proper conversion to a QString without requiring an
ExecutionContext.

Change-Id: I6bcd3bcad0a32c483cea79ec1e1abac3b04d39e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert some code in qqmlcomponent over to use v4
Lars Knoll [Sat, 27 Apr 2013 14:01:41 +0000 (07:01 -0700)]
Convert some code in qqmlcomponent over to use v4

Add an evaluateScript() method to qv8engine, that replaces the
v8::Script class

Change-Id: I00e0e18d4e3dbcba26632ca3492749a6b0f1a7f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThe global context is not a unique instance
Lars Knoll [Tue, 23 Apr 2013 03:22:44 +0000 (20:22 -0700)]
The global context is not a unique instance

The global context is simply a wrapper around the global object, and
we can create several of those (through eval()). So better check for
the type of the context here.

Change-Id: Ib31af3249f2a141a6f784e54b4175a7f187743e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix crash on Windows
Simon Hausmann [Mon, 29 Apr 2013 09:44:03 +0000 (11:44 +0200)]
Fix crash on Windows

Follow-up to commit 67b09aef34ff7997808e04194cdb92273ec76f14 about changing
the masm back-end to support returning the VM::Value in eax:edx instead
of through an invisible first pointer parameter: If the address of where
to store the return value is passed on the stack, it is the callee's
responsibility to take that one off the stack. We do that by emulating the
ret(n) instruction. However on Windows we don't want to do that because
we use the eax:edx register pair, so the correct #ifdef to use here is
RETURN_VALUE_IN_REGISTER, not ARGUMENTS_IN_REGISTERS.

Change-Id: I73ebd0688870348ed65ef91d7f2d73d0ba3ec542
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix build on Windows
Simon Hausmann [Mon, 29 Apr 2013 08:13:50 +0000 (10:13 +0200)]
Fix build on Windows

Move MSVC floating point math workarounds into qv4global.h to avoid inclusion of MathExtras.h from semi-public header files

Change-Id: I8c5d672d05c42f653c8aa5c6f5d6e6ee0b3ec2e7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix build and crash on 64-bit
Simon Hausmann [Mon, 29 Apr 2013 07:56:00 +0000 (09:56 +0200)]
Fix build and crash on 64-bit

Change-Id: I058f598a7937a2d0b2bc38bfa5afa72c3d2489ab
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix occasional crashes on x86 due to alignment issues
Simon Hausmann [Thu, 25 Apr 2013 02:19:17 +0000 (04:19 +0200)]
Fix occasional crashes on x86 due to alignment issues

As it turns out, the stack is required to be aligned to 16 bytes on x86. This
patch makes sure of that.

This also rewrites the parameter handling for function calls to be much simpler
and also faster by replacing the use of individual push instructions for stack
arguments with one stack pointer subtraction for all arguments followed by
shorter moves (poke) for each argument.

Change-Id: Id8199654bdf729c7858c1a223f788ca3a2d03fc8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoremove unused push overloads
Simon Hausmann [Thu, 25 Apr 2013 01:18:27 +0000 (03:18 +0200)]
remove unused push overloads

Change-Id: I58305396d11bcda011418fa9155cbc75741177fe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix crash when deleting properties while iterating over properties
Simon Hausmann [Wed, 24 Apr 2013 14:26:05 +0000 (16:26 +0200)]
Fix crash when deleting properties while iterating over properties

The delete operator may end up removing entries from the namedMap, so the
memberIndex may get out of bounds. Instead of accessing o->internalClass,
remember the object class at the point when memberIndex is initialized,
so that it always stays in range.

Change-Id: I509f823d48c480371e28c537513bd9dd9e314986
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSpeed up object literal construction
Simon Hausmann [Tue, 23 Apr 2013 05:31:02 +0000 (07:31 +0200)]
Speed up object literal construction

Define the internal class at compile (isel) time, so that creation
of the object at run-time is very fast.

Change-Id: Ie153cda695cefde9d7118a7a65f1ff7e78f120cc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix various memory leaks
Simon Hausmann [Mon, 22 Apr 2013 18:00:14 +0000 (20:00 +0200)]
Fix various memory leaks

* Remember to delete the statement's extra data in the dead assignment
  removal optimization as well as in the dead block elimination
* Delete the identifier cache in the engine

Change-Id: Ida79c05f12f4ffc4f17e3198c42da0603a51f815
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement lookup calls inline
Simon Hausmann [Mon, 22 Apr 2013 13:39:37 +0000 (15:39 +0200)]
Implement lookup calls inline

Instead of going through two-liner lookup helper methods to fetch and
call the virtual lookup method, do it all inline in the generated
assembly.

Change-Id: I25307177eaa8848c54fec7745f6f36d1788410dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCorrect number of parameters for call to __qmljs_foreach_iterator_object
Simon Hausmann [Sat, 27 Apr 2013 13:23:10 +0000 (15:23 +0200)]
Correct number of parameters for call to __qmljs_foreach_iterator_object

The context is already passed as first parameter, so there's no need
to also pass it as the last parameter again.

Change-Id: Icc7e318ddad9fb79b3a636384777acf8263f0882
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix return type for C linkage.
Erik Verbruggen [Wed, 24 Apr 2013 12:28:52 +0000 (14:28 +0200)]
Fix return type for C linkage.

warning:
      '__qmljs_numberToString' has C-linkage specified, but returns user-defined type 'QString' which is incompatible with C [-Wreturn-type-c-linkage]
QString __qmljs_numberToString(double num, int radix = 10);
        ^

Change-Id: I1537b0e5f6c61915f4bd3c4d4607846b74e7a6d9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix class export.
Erik Verbruggen [Wed, 24 Apr 2013 12:28:00 +0000 (14:28 +0200)]
Fix class export.

The method QQmlV4Handle::fromValue is used in QQuickXmlListModel::get.

Change-Id: Ia5ae8e0b5aaa3e3873fbc3caacdd73f97c94a987
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix struct v.s. class forward declarations.
Erik Verbruggen [Wed, 24 Apr 2013 12:26:38 +0000 (14:26 +0200)]
Fix struct v.s. class forward declarations.

Change-Id: I8f7f6282339ca798661e59cef256c305c95f7fe1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSuppress unused parameter warning.
Erik Verbruggen [Wed, 24 Apr 2013 12:25:45 +0000 (14:25 +0200)]
Suppress unused parameter warning.

Change-Id: I1dcc3f2c5ee85f3c21035e5c93188c841c727727
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove some unused methods
Lars Knoll [Sun, 21 Apr 2013 20:50:26 +0000 (22:50 +0200)]
Remove some unused methods

And get rid of qv8engine_impl_p.h

Change-Id: I676532acd2fa24f4d2bab282055b7a83254a0e75
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChange variant conversion methods to use V4 API
Lars Knoll [Sun, 21 Apr 2013 20:42:44 +0000 (22:42 +0200)]
Change variant conversion methods to use V4 API

Change-Id: Ic1a18e71592baf5e5babde250f77c4a60e613041
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd missing return values
Andrew Knight [Fri, 19 Apr 2013 14:45:47 +0000 (17:45 +0300)]
Add missing return values

This is a compiler error condition under MSVC.

Change-Id: I86ded06f3c1663499cfef35d727d0c82c4f6a320
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert a few more things to v4
Lars Knoll [Fri, 19 Apr 2013 21:18:43 +0000 (23:18 +0200)]
Convert a few more things to v4

Change-Id: Ia6186fbd352f78433204dcf628d4e0071f12a389
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDisable the old v4 engine by default
Lars Knoll [Fri, 19 Apr 2013 20:45:05 +0000 (22:45 +0200)]
Disable the old v4 engine by default

Left the code in there, as a reference for how we might want to
build up binding evaluation in the new v4.

Change-Id: I5c81ea986d642b524fb02087d819b39c4e3fb257
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmall cleanup in __qmljs_equal
Lars Knoll [Fri, 19 Apr 2013 19:53:08 +0000 (21:53 +0200)]
Small cleanup in __qmljs_equal

Change-Id: I984c1c0e7255d995866c9c4436b5f4f23a0dfa72
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSet up the Lookup callbacks through the Managed vtable
Lars Knoll [Fri, 19 Apr 2013 18:25:41 +0000 (20:25 +0200)]
Set up the Lookup callbacks through the Managed vtable

This will allow us to fully support lookups for non JS objects
(e.g. the QObject wrapper).

Change-Id: Id26e31e9f7666c97d49999e578c62f0102c62924
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanups to QV4::Lookup
Lars Knoll [Fri, 19 Apr 2013 13:37:33 +0000 (15:37 +0200)]
Cleanups to QV4::Lookup

Better naming for the methods, deinline some code, add a generic
path for setters and prepare for moving parts of it into the
Managed's vtable.

Change-Id: Ide8d32181fdabdf34c910db20b28fb8f87167570
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDe-inline the call, as __qmljs_convert_to_string wasn't exported by the linker anymore
Lars Knoll [Fri, 19 Apr 2013 13:36:30 +0000 (15:36 +0200)]
De-inline the call, as __qmljs_convert_to_string wasn't exported by the linker anymore

For some weird reason the linker refused to export the symbol from
libQt5Qml for me.

Change-Id: Ic5ff0f6ac9665f3bd652c76503cb1d5201d2952b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMore build fixes.
Erik Verbruggen [Fri, 19 Apr 2013 19:26:44 +0000 (21:26 +0200)]
More build fixes.

Change-Id: I5421af856e68d8eb0f32ed12cf210b367b5279f9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSome build-fixes for pedantic compilers.
Erik Verbruggen [Fri, 19 Apr 2013 19:24:46 +0000 (21:24 +0200)]
Some build-fixes for pedantic compilers.

Most of the change comes down to just one issue. If you write:

extern "C" { void something(); }
namespace Nowhere { extern "C" { void something() {} } }

.. then any use of something might be considered ambigous by some
compilers. This seems to be an edge-case that is not clear in the spec.

Change-Id: I90e32539d6bd35b6ecca7816349f18d7573cbd2f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agov8::Handle::IsEmpty() is not the same as containing a null value.
Lars Knoll [Fri, 19 Apr 2013 12:32:40 +0000 (14:32 +0200)]
v8::Handle::IsEmpty() is not the same as containing a null value.

Change-Id: Ia9a55ef403074f7813f6c6fcceb61cc41c1d1183
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove V8 dependencies from the JSON wrapper
Lars Knoll [Fri, 19 Apr 2013 11:43:08 +0000 (13:43 +0200)]
Remove V8 dependencies from the JSON wrapper

Change-Id: I0ac3cc83ba4482107402d7482a7777fd9c53b9da
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRename QQmlJS::VM namespace to QV4
Lars Knoll [Fri, 19 Apr 2013 11:03:42 +0000 (13:03 +0200)]
Rename QQmlJS::VM namespace to QV4

Simplifies writing code against it (less stuff to type).

Change-Id: I8ac03ca2519375a204a3245e82c4be4cf1e793eb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove wtf dependencies from the v4 headers
Lars Knoll [Fri, 19 Apr 2013 09:47:50 +0000 (11:47 +0200)]
Remove wtf dependencies from the v4 headers

Change-Id: I94a326a333067657319a8edeff76b3411c66856d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRename QQmlV8Handle to QQmlV4Handle
Lars Knoll [Fri, 19 Apr 2013 08:59:41 +0000 (10:59 +0200)]
Rename QQmlV8Handle to QQmlV4Handle

The handle wraps a V4 Value, so this is the better name for it.
Also added some accessor methods to convert to and from V4
Values.

Change-Id: I327c83feb5bd3be59909001489979e5a3a9d9e67
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of qv8stringwrapper
Lars Knoll [Fri, 19 Apr 2013 08:32:42 +0000 (10:32 +0200)]
Get rid of qv8stringwrapper

Change-Id: I07762a0b0662604b9263775346145cf86acddc61
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove more code over to use v4.
Lars Knoll [Fri, 19 Apr 2013 08:13:39 +0000 (10:13 +0200)]
Move more code over to use v4.

Change-Id: Iebafca215877b4f64a55054d6ee42e5f591082b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert SQL errors to use v4 API
Lars Knoll [Fri, 19 Apr 2013 07:46:09 +0000 (09:46 +0200)]
Convert SQL errors to use v4 API

Change-Id: Iae1a89dbb24f3e585e5d7d2398053ae111ef9afb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove DOM errors over to use v4 directly
Lars Knoll [Fri, 19 Apr 2013 06:56:25 +0000 (08:56 +0200)]
Move DOM errors over to use v4 directly

Change-Id: Id5187520ff81c1f1773481791d06f60d40a72a98
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmall fixes to auto test
Lars Knoll [Fri, 19 Apr 2013 06:48:02 +0000 (08:48 +0200)]
Small fixes to auto test

Change-Id: Ie18a15601b27c551a2baf13d0f57f72d711dcef2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement most of QJSEngine against V4
Lars Knoll [Thu, 18 Apr 2013 10:41:59 +0000 (12:41 +0200)]
Implement most of QJSEngine against V4

Also do various fixes in other places, so more of
the QJS* autotests pass

Change-Id: I39662a2ca1441f778595d260860375c5c628bf8e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement QJSValueIterator
Lars Knoll [Thu, 18 Apr 2013 13:33:37 +0000 (15:33 +0200)]
Implement QJSValueIterator

Change-Id: I1aa5b3de0b68555359baf575c68424e1c16257a0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup lots of V8 dependencies in QJS* classes
Lars Knoll [Wed, 17 Apr 2013 16:17:30 +0000 (18:17 +0200)]
Cleanup lots of V8 dependencies in QJS* classes

Implement a good part of QJSValue using V4.
Keep the QV8Engine for now (as it is used everywhere),
but add an ExecutionEngine pointer to it so other parts
can more easily be ported to V4.
Remove a lot of other stuff that's not required anymore.

Change-Id: Ibe2c9ab10f0ee977e0e3d05a42f526206d7b22b5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix VM::Value return value passing on Windows
Simon Hausmann [Thu, 18 Apr 2013 09:28:12 +0000 (11:28 +0200)]
Fix VM::Value return value passing on Windows

Windows doesn't require allocating a return memory slot for the 64-bit value
but instead allows for returning it in EAX:EDX

Change-Id: I3d8b16a5c07ca405edadbed64c9cb462a7581b1c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoBetter implementation of persistent values
Lars Knoll [Tue, 16 Apr 2013 09:36:56 +0000 (11:36 +0200)]
Better implementation of persistent values

The old code never reset values when the engine got deleted.
This is however required if we want to offer a public API
that is safe to use (with QJSValue).

Change-Id: I9754b07b35922a824733dfb8488f3d4998905da7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes to exception handling in the v8 API
Lars Knoll [Tue, 16 Apr 2013 07:17:22 +0000 (09:17 +0200)]
Fixes to exception handling in the v8 API

Change-Id: I4e8c3165497c183041ad674b2bcd7a057dce984d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUse 'template' keyword to treat 'vector' as a dependent template name
Tor Arne Vestbø [Wed, 17 Apr 2013 12:36:46 +0000 (14:36 +0200)]
Use 'template' keyword to treat 'vector' as a dependent template name

Change-Id: I736c0ef531eb302276dc763584da75e44579e643
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoiOS: Don't enable PROT_WRITE and PROT_EXEC at the same time
Tor Arne Vestbø [Mon, 15 Apr 2013 14:31:34 +0000 (16:31 +0200)]
iOS: Don't enable PROT_WRITE and PROT_EXEC at the same time

We define ENABLE_ASSEMBLER_WX_EXCLUSIVE, which we use to limit
the page flags to either RW or RX.

Change-Id: I253648ea98610438a533c7a7ccbf5c27c3b8230a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMake fields of QQmlJS::JS::Managed public, they are used all over the place
Tor Arne Vestbø [Mon, 15 Apr 2013 14:50:20 +0000 (16:50 +0200)]
Make fields of QQmlJS::JS::Managed public, they are used all over the place

Change-Id: I509a6653e64413b4c24ceb5dde98c80031b09329
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoiOS: Don't generate exception tables
Tor Arne Vestbø [Mon, 15 Apr 2013 14:42:49 +0000 (16:42 +0200)]
iOS: Don't generate exception tables

The platform uses setjmp/longjmp.

Change-Id: I1a272ee35d02506e6e2ccde7c6b779061ba06e5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't use std::vector::shrink_to_fit(), it's C++11, and not enabled on iOS
Tor Arne Vestbø [Mon, 15 Apr 2013 14:25:30 +0000 (16:25 +0200)]
Don't use std::vector::shrink_to_fit(), it's C++11, and not enabled on iOS

Change-Id: I547df5bcf09837ebac9d64d66a4171ed87627b1a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix build on iOS
Tor Arne Vestbø [Mon, 15 Apr 2013 14:05:43 +0000 (16:05 +0200)]
Fix build on iOS

Add missing include for sys_cache_control, and make sure we don't
define PLATFORM(IOS) or PLATFORM(IOS_SIMULATOR), since we're
PLATFORM(QT).

Intentionally squashed both changes for easier rebasing against
upstream.

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