platform/upstream/qtdeclarative.git
11 years agoFixed remaining failures for Array.prototype.reverse
Lars Knoll [Tue, 22 Jan 2013 21:43:07 +0000 (22:43 +0100)]
Fixed remaining failures for Array.prototype.reverse

Change-Id: I688a35f8873012efa3202b18d050542a6ddde196
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix remaining test failures related to Arguments object
Lars Knoll [Tue, 22 Jan 2013 21:23:59 +0000 (22:23 +0100)]
Fix remaining test failures related to Arguments object

Change-Id: I294da46457858c14c6d438cfc022d3144d4385d0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix remaining issues in the URI methods
Lars Knoll [Tue, 22 Jan 2013 18:25:02 +0000 (19:25 +0100)]
Fix remaining issues in the URI methods

Change-Id: I0a402fb38f72d067b9bccae1b0c85cfca2cc2812
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix memory corruption in the MM
Lars Knoll [Tue, 22 Jan 2013 16:24:25 +0000 (17:24 +0100)]
Fix memory corruption in the MM

We never free objects ourselves anymore, and the code here
would only lead us appending the last object in the free
list a second time.

Change-Id: I2aa7bd10fbb0990c990d6948124443d222cf82f5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't convert the this object twice
Lars Knoll [Tue, 22 Jan 2013 15:39:16 +0000 (16:39 +0100)]
Don't convert the this object twice

Pass the converted this object to call, instead of
having call maybe convert it once again.

Change-Id: I64496548fe62cf42ee582f4eaa0a666945fd57f9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix length property of global utility functions
Simon Hausmann [Tue, 22 Jan 2013 15:12:12 +0000 (16:12 +0100)]
Fix length property of global utility functions

Functions such as parseInt must have a correct length property
that is read-only.

Change-Id: I91d9a8709c9a2ee23c72388a8737b8761357a285
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix thisObject for all builtin function calls
Simon Hausmann [Tue, 22 Jan 2013 14:20:35 +0000 (15:20 +0100)]
Fix thisObject for all builtin function calls

Even when doing

    var v = Object.prototype.valueOf;
    v();

the thisObject must not be converted to the global object automatically, i.e.
remain null. We previously implemented this lack of conversion for apply() and
call(), but it does in fact apply to all built-in functions.

Consequently we can get rid of callDirect and the virtual maybeAdjustThisObject
function and instead just do the "tweak" with the help of a little boolean.

Change-Id: I93bc37f4c6e896d6dcf169aa74953b0e460312ce
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd escape and unescape to the global object
Lars Knoll [Tue, 22 Jan 2013 14:26:32 +0000 (15:26 +0100)]
Add escape and unescape to the global object

Change-Id: I46353c10a44856c0358e811f5356238721d4a1ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd URI handling methods
Lars Knoll [Tue, 22 Jan 2013 14:13:15 +0000 (15:13 +0100)]
Add URI handling methods

Change-Id: Ieee66aa1f95e6676316c4504b4874d307f5b3564
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix String.prototype.slice with boundary values
Simon Hausmann [Tue, 22 Jan 2013 12:52:13 +0000 (13:52 +0100)]
Fix String.prototype.slice with boundary values

The bounding must be done on doubles to be spec compliant.

Change-Id: Ic4a0311893680ca3855fe83e5075f65b05a26abf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix String.prototype.substring when called with undefined end value
Simon Hausmann [Tue, 22 Jan 2013 11:28:43 +0000 (12:28 +0100)]
Fix String.prototype.substring when called with undefined end value

Change-Id: Id5c9563d492c5a15881cb4190dc9e8cd20284d31
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix bug in property table
Simon Hausmann [Tue, 22 Jan 2013 13:53:46 +0000 (14:53 +0100)]
Fix bug in property table

When inserting a new entry in the property table and we're reusing
an entry from the free-list, make sure to assign the name correctly
to ensure we calculate the correct bucket according to the _new_
name and not the name from the old re-used property.

Also removed unused isEmpty() method that doesn't return the
correct thing anyway (_propertyCount is never decreased).

Change-Id: Ifc4f2f6b1c5fe975e30bdc81386061d6215ad3e3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix name of Array.prototype.toLocaleString method
Simon Hausmann [Tue, 22 Jan 2013 13:06:22 +0000 (14:06 +0100)]
Fix name of Array.prototype.toLocaleString method

Change-Id: I7347f25e07ee99a332b8e5f4b6cc50aac1c2bb70
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRun the tests in a simulated pacific time zone
Simon Hausmann [Tue, 22 Jan 2013 11:20:31 +0000 (12:20 +0100)]
Run the tests in a simulated pacific time zone

Some date related tests rely on this.

Change-Id: I764392d8bfdc1f738bb218d43bc234b901384c78
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix name property of Error prototype
Simon Hausmann [Tue, 22 Jan 2013 11:15:51 +0000 (12:15 +0100)]
Fix name property of Error prototype

Change-Id: I21445a63a807d6a54bf8d8523fb901ae83f674a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix Math.toString()
Simon Hausmann [Tue, 22 Jan 2013 10:59:38 +0000 (11:59 +0100)]
Fix Math.toString()

Change-Id: I6fc901c7b9c1ca625a13ae8417f931c2fc948fe9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement String.prototype.split
Simon Hausmann [Mon, 21 Jan 2013 16:21:36 +0000 (17:21 +0100)]
Implement String.prototype.split

Change-Id: I676bf6b9338ac6ce3aebadc6007858983d45f02e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix a bug in Array.proto.indexOf for sparse arrays
Lars Knoll [Tue, 22 Jan 2013 10:53:08 +0000 (11:53 +0100)]
Fix a bug in Array.proto.indexOf for sparse arrays

Change-Id: I113c242b057ee4c6f2d06edf17e8bf8b453ba58c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix remaining test failures in Array.prototype.push/pop
Lars Knoll [Tue, 22 Jan 2013 09:57:38 +0000 (10:57 +0100)]
Fix remaining test failures in Array.prototype.push/pop

Change-Id: If645e8d4628f252ffc3e96037cdc3749d6cf2ddd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix remaining issues in Array.prototype.(un)shift
Lars Knoll [Tue, 22 Jan 2013 09:24:58 +0000 (10:24 +0100)]
Fix remaining issues in Array.prototype.(un)shift

Change-Id: I872abc79656511806955337a15d0fc04b8b286f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't clutter the source dir with .o files
Lars Knoll [Tue, 22 Jan 2013 08:31:56 +0000 (09:31 +0100)]
Don't clutter the source dir with .o files

Change-Id: If265752cb7ce3e55321e0dc0db7fbaa4369d9af4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix remaining issues in lastIndexOf
Lars Knoll [Mon, 21 Jan 2013 22:07:22 +0000 (23:07 +0100)]
Fix remaining issues in lastIndexOf

Change-Id: Ice23d8af32e26909757cadf5d4a0257d7926ca31
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a few bugs in Number.prototype
Lars Knoll [Mon, 21 Jan 2013 21:34:02 +0000 (22:34 +0100)]
Fix a few bugs in Number.prototype

Change-Id: I1ab95c019b628c3e298f88ea8d5b7f8b4d560aee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agorename qv4ecmaobjects.* to qv4objectproto.*
Lars Knoll [Mon, 21 Jan 2013 21:17:55 +0000 (22:17 +0100)]
rename qv4ecmaobjects.* to qv4objectproto.*

Change-Id: I4bf60a424542cb7e53d54011ac5d0c503453913f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove Boolean object into it's own file
Lars Knoll [Mon, 21 Jan 2013 21:14:55 +0000 (22:14 +0100)]
Move Boolean object into it's own file

Change-Id: Ia62b223111fa41877bc24b6320f0078a3546c55b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove Number object into it's own file
Lars Knoll [Mon, 21 Jan 2013 21:12:05 +0000 (22:12 +0100)]
Move Number object into it's own file

Change-Id: Ie431e653956efa35dc92523e236af1097d57bab9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove ArrayCtor and ArrayProto into their own file
Lars Knoll [Mon, 21 Jan 2013 21:03:14 +0000 (22:03 +0100)]
Move ArrayCtor and ArrayProto into their own file

Change-Id: I304f50704dbad396abc7c6c8ae73d454ebd73e01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove masm into 3rdparty
Lars Knoll [Mon, 21 Jan 2013 20:56:04 +0000 (21:56 +0100)]
Move masm into 3rdparty

Change-Id: Ie3645603149a4e054ebe658ef216fb6cd207b740
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove qmljs_object.* to qv4object.*
Lars Knoll [Mon, 21 Jan 2013 20:54:53 +0000 (21:54 +0100)]
Move qmljs_object.* to qv4object.*

Change-Id: I846958875eaa2feae51e3a70290a197dd40bcb12
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove math object into it's own file
Lars Knoll [Mon, 21 Jan 2013 20:48:51 +0000 (21:48 +0100)]
Move math object into it's own file

Change-Id: I01f00659f01ff11a401dedf1ce27b16d31d0f4f9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSplit Regexp object into it's own file
Lars Knoll [Mon, 21 Jan 2013 20:43:15 +0000 (21:43 +0100)]
Split Regexp object into it's own file

Change-Id: Ib24f4a42d2312291b3a10d2a02fad33a1eb4b5b5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove Error Objects into their own file
Lars Knoll [Mon, 21 Jan 2013 20:36:12 +0000 (21:36 +0100)]
Move Error Objects into their own file

Change-Id: Id45f3c38b3effb0087a4782049b5d3184d7f9891
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFurther split up qv4ecmaobjects and qmljs_objects.
Lars Knoll [Mon, 21 Jan 2013 20:26:25 +0000 (21:26 +0100)]
Further split up qv4ecmaobjects and qmljs_objects.

Change-Id: I3dbcf7f9209a2c8ff601b64ef722640181dbb6f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement RegExp.prototype.compile
Lars Knoll [Mon, 21 Jan 2013 17:43:03 +0000 (18:43 +0100)]
Implement RegExp.prototype.compile

This method is a non standard extension, but supported by
all engines, and even used in the test suite.

Change-Id: Ie75c840d4da13bd1a62aa7567e8ea2737d31d33e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix implicit this object for value based calls inside with() blocks
Lars Knoll [Mon, 21 Jan 2013 15:01:28 +0000 (16:01 +0100)]
Fix implicit this object for value based calls inside with() blocks

Change-Id: Id1d18623ff84e41f2a3c08df8a13648ae49fc4ae
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMinor optimisation
Lars Knoll [Mon, 21 Jan 2013 15:01:07 +0000 (16:01 +0100)]
Minor optimisation

Change-Id: I8a13ab2e7bc74f3e467106880232a795c6c4404c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the String object into it's own file
Lars Knoll [Mon, 21 Jan 2013 13:20:19 +0000 (14:20 +0100)]
Move the String object into it's own file

Change-Id: I3efc9aeaaa7c851715a996e5cbc149fa87cf5503
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix certain new member expressions
Simon Hausmann [Mon, 21 Jan 2013 13:07:48 +0000 (14:07 +0100)]
Fix certain new member expressions

Non-temp/name/member expressions need an intermediate move/temporary, in
visit(NewExpression *ast) as well as in visit(NewMemberExpression *ast)

Change-Id: I2f367c6285bb98d8445b93f924979431f1e5ff11
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement String.prototype.search
Simon Hausmann [Mon, 21 Jan 2013 12:46:44 +0000 (13:46 +0100)]
Implement String.prototype.search

Change-Id: Id151161bda4ab5012af33a49fac11a9b7e82ec0e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement String.prototype.trim
Lars Knoll [Mon, 21 Jan 2013 12:46:39 +0000 (13:46 +0100)]
Implement String.prototype.trim

Change-Id: I6bbe52f77221a0e5bd8d9f275983a0513c7c50e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix the remaining test failures for the Date object
Lars Knoll [Mon, 21 Jan 2013 12:27:42 +0000 (13:27 +0100)]
Fix the remaining test failures for the Date object

Fix the length property of the Date constructor
add Date.now() and Date.prototype.toJSON()

Change-Id: I968babfe17f6e45c8fd08f32b36eb5facc8601ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement String.prototype.replace
Simon Hausmann [Mon, 21 Jan 2013 08:20:03 +0000 (09:20 +0100)]
Implement String.prototype.replace

Change-Id: I60806b6563337c1c18a6b737e860deca4093c8ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoIf a function is defined twice the 2nd one should be used
Lars Knoll [Mon, 21 Jan 2013 11:33:59 +0000 (12:33 +0100)]
If a function is defined twice the 2nd one should be used

Change-Id: Id84663c319dd045e0f1e60b3300523a59f898b0e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the Date Object into it's own file
Lars Knoll [Mon, 21 Jan 2013 10:57:17 +0000 (11:57 +0100)]
Move the Date Object into it's own file

Change-Id: I3f94fa1dcfc8e23414ee2b3f96cffffa1f753bc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix Date constructor and add Date.prototype.toISOString
Lars Knoll [Mon, 21 Jan 2013 10:39:08 +0000 (11:39 +0100)]
Fix Date constructor and add Date.prototype.toISOString

Change-Id: Ib905639ed903cccdeb2649374f744a1fc64f3c1c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMember expressions on non-objects should throw a type error
Simon Hausmann [Mon, 21 Jan 2013 09:57:09 +0000 (10:57 +0100)]
Member expressions on non-objects should throw a type error

This is covered by the 11.2.3 tests

Change-Id: I74ccda815a0d6c4ba1f7eb25ce327cbb3bb30d48
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix writable attribute of RegExp properties
Simon Hausmann [Sun, 20 Jan 2013 20:54:29 +0000 (21:54 +0100)]
Fix writable attribute of RegExp properties

Most of the properties are in fact not writable.

Change-Id: I21a8c97fb98ef3c583b284093ec9be52b72b1544
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix exception handling in masm backend
Simon Hausmann [Sun, 20 Jan 2013 19:38:35 +0000 (20:38 +0100)]
Fix exception handling in masm backend

The return value of setjmp is an int, which we interpret as a boolean later. We
cannot put it directly into a VM::Value, because it isn't one. Instead we have
to store it properly with value and tag.

This worked by "accident" on x86-64 where the return value is in eax and not
clobbered until we do the type test. But on ia32 we do rely on a proper value
representation.

Change-Id: Id54072c31baf6ad4607626dad939c715d2092d3d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compiler warning.
Erik Verbruggen [Thu, 17 Jan 2013 21:10:35 +0000 (22:10 +0100)]
Fix compiler warning.

The usual class v.s. struct forward decls. Only fatal on Windows, not on
any other platform.

Change-Id: I902dd82b196663fc66e3bd914002a2961668455f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove broken result of an automatic merge resolution.
Jędrzej Nowacki [Mon, 14 Jan 2013 15:10:56 +0000 (16:10 +0100)]
Remove broken result of an automatic merge resolution.

Change-Id: Idc86a0cc2175c11e5b40f9c28e294bd0a7d033eb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoThere is no point in checking twice for a space if gc was not run.
Jędrzej Nowacki [Mon, 14 Jan 2013 15:15:01 +0000 (16:15 +0100)]
There is no point in checking twice for a space if gc was not run.

Change-Id: I60234eaba3db7ee6c52b4487a12e403116dbf254
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement JSON.parse
Lars Knoll [Fri, 18 Jan 2013 21:19:33 +0000 (22:19 +0100)]
Implement JSON.parse

Change-Id: Ibb5f9226aaaea8653842c5a452e006dc05210a2c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix valgrind warnings about uninitialised variable
Lars Knoll [Fri, 18 Jan 2013 19:22:07 +0000 (20:22 +0100)]
Fix valgrind warnings about uninitialised variable

Apparently gcc was miscompiling the code with boolean
bitfields. Changing them to uint's makes all errors
go away.

Change-Id: I95e856e4b5ebca0d10fa250a8a4640697998ff38
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoOptimise array access
Lars Knoll [Fri, 18 Jan 2013 12:48:03 +0000 (13:48 +0100)]
Optimise array access

Optimise accessing indexed properties in Objects and
Arrays

Change-Id: I3330a4151a13e8f34fee1c4641e64d00a52625e2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix wrong index access in one variant of Array::at()
Lars Knoll [Fri, 18 Jan 2013 15:41:42 +0000 (16:41 +0100)]
Fix wrong index access in one variant of Array::at()

Change-Id: I94dc9b08a446ec8d6e26b672a3272365ba9ed320
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGet rid of virtual __get__ in RegExpObject
Simon Hausmann [Fri, 18 Jan 2013 13:38:29 +0000 (14:38 +0100)]
Get rid of virtual __get__ in RegExpObject

Instead implement the properties as run-time initialized properties.  Fixes
also a bunch of tests that verifies that they are own properties.

Change-Id: I3c4ba52edcec2b59020a2966436b33b2ca5d7f46
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of __get__ implementation in ErrorObject
Simon Hausmann [Fri, 18 Jan 2013 12:28:00 +0000 (13:28 +0100)]
Get rid of __get__ implementation in ErrorObject

As a step towards making __get__ non-virtual we can implement the message
property instead using run-time initialization.

The Error.prototype object must also provide a message property with
the empty string as initial value (15.11.4.3).

Change-Id: If8a7fd828e6c6fa6e20607505b392d0bda71f90a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove the need for virtual __get/set__ methods in ArgumentsObject
Lars Knoll [Fri, 18 Jan 2013 11:47:43 +0000 (12:47 +0100)]
Remove the need for virtual __get/set__ methods in ArgumentsObject

In addition to not needing virtuals anymore, it also fixes a few
corner cases in the test suite.

Change-Id: I9f93d820aa7700c038c60a55daa57e1567d42b17
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement String.prototype.match
Lars Knoll [Thu, 17 Jan 2013 22:03:07 +0000 (23:03 +0100)]
Implement String.prototype.match

The implementation is not very performant, as it simply
is a straight implementation of the standard using
RegExpObject. In the long term this should probably
use a RegExp directly instead.

Change-Id: I532909b3fa8555bf1c16378e2650ca4debedd4b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Array.prototype.reduce/reduceRight
Lars Knoll [Thu, 17 Jan 2013 21:22:39 +0000 (22:22 +0100)]
Implement Array.prototype.reduce/reduceRight

This fixes another 380 test cases

Change-Id: I9a09bf1cd992a3a370d8e3156a612c91dc95d3b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Array.prototype.map/filter correctly
Lars Knoll [Thu, 17 Jan 2013 20:58:24 +0000 (21:58 +0100)]
Implement Array.prototype.map/filter correctly

Fixes another 260 test cases.

Change-Id: I4f6299119c1859dced1fd2f50c3e5d7f0ed133ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Array.prototype.every/some/forEach
Lars Knoll [Thu, 17 Jan 2013 20:19:53 +0000 (21:19 +0100)]
Implement Array.prototype.every/some/forEach

The old implementations of these methods were pretty broken.
These fix 99% of the test failures related to these methods.

Change-Id: I09d45411c85252a9ac7db8dccc644d51b3a31503
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChanged reachable Q_UNREACHABLE into Q_UNIMPLEMENTED.
Erik Verbruggen [Thu, 17 Jan 2013 15:49:19 +0000 (16:49 +0100)]
Changed reachable Q_UNREACHABLE into Q_UNIMPLEMENTED.

They are probably unreachable, but this way we get notified if they are
reachable after all. Easier to fix than silent ignoration.

Change-Id: I2eafb6ad9fe4bdd7cba9490e9e4f991bb96c5715
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix values of RegExp.lastIndex property
Simon Hausmann [Thu, 17 Jan 2013 14:24:58 +0000 (15:24 +0100)]
Fix values of RegExp.lastIndex property

The property should be writable and also set to 0 if no match is found.

Change-Id: I4288ad239980260c7610c5de0061cc42ac38bb7a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdate test expectations
Simon Hausmann [Thu, 17 Jan 2013 15:21:44 +0000 (16:21 +0100)]
Update test expectations

Change-Id: I202e5e6ce8648266a48f12c2663a07816f0f9e10
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Array.prototype.lastIndexOf
Lars Knoll [Thu, 17 Jan 2013 14:33:21 +0000 (15:33 +0100)]
Implement Array.prototype.lastIndexOf

Change-Id: I474dc9fe1f303cb5f77ba5efaa219f1c0f411cb6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agofurther fixes to indexOf
Lars Knoll [Thu, 17 Jan 2013 13:26:01 +0000 (14:26 +0100)]
further fixes to indexOf

Change-Id: Iae083e42a38f4b3d16163bce51ff0ad9a97e48dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdate test results
Lars Knoll [Thu, 17 Jan 2013 13:01:16 +0000 (14:01 +0100)]
Update test results

Change-Id: Ib7ce4d5907b9c02caad933e8159e2cca7bab6230
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix our NaN boxing.
Lars Knoll [Thu, 17 Jan 2013 12:42:42 +0000 (13:42 +0100)]
Fix our NaN boxing.

-NaN was not recognised as a double, but as a pointer,
leading to wrong behavior and crashes.
We actually have one more bit available, so let's use it.

Change-Id: I505ed5748228e4337d99da3b4eda43960967e117
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes to Array.prototype.indexOf
Lars Knoll [Thu, 17 Jan 2013 12:42:13 +0000 (13:42 +0100)]
Fixes to Array.prototype.indexOf

Change-Id: Ia9a2a8e25223c4b4d72a59c0c2ea449dc544f796
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agooptimise property access
Lars Knoll [Wed, 16 Jan 2013 23:45:11 +0000 (00:45 +0100)]
optimise property access

Inline the canPut method and simplify our code path for
[[put]].

Change-Id: I4198b0bdef16a4fdf6113a8e015915492c9c301d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Array.prototype.splice
Lars Knoll [Wed, 16 Jan 2013 16:56:29 +0000 (17:56 +0100)]
Implement Array.prototype.splice

Change-Id: I678e2836b677066b42a05f5b7b5b30eca7e8120c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChanged signature of constructActivationProperty.
Erik Verbruggen [Wed, 16 Jan 2013 15:55:42 +0000 (16:55 +0100)]
Changed signature of constructActivationProperty.

Change-Id: Ic4aa2b85dec0a732382dd5ae5a7e37d54476db3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix prepareCallArg and prepareCallArgs.
Erik Verbruggen [Wed, 16 Jan 2013 15:48:48 +0000 (16:48 +0100)]
Fix prepareCallArg and prepareCallArgs.

Change-Id: Id8b1e16de2a572e2c6e4dfe4d55adcbd63a92fa1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix interpreter regression in callBuiltinInvalid.
Erik Verbruggen [Wed, 16 Jan 2013 15:29:28 +0000 (16:29 +0100)]
Fix interpreter regression in callBuiltinInvalid.

Also changed the method signature to be more precise and less
error-prone.

Change-Id: I131a0cf90167743341faa5de3e70815c90ccd989
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix length property of RegExp constructor
Simon Hausmann [Thu, 17 Jan 2013 13:44:47 +0000 (14:44 +0100)]
Fix length property of RegExp constructor

Change-Id: Ia53711914957ed2f6b02dc678dc98161177c4f90
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix inplace add for strings
Simon Hausmann [Thu, 17 Jan 2013 13:38:01 +0000 (14:38 +0100)]
Fix inplace add for strings

Lhs and rhs got fixed up, breaking simple string addition:

a = "a"
b = "b"
a += b

would produce "ba" instead of "ab"

Change-Id: I0f666cace13de8f6ec5e4d4537fc97b3d25989ed
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix entries for non-matches in the results array of RegExp.exec
Simon Hausmann [Thu, 17 Jan 2013 13:28:31 +0000 (14:28 +0100)]
Fix entries for non-matches in the results array of RegExp.exec

A capture that failed to match should result an entry in the
results array with value undefined.

Change-Id: I08fedfc59cda752b209e79ff8abf7ee105a0c527
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix exception handling of RegExp constructor
Simon Hausmann [Thu, 17 Jan 2013 13:08:17 +0000 (14:08 +0100)]
Fix exception handling of RegExp constructor

Invalid regular expressions should throw a syntax error instead of
a type error.

Change-Id: Ic7357f423703646a3941aa780d05f81faefec791
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd Yarr regex engine from JSC
Simon Hausmann [Mon, 14 Jan 2013 15:53:43 +0000 (16:53 +0100)]
Add Yarr regex engine from JSC

Only the interpreter is enabled right now, the JIT needs more compile fixes.

This is the initial port that is functionally equivalent to the
QRegularExpression based implementation except for the tests that pass now
because of the actual JS compatible regex implementation.

Change-Id: Ieb7e66e9b38071ea1d32effe045c70023b17fabd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix Array.prototype.sort for non sparse arrays
Lars Knoll [Wed, 16 Jan 2013 14:41:02 +0000 (15:41 +0100)]
Fix Array.prototype.sort for non sparse arrays

Change-Id: Ibb055358dc953881842d43ebff4d361c949796a9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix createFunctionMapping
Lars Knoll [Wed, 16 Jan 2013 15:09:54 +0000 (16:09 +0100)]
Fix createFunctionMapping

This fixes a bad regression introduced with
e5f5251a020be728015068f3cd033f55f1d6b693.

Change-Id: If4961f46171ea6c919daae7eaab9ef70c7b0608e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoMoved callBuiltin into the common super class.
Erik Verbruggen [Wed, 16 Jan 2013 14:49:42 +0000 (15:49 +0100)]
Moved callBuiltin into the common super class.

Now the backends do not need to duplicate the tedious switch, but can
just implement the specific methods. It also prevents backends from
missing out on cases.

Change-Id: I45a25c6955af584f60b6e69cf6a616ca3e2dc640
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet closures back into a working state.
Erik Verbruggen [Wed, 16 Jan 2013 12:38:35 +0000 (13:38 +0100)]
Get closures back into a working state.

This includes code generation and runtime support to register a
VM::Function with the engine.

Change-Id: Ifd124907be440c56b0f582ff3c1409094c501943
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMake CodeGen usable without a context.
Erik Verbruggen [Wed, 16 Jan 2013 12:36:14 +0000 (13:36 +0100)]
Make CodeGen usable without a context.

When running with the LLVM backend, there is no VM context.

Change-Id: Ib4e95a3c3b92f20118269da1a9430a9278beb349
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoInclude path of llvm runtime file in executable.
Erik Verbruggen [Wed, 16 Jan 2013 12:33:36 +0000 (13:33 +0100)]
Include path of llvm runtime file in executable.

Change-Id: I139a2ea1c7b3e0a8aeb4eb4c093d98a03c79f603
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplaced unnecessary vector with a boolean.
Erik Verbruggen [Wed, 16 Jan 2013 11:00:57 +0000 (12:00 +0100)]
Replaced unnecessary vector with a boolean.

Change-Id: Iea163e59b0a8efbe79065844b77e782330fc1564
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSkip tests known to fail
Simon Hausmann [Wed, 16 Jan 2013 14:27:33 +0000 (15:27 +0100)]
Skip tests known to fail

Change-Id: Ia4677685000da172e97d6a98b97785e64934fd27
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRename native functions to builtin functions.
Erik Verbruggen [Wed, 16 Jan 2013 10:41:23 +0000 (11:41 +0100)]
Rename native functions to builtin functions.

Both the JIT and the compiler generate native code, but the functions
have to be registered as ScriptFunction objects, not NativeFunction
objects. The name BuiltinFunction prevents confusion or errors.

Change-Id: Ic6dca457362f916201b3e5178fbd36c6d754fa9c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix Object.prototype.toLocaleString
Lars Knoll [Wed, 16 Jan 2013 13:10:04 +0000 (14:10 +0100)]
Fix Object.prototype.toLocaleString

Change-Id: Ie4202cd78599e5f13727a5c497e3dfabe65e87e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix Object.prototype.toString
Lars Knoll [Wed, 16 Jan 2013 12:58:29 +0000 (13:58 +0100)]
Fix Object.prototype.toString

Change-Id: Ib9d043c97cc2ee1fa75a2f768c7d2321bcaad766
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix index access on StringObjects
Lars Knoll [Wed, 16 Jan 2013 12:34:46 +0000 (13:34 +0100)]
Fix index access on StringObjects

Change-Id: I5dbbc59f383e2a1e6630d1e0f0ca631890d4c8e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoProperly mark accessor properties
Lars Knoll [Wed, 16 Jan 2013 11:18:47 +0000 (12:18 +0100)]
Properly mark accessor properties

During the mark phase of the GC run, we didn't mark
the getters and setters in accessor properties.

This fixes a few crashes in the test suite.

Change-Id: Ic58b317fe1fc5c923e8c114aee94c1981afd894f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix the remaining issues with Object.defineProperty/defineProperties
Lars Knoll [Wed, 16 Jan 2013 10:00:56 +0000 (11:00 +0100)]
Fix the remaining issues with Object.defineProperty/defineProperties

Change-Id: I4c2a28ad49aa00888d79aee3512b1ba54c16fcbd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix case in parseInt where qin64 would overflow.
Erik Verbruggen [Tue, 15 Jan 2013 14:01:09 +0000 (15:01 +0100)]
Fix case in parseInt where qin64 would overflow.

Change-Id: I2c9fbd3f7476d35ffef4abb408cac5ac89d85268
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDynamically grow/shrink MOTH code block.
Erik Verbruggen [Tue, 15 Jan 2013 11:33:49 +0000 (12:33 +0100)]
Dynamically grow/shrink MOTH code block.

Instead of allocating 4000*pageSize, and not checking if it overflows.

Change-Id: I38b37d60bb39bddbbd9a41a2e9c5958b1acc62eb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixed memory leaks.
Erik Verbruggen [Tue, 15 Jan 2013 11:12:52 +0000 (12:12 +0100)]
Fixed memory leaks.

Change-Id: I641127b0d46f88291468af767cbbeb28ce5a75d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoIgnore LLVM generated files.
Erik Verbruggen [Tue, 15 Jan 2013 09:47:21 +0000 (10:47 +0100)]
Ignore LLVM generated files.

Change-Id: Ibc753fe5576eb7f60c96a6d0d5407adb392ff3ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove common code from various ISel backends into a common base-class.
Erik Verbruggen [Sun, 13 Jan 2013 21:17:26 +0000 (22:17 +0100)]
Move common code from various ISel backends into a common base-class.

Note: all warnings are due to backends that do not fully implement the
required virtual methods. Or, rephrasing: these backends need work to
get them up-to-speed/quality for all methods that do have warnings.

Change-Id: Ib713f3d76832af42ebe893ad2896eec4bdd4bccb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compiler warnings about signedness in comparisson.
Erik Verbruggen [Mon, 14 Jan 2013 18:32:54 +0000 (19:32 +0100)]
Fix compiler warnings about signedness in comparisson.

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