platform/upstream/qtdeclarative.git
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>
11 years agoFix return value of qmljs_delete_subscript
Lars Knoll [Fri, 11 Jan 2013 08:31:51 +0000 (09:31 +0100)]
Fix return value of qmljs_delete_subscript

Change-Id: I526d64459c0171a9911c5b0b13e6136b35b92d17
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCoding style fixes
Lars Knoll [Fri, 11 Jan 2013 08:29:16 +0000 (09:29 +0100)]
Coding style fixes

Change-Id: Idce62159028eadfec128a1f0f416b839ff204e82
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdate TestExpectations
Lars Knoll [Fri, 11 Jan 2013 08:14:14 +0000 (09:14 +0100)]
Update TestExpectations

Change-Id: I1086287f666fba9decf19b3a5e7f2819a663dc95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoProperly set the length property on arrays
Lars Knoll [Thu, 10 Jan 2013 22:22:04 +0000 (23:22 +0100)]
Properly set the length property on arrays

Change-Id: Ic9c571865ee9a2fae512dfe6d83c3805816fe4a1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRefactored iteration over object properties
Lars Knoll [Thu, 10 Jan 2013 21:42:58 +0000 (22:42 +0100)]
Refactored iteration over object properties

Many methods didn't take index based properties into
account when iterating.

Change-Id: Ic4924ab20f0567e66d0beebd79b53f0daf51fc90
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't initialize the property table when not needed
Lars Knoll [Thu, 10 Jan 2013 16:47:07 +0000 (17:47 +0100)]
Don't initialize the property table when not needed

Change-Id: Ibf6339080e27f2cba070529ca918aefe74393f7b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a bug in qmljs_set_element and some related to for...in
Lars Knoll [Thu, 10 Jan 2013 16:33:06 +0000 (17:33 +0100)]
Fix a bug in qmljs_set_element and some related to for...in

Change-Id: Iec876f12529adeba3bc7b9c927e38100fff88042
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix the foreach iterator to also iterate over array values
Lars Knoll [Thu, 10 Jan 2013 14:48:56 +0000 (15:48 +0100)]
Fix the foreach iterator to also iterate over array values

Change-Id: I883b82f5b62ba051a1926bf66e7461286ce10bb0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAlways store array index properties in the array
Lars Knoll [Thu, 10 Jan 2013 14:11:32 +0000 (15:11 +0100)]
Always store array index properties in the array

Property names that represent a valid array index are
now always stored in the Array inside of Object.
String hash values actually map to the index value for
hashes smaller then INT_MAX, making the lookup rather
of these properties rather fast.

Change-Id: Ice4dcd9d92fb488e6bfe7c73838a8b4da67a1906
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFurther refactoring of Array support
Lars Knoll [Wed, 9 Jan 2013 13:19:35 +0000 (14:19 +0100)]
Further refactoring of Array support

Add direct support for dense arrays to speed up
things. Store PropertyDescriptors to allow making
array variables readonly etc., and to support JS
getters and setters with array indices.

Change-Id: I46741cb34c002b0c2c041d427f7b922ec374e115
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove all the SparseArray implementation into SparseArray
Lars Knoll [Tue, 8 Jan 2013 21:52:51 +0000 (22:52 +0100)]
Move all the SparseArray implementation into SparseArray

Array is just a small wrapper, that allocated data on demand.
This makes Object use less space as long as no indexed
properties are being set.

Change-Id: I338298eb13fd7899e52067399719f61bb5e99a13
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDefine the length property correctly for built-in functions
Simon Hausmann [Thu, 10 Jan 2013 15:06:43 +0000 (16:06 +0100)]
Define the length property correctly for built-in functions

It corresponds to the number of formally declared arguments.

Fixes 310 tests :)

Change-Id: I826edb3002e279a95e03579483fcb08927b86629
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify test262.py work-flow
Simon Hausmann [Thu, 10 Jan 2013 08:03:56 +0000 (09:03 +0100)]
Simplify test262.py work-flow

Make test262.py work by default again like the original tool with
regards to TestExpectations, i.e. not use them at all. Instead make
it an option that is now passed via "make check".

So after a change in code we run "make check" to check for any regressions or
fixes. If there are any regressions, then we call tests/test262.py <name of
test> to debug it and by not reading TestExpectations by default the test will
fail.

Change-Id: I00b43c5d09c17c296dfa958293f769663ef49de1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix length property of arguments object
Simon Hausmann [Thu, 10 Jan 2013 07:55:31 +0000 (08:55 +0100)]
Fix length property of arguments object

The length should reflect the number of parameters _actually_ passed to the
function.

Change-Id: Ib38541f2175be6cee5b4ccaf7a9bc32b21531972
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix properties in arguments objects for parameters
Simon Hausmann [Wed, 9 Jan 2013 15:45:31 +0000 (16:45 +0100)]
Fix properties in arguments objects for parameters

According to the spec the parameters that are declared formally
need to have a getter/setter in non-strict mode. But parameters beyond
what's formally declared are just stored by value and dont' have a
setter / getter.

This fixes the "regressions" uncovered by the previous commit and
a bunch of other tests that were marked as failing.

Change-Id: Ib87b84a8a389914f01a95a00ecec452455b17376
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix length of arguments object
Simon Hausmann [Wed, 9 Jan 2013 13:44:09 +0000 (14:44 +0100)]
Fix length of arguments object

Initialize the argumentCount correctly for functions that are called with more
parameters than formally declared. This fixes a whole bunch of tests and also
shows that we are failing on some other tests that use defineProperty on the
arguments object. These tests were "silently" passing before because the
arguments object had the wrong length / content.

The next commit is going to fix those, but it is an unrelated change.

Change-Id: Ia5197e2ea3ea9629e46a5eda1d2d3d63f0cca645
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix enumerable checking.
Erik Verbruggen [Wed, 9 Jan 2013 16:52:23 +0000 (17:52 +0100)]
Fix enumerable checking.

Change-Id: Iff7e19e1eb9595586b3c540bf179773110f0fd3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdated test expectations
Simon Hausmann [Wed, 9 Jan 2013 16:29:04 +0000 (17:29 +0100)]
Updated test expectations

Change-Id: I4458cabdc2ce2b6756146e196926071ddcabc449
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdded parseInt (15.1.2.2) and parseFloat (15.1.2.3).
Erik Verbruggen [Wed, 9 Jan 2013 13:37:55 +0000 (14:37 +0100)]
Added parseInt (15.1.2.2) and parseFloat (15.1.2.3).

Change-Id: I0ff54a59d68596b55fb1add25c29f894b05252b9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdate expectations
Simon Hausmann [Wed, 9 Jan 2013 10:38:11 +0000 (11:38 +0100)]
Update expectations

Mark test as known to fail that is a known regression for now

Change-Id: Ic7b80e7623c379a742341fe23215eca1fad08c9d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove more tests from the list of tests that we expect to fail
Simon Hausmann [Wed, 9 Jan 2013 10:07:11 +0000 (11:07 +0100)]
Remove more tests from the list of tests that we expect to fail

They do pass now after the latest qtdeclarative updates

Change-Id: Ice66d5b95853ea9211ab8da915fc04b57d937a0d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoMake auto-update of TestExpectations smarter
Simon Hausmann [Wed, 9 Jan 2013 10:05:31 +0000 (11:05 +0100)]
Make auto-update of TestExpectations smarter

...by making it also recognize when a test that

    (1) is expected to fail,

_and_

    (2) we expected to fail

and therefore

    (3) expected to _pass_

now suddenly "fails" the way it should fail in the first place.

Change-Id: I78cbf637e3ac9c2e964752d509f9a5fcf1431abf
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoUpdated the test expectations.
Erik Verbruggen [Wed, 9 Jan 2013 09:36:19 +0000 (10:36 +0100)]
Updated the test expectations.

Change-Id: Ia54ed953d1c313b8c24bf195b5de0e52d3058976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some compiler warnings.
Erik Verbruggen [Tue, 8 Jan 2013 11:57:45 +0000 (12:57 +0100)]
Fix some compiler warnings.

Change-Id: I5e2c87581d4c309490f12accfff32418700fbb71
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMark array regressions as expected failures
Simon Hausmann [Tue, 8 Jan 2013 15:47:46 +0000 (16:47 +0100)]
Mark array regressions as expected failures

Change-Id: I9ad9462318ed4759a30f74270cd069cc43d86fcd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix delete someArray[index]
Simon Hausmann [Tue, 8 Jan 2013 15:34:05 +0000 (16:34 +0100)]
Fix delete someArray[index]

The current implementation resized the array, where as we should be
poking a whole into the array. With this patch that's done using
an explicit undefined value. In the future I guess the array will
support sparse segments.

Fixes currently failing tests:
 ch11/11.4/11.4.1/11.4.1-4.a-14 in non-strict mode
 ch15/15.4/15.4.4/15.4.4.18/15.4.4.18-7-2 in non-strict mode
 ch15/15.4/15.4.4/15.4.4.21/15.4.4.21-9-3 in non-strict mode

Change-Id: Idb0a230e38af3ce1f8f80f71257d472434154f95
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agomoth: add builtin_define_getter_setter and builtin_define_property.
Erik Verbruggen [Tue, 8 Jan 2013 15:09:48 +0000 (16:09 +0100)]
moth: add builtin_define_getter_setter and builtin_define_property.

Change-Id: Iffd8c79dbc99f9563235b440fa18e446cedabf0c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMove the Array data up into Object
Lars Knoll [Tue, 8 Jan 2013 13:25:36 +0000 (14:25 +0100)]
Move the Array data up into Object

Objects can just as well have indexed access as Arrays.
They actually behave identical except for the fact that
Array has an automatically updated length property.

Like this we can unify the handling of named and indexed
properties and make sure the methods of the array prototype
work correctly and fast also for objects (as documented).

Change-Id: I3ffb9c39faafb8857a6a676ab9f3fcceda091a99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix potential crashes
Lars Knoll [Tue, 8 Jan 2013 13:16:28 +0000 (14:16 +0100)]
Fix potential crashes

The ProeprtyTable iterator can point to a 0 table entry.
These need to be skipped when iterating over the table.

Change-Id: Idea4d5d42488428d2930be0235538ae349f27142
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdated failing test case list
Lars Knoll [Tue, 8 Jan 2013 13:16:13 +0000 (14:16 +0100)]
Updated failing test case list

Change-Id: Ic0d1ca2922c1aa0a3e791d2127ad38dab4edad95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the PropertyTable into it's own file
Lars Knoll [Tue, 8 Jan 2013 11:42:40 +0000 (12:42 +0100)]
Move the PropertyTable into it's own file

Change-Id: I310f53122ae17275f345c9c57ad70b8d5f48c307
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the PropertyDescriptor into it's own file
Lars Knoll [Tue, 8 Jan 2013 11:39:09 +0000 (12:39 +0100)]
Move the PropertyDescriptor into it's own file

Change-Id: I27f47826a0a3fda85c6d87dbf49c9f86b7d5a0b0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove our String class into a separate file.
Lars Knoll [Tue, 8 Jan 2013 11:35:39 +0000 (12:35 +0100)]
Move our String class into a separate file.

Change-Id: Ibcaa9e9e2675d3c628383c99282b281f9b6880b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSome cleanups for Array
Lars Knoll [Tue, 8 Jan 2013 11:02:13 +0000 (12:02 +0100)]
Some cleanups for Array

Remove some unused code, move length into the
Array (to prepare for a fast path), and fix
a leak in the assignment operator.

Change-Id: I823bb2dc4957ddb74d8fed9c819ea2b1c09c5a24
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSome optimisation to the Array constructor
Lars Knoll [Tue, 8 Jan 2013 11:01:22 +0000 (12:01 +0100)]
Some optimisation to the Array constructor

This will need further changes, as copying an Array
can be expensive.

Change-Id: I32b5083dee6ffaa89687af30e4b3589ee72616da
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd mode to test262.py to edit the test expectations file after unexpected passes
Simon Hausmann [Tue, 8 Jan 2013 10:59:01 +0000 (11:59 +0100)]
Add mode to test262.py to edit the test expectations file after unexpected passes

Make it the default when running "make check", for convenience.

Change-Id: Ia469d67dbcb81f27f243722182da8ab3b8bf88ef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplemented Array::indexOf
Simon Hausmann [Tue, 8 Jan 2013 11:03:01 +0000 (12:03 +0100)]
Implemented Array::indexOf

and unskipped a bunch of tests that were failing

Change-Id: Ic17cb6cb2f89ad18cb6b5313af735f8afda2385e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdate test expectations after array changes
Simon Hausmann [Tue, 8 Jan 2013 10:19:42 +0000 (11:19 +0100)]
Update test expectations after array changes

Some tests are now passing, others we can run now (no OOM anymore)
but they are failing. A few tests remain that need to be skipped
because they still allocate too much memory.

Change-Id: Ie944ffd7b9adee9df605e6411e1b52fc032e0019
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSmall array cleanups
Simon Hausmann [Tue, 8 Jan 2013 10:06:08 +0000 (11:06 +0100)]
Small array cleanups

Remove duplicated code from Array copy constructor and protect
assignment operator against self-assignment.

Change-Id: I0de2cbc54cbfed570a2166c63237f264792dc144
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agonew implementation for array data
Lars Knoll [Mon, 7 Jan 2013 12:09:44 +0000 (13:09 +0100)]
new implementation for array data

The old implementation was using a std::deque, which
doesn't quite scale as it needs to scale.

The new implementation uses a modified red-black tree
to store the array data. The modifications are similar
to the ones in qfragmentmap, allowing for ver efficient
removal from the front of the array.

Change-Id: Iae343981f958bb5fafd0618597b67180d7834dbb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoReplace the WTF RefPtrs with simpler versions
Simon Hausmann [Mon, 7 Jan 2013 12:28:57 +0000 (13:28 +0100)]
Replace the WTF RefPtrs with simpler versions

We do need less functionality, so we get away with less, based on code that's
tested with the full version. This reduces the size of the binary and allows
for the removal of many more forked files.

Change-Id: I3292ad5bb6abed1d531a51c81d59b0ba18da4e72
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace WTF's UNUSED_PARAM with Q_UNUSED
Simon Hausmann [Mon, 7 Jan 2013 12:35:26 +0000 (13:35 +0100)]
Replace WTF's UNUSED_PARAM with Q_UNUSED

Change-Id: I23d75b418cd9d405c288af30475e44ff1724a4ed
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMap WTF_MAKE_NONCOPYABLE straight to Q_DISABLE_COPY
Simon Hausmann [Mon, 7 Jan 2013 12:39:41 +0000 (13:39 +0100)]
Map WTF_MAKE_NONCOPYABLE straight to Q_DISABLE_COPY

Change-Id: Idf914acb41917de8667bb4dcbd1305276a29b8d6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace OwnPtr with a simple QScopedPointer define and a PassOwnPtr wrapper
Simon Hausmann [Mon, 7 Jan 2013 14:51:57 +0000 (15:51 +0100)]
Replace OwnPtr with a simple QScopedPointer define and a PassOwnPtr wrapper

Change-Id: I479cd9cf03700b912748baeb58021b8ec73af987
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoEliminate one more forked file, TypeTraits.h
Simon Hausmann [Mon, 7 Jan 2013 14:56:24 +0000 (15:56 +0100)]
Eliminate one more forked file, TypeTraits.h

Change-Id: Ia0f846a3e5ba0a9d8d1bdf743bc41859d1f4eb8e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoIgnore Qt Creator .pro.user files.
Erik Verbruggen [Mon, 7 Jan 2013 14:49:32 +0000 (15:49 +0100)]
Ignore Qt Creator .pro.user files.

Change-Id: Ie6a68f2c1c9adb7d49681c05cc9e6c0db3ecc136
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdate test expectations
Simon Hausmann [Mon, 7 Jan 2013 11:10:46 +0000 (12:10 +0100)]
Update test expectations

Add a bunch of tests are that _passing_ but are really supposed to fail,
for example tests that contain invalid syntax that's supposed to throw
syntax errors instead. Those tests are tagged with @negative in the test
case itself.

Change-Id: I4756cc07f4a9f026af8047716fd79d2bcf25d1f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix parsing of skipped tests
Simon Hausmann [Mon, 7 Jan 2013 11:14:12 +0000 (12:14 +0100)]
Fix parsing of skipped tests

While adding support for running tests that are supposed to fail,
I broke support for skipping tests altogether. After the split()
on the line the result is of course a list, which in the case of
a single "skip" entry needs to be dereferenced instead of appending
a list to a list as a list item.

Change-Id: Ifd27ee4f762ab092a7333b286ca187309cd631ab
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSpeed up "make check"
Simon Hausmann [Mon, 7 Jan 2013 11:15:19 +0000 (12:15 +0100)]
Speed up "make check"

With make check run the tests in parallel.

Change-Id: I6c9827a5d2ae8264c6d30ec39b0dbea2227ee3b3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSupport progress reporting during parallel test runs
Simon Hausmann [Mon, 7 Jan 2013 07:51:52 +0000 (08:51 +0100)]
Support progress reporting during parallel test runs

Cut the test results into smaller chunks and allow python to process
them in any order, so that we can process incoming results as they
come in.

Change-Id: I96f8d0173a63da2d460a6fcdcecae56137b4acb7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd initial support for parallel test execution
Simon Hausmann [Sun, 6 Jan 2013 21:47:47 +0000 (22:47 +0100)]
Add initial support for parallel test execution

Todo: Incremental test reporting while the tests are running

Change-Id: I69048211b19b5b6b15cc32f65c8ae4a93f27861c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd support for marking failing tests as expected failures
Simon Hausmann [Fri, 4 Jan 2013 16:44:01 +0000 (17:44 +0100)]
Add support for marking failing tests as expected failures

If they suddenly pass, then that's going to show up as "failure"
Might need to tweak the output a little.

Change-Id: I4cec410953bc83d7b85e8c1d1a1ac30d53767e68
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd top-level "make check" target
Simon Hausmann [Fri, 4 Jan 2013 14:53:37 +0000 (15:53 +0100)]
Add top-level "make check" target

... that just runs all the tests.

Change-Id: Ie14f73ab3c742b64aa52a0748b21ae9c9df3dd84
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd support to basic test exceptation handling to test262.py
Simon Hausmann [Fri, 4 Jan 2013 14:51:16 +0000 (15:51 +0100)]
Add support to basic test exceptation handling to test262.py

Initially this will be used to merely skip tests that we cannot run
yet, but it will be extended in the future to also list tests that
are currently failing but _should_ be passing, so that we can detect
it when we fix these.

Change-Id: Ic59f60c7023b261950b6b0ff3a45e00afe7c63e9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify test262.py execution
Simon Hausmann [Fri, 4 Jan 2013 12:52:06 +0000 (13:52 +0100)]
Simplify test262.py execution

Make it possible to call test262.py from anywhere and default to
v4 as command to execute.

Change-Id: If805c7b3733a49f86465e8f7ebaffd581536dfec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoInitial import of Test262 test suite
Simon Hausmann [Fri, 4 Jan 2013 12:46:21 +0000 (13:46 +0100)]
Initial import of Test262 test suite

This also includes a copy of the test262.py script to run
all the tests, which we are going to modify to suit our needs.

Change-Id: I15fd7d0278e39c7076d4e45650fbcf786f7a483f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix break without identifier in labelled loop
Simon Hausmann [Fri, 4 Jan 2013 09:25:01 +0000 (10:25 +0100)]
Fix break without identifier in labelled loop

Make sure to do leaveLoop() after enterLoop() when processing labelled
statements.

Fixes hang in ch12/12.8/S12.8_A3

Change-Id: Iee96ea515524e9ea879f7528dc43e552b1343020
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoProduce a syntax error when a break appears outside of an iteration
Simon Hausmann [Fri, 4 Jan 2013 08:59:04 +0000 (09:59 +0100)]
Produce a syntax error when a break appears outside of an iteration

Fixes expected failure of ch12/12.8/S12.8_A1_T2 and others

Change-Id: I261d649f6a29bbd6debfca35e7ccaf1a0a7006b9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix hang in do-while loops with continue statement in the body
Simon Hausmann [Fri, 4 Jan 2013 08:09:39 +0000 (09:09 +0100)]
Fix hang in do-while loops with continue statement in the body

The construct

do {
   ...
   continue;
} while (condition)

Would result in the body basic block ending with a jump to the loop body,
causing an infinite loop.

Instead we have to place the condition into an extra block and set that one as
the target for continue.

This is also covered by ch12/12.14/S12.14_A9_T2, which uses such a loop.

Change-Id: If06de112b338b74b9a49e3d6b51078463645196d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSet data properties using __defineOwnProperties__
Lars Knoll [Thu, 3 Jan 2013 21:56:52 +0000 (22:56 +0100)]
Set data properties using __defineOwnProperties__

Properties in object literals are defined using
defineOwnProperty, so that they get set even if
the object prototype contains a non writable
property with the same name.

This fixes all remaining test cases for 11.1.5

Change-Id: I3928a144d09c51c5bf20a25bcb1c6c3c243975ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThrow syntax errors with duplicated values in Object literals
Lars Knoll [Thu, 3 Jan 2013 21:40:02 +0000 (22:40 +0100)]
Throw syntax errors with duplicated values in Object literals

Object literals can only contain duplicated values for data
properties in non strict mode. In all other cases throw a
syntax error.

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