platform/upstream/qtdeclarative.git
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>
11 years agoSome more fixes for defineOwnProperty
Lars Knoll [Mon, 14 Jan 2013 22:32:57 +0000 (23:32 +0100)]
Some more fixes for defineOwnProperty

Change-Id: If130677591bb7f655bcc5d35f1797ced08cd17f3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller bug fixes to setting the length property for arrays
Lars Knoll [Mon, 14 Jan 2013 21:45:00 +0000 (22:45 +0100)]
Smaller bug fixes to setting the length property for arrays

Change-Id: I5f93d8e6648aad162bfafbcc558bd77e8d59b50f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix sameValue() for integer vs double 0
Lars Knoll [Mon, 14 Jan 2013 21:44:38 +0000 (22:44 +0100)]
Fix sameValue() for integer vs double 0

Change-Id: Id56699a3e3624c644b14c6ece847a91da0ea7004
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix memory leak
Lars Knoll [Mon, 14 Jan 2013 21:44:24 +0000 (22:44 +0100)]
Fix memory leak

Change-Id: I7fcebc671f9db66a25d486575563081b8ac5299f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove qDebug.
Jędrzej Nowacki [Mon, 14 Jan 2013 13:21:06 +0000 (14:21 +0100)]
Remove qDebug.

Change-Id: I3b7764ac5201de012e6b296cd4e562cffc762974
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix PropertyDescriptor::isSubset()
Lars Knoll [Mon, 14 Jan 2013 21:01:01 +0000 (22:01 +0100)]
Fix PropertyDescriptor::isSubset()

This fixes a couple of test cases where an accessor
gets reset to undefined.

Change-Id: If37d67846a31bfcec5d285ad68337748a243b5ff
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCorrectly working Array.length setter
Lars Knoll [Mon, 14 Jan 2013 16:41:53 +0000 (17:41 +0100)]
Correctly working Array.length setter

The setter will remove elements from the array that
have an index larger then the new length, but only
if they are configurable.

Change-Id: Id9f09d5ab038aaba6ca1c93be608c46383e1f2a1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMake sure our error objects always have the correct prototype set
Lars Knoll [Mon, 14 Jan 2013 16:13:25 +0000 (17:13 +0100)]
Make sure our error objects always have the correct prototype set

Change-Id: I26ed066d14d0fe6147bf043c35d41e6434bc8873
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a corner case in Object.create()
Lars Knoll [Mon, 14 Jan 2013 16:11:03 +0000 (17:11 +0100)]
Fix a corner case in Object.create()

Change-Id: Ie1c32178793b44c2d14630b849622bffc4a09d26
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoGive our builtins a prototype, so toString() doesn't assert
Lars Knoll [Mon, 14 Jan 2013 15:28:32 +0000 (16:28 +0100)]
Give our builtins a prototype, so toString() doesn't assert

Change-Id: I43ff797787187caf8f5a01dee7b2dcc1008fd06f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCorrectly iterator over properties of StringObjects
Lars Knoll [Mon, 14 Jan 2013 14:54:07 +0000 (15:54 +0100)]
Correctly iterator over properties of StringObjects

Change-Id: I16a8065dd0bb9162811ced1bc6c73c07c02a331d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix an out of bounds read.
Lars Knoll [Mon, 14 Jan 2013 13:55:35 +0000 (14:55 +0100)]
Fix an out of bounds read.

Change-Id: Ie7eb4cdc9c0f5002b67145f23fe8a0a3b105b626
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement StringObject properly
Lars Knoll [Mon, 14 Jan 2013 13:51:53 +0000 (14:51 +0100)]
Implement StringObject properly

we now pass all of 15.5.5

Change-Id: Ia72bd5f064e6edfcd440e2c2ea72459a09efd1e8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agogetPrototypeOf returns null if the object doesn't have a prototype
Lars Knoll [Mon, 14 Jan 2013 13:02:40 +0000 (14:02 +0100)]
getPrototypeOf returns null if the object doesn't have a prototype

Change-Id: I33b63bf19b3b8bb3292f3a2f783228f404ed7cac
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThe prototype of error constructors is the function prototype
Lars Knoll [Mon, 14 Jan 2013 13:02:03 +0000 (14:02 +0100)]
The prototype of error constructors is the function prototype

Change-Id: I9365d04b199f4cc7b75f347886b68ccc073564fb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a corner case in the arguments object
Lars Knoll [Mon, 14 Jan 2013 12:52:16 +0000 (13:52 +0100)]
Fix a corner case in the arguments object

Change-Id: I075e08b2629db47456a601656f298c7397a7fa67
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMake check improvements
Simon Hausmann [Mon, 14 Jan 2013 12:50:35 +0000 (13:50 +0100)]
Make check improvements

Add support for "make check-interpreter" and fix "make check" for shadow
builds.

Change-Id: I38f0bd9952961f143c31a7ae15bddf90245e7500
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement Array.isArray()
Lars Knoll [Mon, 14 Jan 2013 12:10:43 +0000 (13:10 +0100)]
Implement Array.isArray()

Change-Id: Ibda9709265d551ea8462a0e624ff2dee7c16306e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix length property of constructors
Lars Knoll [Mon, 14 Jan 2013 12:01:03 +0000 (13:01 +0100)]
Fix length property of constructors

Change-Id: If010f3fd6b001c29044bbf7cbdc10b0064008c10
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't deref 0 pointers
Lars Knoll [Mon, 14 Jan 2013 11:55:24 +0000 (12:55 +0100)]
Don't deref 0 pointers

Change-Id: Ib876839266712047f975c98e23192ceda5cd13d4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agofor(a in b) doesn't throw if b is null or undefined
Lars Knoll [Mon, 14 Jan 2013 11:29:45 +0000 (12:29 +0100)]
for(a in b) doesn't throw if b is null or undefined

Change-Id: I5eab9dd7f6f831e83582585bd3afff1af587e117
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix Array.prototype.indexOf
Lars Knoll [Mon, 14 Jan 2013 11:21:30 +0000 (12:21 +0100)]
Fix Array.prototype.indexOf

Make it work with index properties that are defined
on the prototype as well.

Change-Id: I0a76694207429ce38a921988284082e4e8cd54fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoupdate TestExpectations
Lars Knoll [Mon, 14 Jan 2013 08:43:45 +0000 (09:43 +0100)]
update TestExpectations

Change-Id: I3d551bf9e618b2208077c3559b7c02552f381807
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoEvaluate the expression of the return statement before unwinding exceptions
Lars Knoll [Mon, 14 Jan 2013 08:29:41 +0000 (09:29 +0100)]
Evaluate the expression of the return statement before unwinding exceptions

The expression contained in the return statement could throw an
exception, so we can only unwind our expection stack after having
evaluated that expression.

Change-Id: I7b56d03bda46a38915120bdb237e374db707ef92
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove qdebug
Lars Knoll [Mon, 14 Jan 2013 08:29:32 +0000 (09:29 +0100)]
Remove qdebug

Change-Id: Ibc1607d036fa8bf551ff7938090d8dda08a232fe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Function.prototype.bind
Lars Knoll [Sun, 13 Jan 2013 22:57:35 +0000 (23:57 +0100)]
Implement Function.prototype.bind

Change-Id: Ia63f5064d76fecfc513737a0072bf5e3cdce474c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes to the ScriptFunction constructor
Lars Knoll [Sun, 13 Jan 2013 21:13:48 +0000 (22:13 +0100)]
Fixes to the ScriptFunction constructor

We now pass all of 15.3, with the exception of
tests using the unimplemented Function.prototype.bind
method.

Change-Id: I95f6157ea99d63556c32ae7524ee5e14026bbd69
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoUpdate TestExpectations
Lars Knoll [Sun, 13 Jan 2013 16:25:04 +0000 (17:25 +0100)]
Update TestExpectations

Change-Id: If4cbe03a3b7777215a3aeb5dbe69edad6c2965a0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoinstanceof doesn't throw an exception if the rhs is a primitive value.
Lars Knoll [Sun, 13 Jan 2013 16:18:14 +0000 (17:18 +0100)]
instanceof doesn't throw an exception if the rhs is a primitive value.

Change-Id: I4f8fd4c8ca42878cfcb104bcf4b615f56e909240
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix Function.prototype.apply
Lars Knoll [Sun, 13 Jan 2013 16:17:28 +0000 (17:17 +0100)]
Fix Function.prototype.apply

The args object doesn't have to be an array. A simple object
is enough.

Change-Id: If22cacdcfd49472d6bd838461c2b8281bb4b7f99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFunction.length is readonly as well.
Lars Knoll [Sun, 13 Jan 2013 15:28:07 +0000 (16:28 +0100)]
Function.length is readonly as well.

Change-Id: I5eb555e98e047fb4a851934611d4db86aa5fa02a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThe prototype of Constructor objects is readonly
Lars Knoll [Sun, 13 Jan 2013 15:17:03 +0000 (16:17 +0100)]
The prototype of Constructor objects is readonly

Change-Id: I43449a964e003c444a42ad51639a22f9b0cb73c5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agofix some bugs in function construction
Lars Knoll [Sat, 12 Jan 2013 22:24:50 +0000 (23:24 +0100)]
fix some bugs in function construction

Throw a syntax error instead of a type error in the
Function constructor
Fix evaluation order of arguments passed to
the Function constructor
Fix the code generator so that the parsed function
doesn't look like it's being evaluated in the
global scope.
Fix the code generator to reject duplicated arguments
in strict mode.
Fix length property of the Function constructor and
Function.prototype.apply

Change-Id: I7f647b9023579c0e8179a62df380b8981a54c99c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix built-in String prototype functions when used with non-string objects
Simon Hausmann [Fri, 11 Jan 2013 15:54:35 +0000 (16:54 +0100)]
Fix built-in String prototype functions when used with non-string objects

The this object should be converted to a string if it's not a string
already. That allows for the re-use of String.prototype functions
with different objects. This is with the exception of null and
undefined that should continue to throw type errors.

Change-Id: Iaaad538b85f3a7da3e5fcf436236602f0f327dc7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix passing of null and undefined to built-in functions
Simon Hausmann [Fri, 11 Jan 2013 15:51:34 +0000 (16:51 +0100)]
Fix passing of null and undefined to built-in functions

Usually passing null or undefined to function calls as the this
object converts to the global object. This is not the case for
built-in functions, where null and undefined are acceptable as
this object, because it allows the implementation to decide what
to do, i.e. return a specific value or throw for example a type
error.

This patch adds the hook & implementation to allow passing null/ undefined to
built-in functions, even when called via Fuction.prototype.apply and call.

Change-Id: I00b4b7393f89586dbd66ffa0b7972292e58411cb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoThrow a type error when trying to construct a native function
Simon Hausmann [Fri, 11 Jan 2013 14:01:48 +0000 (15:01 +0100)]
Throw a type error when trying to construct a native function

Change-Id: I8ebc225f1d2645683763a129d20415d58f089acb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix exception type in Function.prototype.apply
Simon Hausmann [Fri, 11 Jan 2013 13:56:45 +0000 (14:56 +0100)]
Fix exception type in Function.prototype.apply

When Function.prototype.apply is called with the wrong second argument, a type
error should be thrown instead of a generic exception.

Change-Id: I6fceca49dbbb44cbc5a2f5cce1b4e3ce899976ed
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix Array.slice
Lars Knoll [Sat, 12 Jan 2013 15:40:58 +0000 (16:40 +0100)]
Fix Array.slice

Change-Id: I236b56c020368305f0c714b32b1cd5aeec0efc22
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdate test results
Lars Knoll [Sat, 12 Jan 2013 14:54:44 +0000 (15:54 +0100)]
Update test results

Change-Id: If6d29a3fcffae7985e4afea258551b9fa730155c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCorrectly set the length property of Array objects
Lars Knoll [Sat, 12 Jan 2013 14:47:30 +0000 (15:47 +0100)]
Correctly set the length property of Array objects

Change-Id: Ie193cf869127eaad5302a5130acc9d16e4d18838
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInitialize variable
Lars Knoll [Sat, 12 Jan 2013 14:32:58 +0000 (15:32 +0100)]
Initialize variable

Change-Id: I1dbb45ddca1ba906213b0ec26549d2f347fe6a7e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes for defineProperty
Lars Knoll [Fri, 11 Jan 2013 15:28:05 +0000 (16:28 +0100)]
Fixes for defineProperty

toPropertyDescriptor and PropertyDescriptor::type()
were returning the wrong thing in case there wasn't
an explicitly defined value set.

Fix a few other corner cases.

Change-Id: Iaa351a3e6e24c47e9d549ff113b6907762d11fd2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMake Array.length a real property with attributes
Lars Knoll [Fri, 11 Jan 2013 13:33:10 +0000 (14:33 +0100)]
Make Array.length a real property with attributes

Change-Id: Ib955e151c1d60145948eb5ac76283854dda2cefe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd String::toUInt32() and fix has value for "01", ...
Lars Knoll [Fri, 11 Jan 2013 13:32:15 +0000 (14:32 +0100)]
Add String::toUInt32() and fix has value for "01", ...

Change-Id: I73526fdb4410d163b8a66fb5b467135fcb31d0d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix inplaceBinOp for index properties
Lars Knoll [Fri, 11 Jan 2013 09:19:29 +0000 (10:19 +0100)]
Fix inplaceBinOp for index properties

Change-Id: If72e46deacb22d290dd3bda4093a7807d33a097d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMore correct check for array indices
Lars Knoll [Fri, 11 Jan 2013 09:13:02 +0000 (10:13 +0100)]
More correct check for array indices

Add a helper function to Value to check whether
a value is a valid array index/length and use it
to convert to array indices

Change-Id: Ic216c0f062dd4d54efb3f55bd50c5921f65591c1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd support for throwing RangeErrors
Lars Knoll [Fri, 11 Jan 2013 08:56:56 +0000 (09:56 +0100)]
Add support for throwing RangeErrors

Change-Id: I15bad9d7fe33f9a906d3b2d8da94a969d54d918c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compilation issues.
Erik Verbruggen [Sat, 12 Jan 2013 19:34:04 +0000 (20:34 +0100)]
Fix compilation issues.

Most importantly: make the bits protected instead of private, so
subclasses can access them.

Change-Id: I53f94102feb7ace73957562b40b0ca8514290760
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused MemoryManager::Data::stringPool
Jędrzej Nowacki [Thu, 10 Jan 2013 15:45:14 +0000 (16:45 +0100)]
Remove unused MemoryManager::Data::stringPool

Change-Id: Iffc993c2872329f055c28aefa067a81840c346e9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>