platform/upstream/qtdeclarative.git
11 years agoSplit CallBuitin variants into separate instructions.
Erik Verbruggen [Sun, 27 Jan 2013 08:59:37 +0000 (09:59 +0100)]
Split CallBuitin variants into separate instructions.

This saves space by removing (sometimes) unused parameters, and the need
to store and switch over another enum to determine which of the various
built-in instructions is called.

Change-Id: Ie59c49608bf445a07d406b45fd48cfb94bbfc919
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago"Fix" llvm build by adding empty definitions for missing methods.
Erik Verbruggen [Tue, 29 Jan 2013 08:17:22 +0000 (09:17 +0100)]
"Fix" llvm build by adding empty definitions for missing methods.

Change-Id: I172ad23bc56bda9b3a8276cb102599d6243026c4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoChange TEMP handling in the interpreter.
Erik Verbruggen [Fri, 25 Jan 2013 18:32:30 +0000 (19:32 +0100)]
Change TEMP handling in the interpreter.

By introducing the Param struct, and moving the ValueOrTemp into it
too, the parameter decoding for instructions is cleaner and less
error-prone: it de-couples the HIR/MIR representation from the
interpreter representation, and allows for proper handling of the
with-context.

Change-Id: I0bc8f72bc7ce62b8efa298cbea5711adac4a4d34
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix build on ia32
Simon Hausmann [Mon, 28 Jan 2013 12:49:03 +0000 (13:49 +0100)]
Fix build on ia32

loadArgument(PointToValue) is architecture independent :)

Change-Id: I6ce8b7900088bc7052002a9ae60cbebdd5357d8d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoProperly working post increment/decrement operators
Lars Knoll [Sun, 27 Jan 2013 20:16:09 +0000 (21:16 +0100)]
Properly working post increment/decrement operators

This required some larger changes in our infrastructure.
Unfortunately the post increment/decrement operators
don't return the old value unmodified, but return
toNumber(oldValue).

At the same time they need to properly store the new value
into the referenced expression. The only way to solve this
(as we can't have two return values) is to pass a proper
reference into runtime methods.

Change-Id: I0e0c2cc011ab22d5d4b27924abc8c18372c104a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller cleanup
Lars Knoll [Mon, 28 Jan 2013 10:42:01 +0000 (11:42 +0100)]
Smaller cleanup

Change-Id: I42a1de385e286bf1e4568769886034161f7fe500
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agonew eval() should throw a type error
Lars Knoll [Mon, 28 Jan 2013 09:50:07 +0000 (10:50 +0100)]
new eval() should throw a type error

Change-Id: I487a11a060657ac1eeae4c51085ce907711b51c8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd a mechanism to protect managed objects from deletion
Lars Knoll [Mon, 28 Jan 2013 12:32:08 +0000 (13:32 +0100)]
Add a mechanism to protect managed objects from deletion

Change-Id: I6700dc94ad481e12ee7f00c04c0c37261e22a715
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
11 years agoSet the prototype for FunctionObject in it's constructor
Lars Knoll [Mon, 28 Jan 2013 09:41:42 +0000 (10:41 +0100)]
Set the prototype for FunctionObject in it's constructor

This avoids a few test failures where the prototype for
eval wasn't set up correctly.

Change-Id: I5a5c1dafe4a6328bf1bbc95901ff22df10083a86
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMost statements don't return a value
Lars Knoll [Mon, 28 Jan 2013 09:40:30 +0000 (10:40 +0100)]
Most statements don't return a value

In eval mode, we need to write the result of statements
into the return value. But most statements don't return
a value, so the statement shouldn't write a return value.

Change-Id: I9ce24fe6689bd2bb2aee6241ca84a25f9a266f5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoProperly set the length of the eval function
Lars Knoll [Mon, 28 Jan 2013 09:39:40 +0000 (10:39 +0100)]
Properly set the length of the eval function

Change-Id: I88a483f5c9a758c4983d5d3b2c684f6bc7e8cf55
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix call expressions with a subscript
Lars Knoll [Sun, 27 Jan 2013 21:39:01 +0000 (22:39 +0100)]
Fix call expressions with a subscript

Call expressions such as foo[bar]() where wrongly converted to a
temporary and then called by value. This made the call have the
wrong this argument, as the reference was resolved in the assignment
to the temporary.

Change-Id: Id6044f833dfcf9ee8fa4f9ec0602a929abdc2c48
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix constness of Value::toXXX functions.
Jędrzej Nowacki [Mon, 28 Jan 2013 11:54:07 +0000 (12:54 +0100)]
Fix constness of Value::toXXX functions.

Change-Id: I66d622555b2cca4e6aa546745fd0e46373dee919
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoNumber/Boolean.prototype.toString() also accept matching primitive values
Lars Knoll [Sun, 27 Jan 2013 21:31:28 +0000 (22:31 +0100)]
Number/Boolean.prototype.toString() also accept matching primitive values

These methods also accept matching (ie. booleans or numbers) primitives
as this argument.

Change-Id: Ib31cadd46d327381abf02847ae35e7be05715f84
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThe function prototype has a length property
Lars Knoll [Sun, 27 Jan 2013 21:13:28 +0000 (22:13 +0100)]
The function prototype has a length property

Change-Id: I1ef4d7c86ac5c5a8e7ed08081a86c4f826527c0d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agotest function names for eval or arguments in strict mode
Lars Knoll [Sun, 27 Jan 2013 20:27:44 +0000 (21:27 +0100)]
test function names for eval or arguments in strict mode

using these as function names should trigger a syntax error
in strict mode.

Change-Id: I8d83fda72db856b692c8f6f1454c762255bcaef1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a bug in the evaluation of &&
Lars Knoll [Sun, 27 Jan 2013 16:30:40 +0000 (17:30 +0100)]
Fix a bug in the evaluation of &&

Change-Id: Ia446bd05dcca3fc146719284e5ac96d4c7d61c06
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix empty return statement in eval
Simon Hausmann [Fri, 25 Jan 2013 15:03:06 +0000 (16:03 +0100)]
Fix empty return statement in eval

It should throw a syntax error even inside eval it seems.

Change-Id: I4de6d96f9ba61569d7d7e723ecb5f2d946c8f4ad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix remaining issues with the delete operator
Simon Hausmann [Fri, 25 Jan 2013 14:52:42 +0000 (15:52 +0100)]
Fix remaining issues with the delete operator

Delete on known temps should return true and false on known local variables.

Change-Id: I71be8361306eb825b975a3aee294665eb8561366
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix more tests with the delete operator
Simon Hausmann [Fri, 25 Jan 2013 13:00:48 +0000 (14:00 +0100)]
Fix more tests with the delete operator

Delete on non-reference types should return true. Delete on our
temporaries should evaluate to false.

Change-Id: Ic6b39a0cf5833900f2a492ac8b37386fc2963ab3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSuppress a linker warning for unused flag.
Erik Verbruggen [Fri, 25 Jan 2013 08:34:54 +0000 (09:34 +0100)]
Suppress a linker warning for unused flag.

Change-Id: I53aaf5f7bc7ec63e92e02d18010b2f1d53c40a00
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove the isString and isArray flags in Managed
Lars Knoll [Fri, 25 Jan 2013 12:41:37 +0000 (13:41 +0100)]
Remove the isString and isArray flags in Managed

These are not needed anymore, as we have the type stored
in the object.

Change-Id: I86594f4c3b3669ee0576e1ca141a64494e82a176
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoInline casting of Value to objects
Lars Knoll [Fri, 25 Jan 2013 12:23:58 +0000 (13:23 +0100)]
Inline casting of Value to objects

Change-Id: Ic5538b8a0a1f430a265399bced0ce9fc0a79696e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove a bunch of virtuals in Object
Lars Knoll [Fri, 25 Jan 2013 12:13:06 +0000 (13:13 +0100)]
Remove a bunch of virtuals in Object

This should speed up casting to the derived types, and
simplify things in the longer term.

Change-Id: I7362c86e5e2724d5b7e245695f9fe29144999715
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFaster marking of objects in the GC
Lars Knoll [Fri, 25 Jan 2013 11:43:44 +0000 (12:43 +0100)]
Faster marking of objects in the GC

Change-Id: I4ccbf7fc50758fc176bfdb2f0382a7ec1f18d6ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd missing return statement
Lars Knoll [Fri, 25 Jan 2013 11:16:45 +0000 (12:16 +0100)]
Add missing return statement

Fixes crypto.js

Change-Id: If3b2d182b8e6a93acd2c32904e5b9a9fd49181cf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove a few virtual keywords that aren't required anymore
Lars Knoll [Fri, 25 Jan 2013 09:38:52 +0000 (10:38 +0100)]
Remove a few virtual keywords that aren't required anymore

Change-Id: Ic7d46d78cd1efeac16a25586c5b8fb3cb761512d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compilation of llvm backend.
Erik Verbruggen [Thu, 24 Jan 2013 14:49:05 +0000 (15:49 +0100)]
Fix compilation of llvm backend.

Change-Id: I714977f7e5e7040a8fd252525cd9f84fbfe40862
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDelete on a function argument should return false
Simon Hausmann [Thu, 24 Jan 2013 15:07:18 +0000 (16:07 +0100)]
Delete on a function argument should return false

Change-Id: I36aafcfa43bced2b8315af39432cf7731daaf458
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoThrow a syntax error if eval or arguments is used in increment/decrement expressions
Simon Hausmann [Thu, 24 Jan 2013 14:36:33 +0000 (15:36 +0100)]
Throw a syntax error if eval or arguments is used in increment/decrement expressions

Change-Id: Icd966b626a172302eb4b22f5cadba0085d31c320
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix inplace operators
Lars Knoll [Thu, 24 Jan 2013 14:32:12 +0000 (15:32 +0100)]
Fix inplace operators

We actually need to call __put__ on the result of the
operation even if the lhs didn't exist before.

Change-Id: I54acaab203fd34fd88a36685211e382a8399b11b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAvoid integer division by 0
Lars Knoll [Thu, 24 Jan 2013 14:31:54 +0000 (15:31 +0100)]
Avoid integer division by 0

Change-Id: I5c50878192e3f4dd6e7297e51a450840c4c1037e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThrow a reference error when trying to use an invalid lvalue
Lars Knoll [Thu, 24 Jan 2013 14:03:00 +0000 (15:03 +0100)]
Throw a reference error when trying to use an invalid lvalue

Change-Id: I08c19710eaf58da100852fa9c2b07a4d8bb8b0c4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix return statement outside of function body
Simon Hausmann [Thu, 24 Jan 2013 13:27:36 +0000 (14:27 +0100)]
Fix return statement outside of function body

Such a program is syntactically incorrect

Change-Id: Ica23c67aae55890a36064987f6019d9d7f50585e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix properties of literal array initialisers
Simon Hausmann [Thu, 24 Jan 2013 11:53:47 +0000 (12:53 +0100)]
Fix properties of literal array initialisers

Array entries defined in such a way need to be own properties.
To avoid calling builtin_define_property with the integer index
converted to a string for each property, this patch also introduces
a builtin_define_array_property that takes an integer index instead.

Change-Id: Ib21f99a555b3237753a7930a7edc70bfcd49ac18
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix the remaining test failures for the with() statement
Lars Knoll [Thu, 24 Jan 2013 12:12:26 +0000 (13:12 +0100)]
Fix the remaining test failures for the with() statement

Properly pop the pushed scopes for break, continue and return
statements inside with() blocks.

Change-Id: I7439cd7b7c70819cd5de903395e1b67c394a38c6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRename some builtin methods
Lars Knoll [Thu, 24 Jan 2013 11:13:47 +0000 (12:13 +0100)]
Rename some builtin methods

rename push_with to push_with_scope and
pop_with to pop_scope. This is to prepare
for adding a push_catch_scope.

Change-Id: I73d30d097fc50f4a00d94f5927d154292bcd4482
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCreate a real execution context for with() statements
Lars Knoll [Thu, 24 Jan 2013 10:58:46 +0000 (11:58 +0100)]
Create a real execution context for with() statements

This is required for full spec compliance.

Change-Id: I0c1a3ed249a458032d29ba80650a5fdc2eac5c01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix build on Mac OS X
Simon Hausmann [Thu, 24 Jan 2013 11:26:44 +0000 (12:26 +0100)]
Fix build on Mac OS X

Use std::isnan instead of isnan, like everywhere else in the file.

Change-Id: Ie58288b0a8d2043dc88054babe3beee78007cd15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix evaluation of lhs in binary expressions
Simon Hausmann [Thu, 24 Jan 2013 10:58:58 +0000 (11:58 +0100)]
Fix evaluation of lhs in binary expressions

The entire left hand side of a binary expression must be evaluated
before the right hand side. In case of for example

    x !== (x = 1)

it is important to generate the code for looking up "x" from the
lhs before dealing with the rhs, because this overall expression
is supposed to throw a reference error.

Change-Id: I03aee3257ff7b7a60aa789dba9f0445c387a1ad5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation of (incomplete) llvm backend.
Erik Verbruggen [Thu, 24 Jan 2013 10:56:26 +0000 (11:56 +0100)]
Fix compilation of (incomplete) llvm backend.

Change-Id: Ib87c3427cfd937516a58849540e0e668a28cb8dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSkip Intl tests for now and re-generate TestExpectations
Simon Hausmann [Thu, 24 Jan 2013 09:20:12 +0000 (10:20 +0100)]
Skip Intl tests for now and re-generate TestExpectations

Change-Id: I178222506bf697451a3b83c8595bfb0e88b71eae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix all but one remaining test case for exceptions
Lars Knoll [Wed, 23 Jan 2013 21:49:31 +0000 (22:49 +0100)]
Fix all but one remaining test case for exceptions

Change-Id: I03d42eeeb28a0f75d3cad81cb7af815c9784c43e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix bug in switch statement
Lars Knoll [Wed, 23 Jan 2013 22:11:54 +0000 (23:11 +0100)]
Fix bug in switch statement

Change-Id: I42f509f825d8c095c3762a86e5da881de1038d7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix wrong constant folding
Lars Knoll [Wed, 23 Jan 2013 20:53:54 +0000 (21:53 +0100)]
Fix wrong constant folding

Change-Id: I8c48ae0597c41c69c77d56cba4c6be738d5d282b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoLabelled statements can also appear outside of loops
Lars Knoll [Wed, 23 Jan 2013 20:47:44 +0000 (21:47 +0100)]
Labelled statements can also appear outside of loops

Change-Id: I121b9341dd102964f52dec2a0278c2a3d74b9a8a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoLoops are local to functions
Lars Knoll [Wed, 23 Jan 2013 20:00:38 +0000 (21:00 +0100)]
Loops are local to functions

Loops need to be reset when parsing an inner function,
as labels can't cross these boundaries.
Also throw a syntax error when a continue statement
outside a loop is encountered.

Change-Id: I69484a2f7a550590194e82667bc4c66aba89ae43
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't crash on for(x in null)
Lars Knoll [Wed, 23 Jan 2013 19:44:47 +0000 (20:44 +0100)]
Don't crash on for(x in null)

Change-Id: I3bd5610fa9bffcc195bb1c96a5a595061931a20e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a crash when a non direct call to eval caused a syntax error
Lars Knoll [Wed, 23 Jan 2013 19:24:12 +0000 (20:24 +0100)]
Fix a crash when a non direct call to eval caused a syntax error

Change-Id: I89d1eabd248fd844f7cd2caa29667e0c7850958d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some errors related to strict mode
Lars Knoll [Wed, 23 Jan 2013 14:20:44 +0000 (15:20 +0100)]
Fix some errors related to strict mode

eval and arguments aren't allowed in variable
declarations or as lvalues.
More correct propogation of the strict mode flag from
eval into Codegen.

Change-Id: Ic519900463aa2f57311a64787e33bc6924838f16
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement JSON.stringify
Lars Knoll [Wed, 23 Jan 2013 13:31:05 +0000 (14:31 +0100)]
Implement JSON.stringify

Change-Id: If1d170767c61c2435fe82f7e26e1ebf8de6327bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix callBuiltinInvalid for the interpreter.
Erik Verbruggen [Wed, 23 Jan 2013 12:21:09 +0000 (13:21 +0100)]
Fix callBuiltinInvalid for the interpreter.

Change-Id: Ifde12261a7c66a7b268129d5fae4ae626e16a00f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix crash when using the built-in regexp syntax
Simon Hausmann [Wed, 23 Jan 2013 10:50:01 +0000 (11:50 +0100)]
Fix crash when using the built-in regexp syntax

When /someregexp/ appears in the source, we generate a new regexp
object in the MASM back-end at run-time. That object is memory
managed but it's never marked, because we only store its address
in the generated code.

This patch adds a way for the code generator to collect values that
are generated like this and encoded only in the code directly, and
therefore require extra book-keeping when collecting the roots.

Change-Id: Ia4cc3f4578e2e7e4378ea7ab1a32c66f0e6ab4bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRefactor JSON.parse
Lars Knoll [Wed, 23 Jan 2013 09:39:58 +0000 (10:39 +0100)]
Refactor JSON.parse

Use a modified copy of the parser in QtCore to get
all test cases to pass and to be a lot faster.

In addition, this will later on to add support for
the second argument to JSON.parse

Change-Id: Iaa4cbda29db9c53c3dd5ab2b2ded71efdaa6f8ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compiler warnings.
Erik Verbruggen [Wed, 23 Jan 2013 10:04:48 +0000 (11:04 +0100)]
Fix compiler warnings.

The second call method in EvalFunction was hiding an overloaded virtual
function, hence the name change.

Change-Id: Ic333d1e7359df97ff25dace87c80b40a939a4cea
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMethod signature changes to remove duplicate logic.
Erik Verbruggen [Wed, 23 Jan 2013 09:22:52 +0000 (10:22 +0100)]
Method signature changes to remove duplicate logic.

Change-Id: Ib4a17dd90629a71f1ee2daa442e49d2237b1073d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix eval when a context gets inherited.
Erik Verbruggen [Wed, 23 Jan 2013 09:12:51 +0000 (10:12 +0100)]
Fix eval when a context gets inherited.

When a context gets inherited, the locals have to be passed into the
CodeGen class, so the indexes in the caller and callee match up.

Change-Id: I21f496e8355a5dd7f13c06e011ede60fc04ccba0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSplit off 2 builtins into their own instruction.
Erik Verbruggen [Wed, 23 Jan 2013 09:11:05 +0000 (10:11 +0100)]
Split off 2 builtins into their own instruction.

The foreach-iterator-object and foreach-next-property-name now have
their own interpreter instructions. Also cleaned up the parameter
passing helper methods.

Change-Id: I3f375ba29e1ae914e707039b157fa011878b88b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix direct vs indirect calls to eval (15.1.2.11)
Lars Knoll [Wed, 23 Jan 2013 09:07:18 +0000 (10:07 +0100)]
Fix direct vs indirect calls to eval (15.1.2.11)

Change-Id: I6f5dc4a1cc538f255c614838821dd2b379ba2832
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix crash when using continue in switch inside loop
Simon Hausmann [Wed, 23 Jan 2013 08:42:46 +0000 (09:42 +0100)]
Fix crash when using continue in switch inside loop

Statements like switch() call enterLoop() with a null continue block.
However it is permitted to use continue inside a case in switch, and
that should then continue in the next outter loop that supports it.

Change-Id: I723d2dad3123a2a658964d541522c7961f578dbf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix test results to match exceptations on i386
Simon Hausmann [Wed, 23 Jan 2013 08:37:13 +0000 (09:37 +0100)]
Fix test results to match exceptations on i386

Use SSE math instead of i387 to get the expected results for
ch08/8.5/S8.5_A2.1 and ch08/8.5/S8.5_A2.2

Change-Id: Ide1a29340c5ea7a786a679ceb4712c033c6e7fd8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
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>