platform/upstream/qtdeclarative.git
11 years agoFix missing code generation for inplace operations on locals.
Erik Verbruggen [Thu, 29 Nov 2012 13:36:16 +0000 (14:36 +0100)]
Fix missing code generation for inplace operations on locals.

Change-Id: I8fe7d87eabf2566f251319e8dae005aacc27eb0d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix outgoing argument start position.
Erik Verbruggen [Thu, 29 Nov 2012 13:35:18 +0000 (14:35 +0100)]
Fix outgoing argument start position.

Change-Id: Ie1b86746dc578ce479f5c072e2e1190826a7739c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplement Object.keys and obj.proto.propertyIsEnumerable
Lars Knoll [Wed, 28 Nov 2012 22:26:26 +0000 (23:26 +0100)]
Implement Object.keys and obj.proto.propertyIsEnumerable

Change-Id: I30df135ad95f24246e43553b2711ad1008319d56
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement Object.seal/freeze/preventExtensions
Lars Knoll [Wed, 28 Nov 2012 22:10:03 +0000 (23:10 +0100)]
Implement Object.seal/freeze/preventExtensions

And the corresponding getters.

Change-Id: I5038ec3f87f932d65c67cafd36ec00b9970a5f51
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd defineGetter and defineSetter methods to Object
Lars Knoll [Wed, 28 Nov 2012 21:45:43 +0000 (22:45 +0100)]
Add defineGetter and defineSetter methods to Object

These methods are de-facto standard (every engine implements
them), and also allow testing of accessor properties.

Change-Id: I1fcaa7467f7be56ea758bf511e843385f74b9641
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix copy-paste coding error. "m" is null in the else part.
Erik Verbruggen [Wed, 28 Nov 2012 13:59:42 +0000 (14:59 +0100)]
Fix copy-paste coding error. "m" is null in the else part.

Change-Id: I5ef62c984f169b9a50ec1d90bd02c5593fde3745
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoTune the message property (value) of SytaxError a bit.
Erik Verbruggen [Wed, 28 Nov 2012 13:16:21 +0000 (14:16 +0100)]
Tune the message property (value) of SytaxError a bit.

Change-Id: I231eb1eeb8f01461ea61b3989743bbd01256e251
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace qIsNaN usage with std::isnan, which is often faster.
Erik Verbruggen [Wed, 28 Nov 2012 12:47:20 +0000 (13:47 +0100)]
Replace qIsNaN usage with std::isnan, which is often faster.

Change-Id: Ie4d16fcdb575ca168d5b58978c5a510acf0cd1ca
std::isnan is often a compiler intrinsic.
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoTune the bucket count a bit to be a prime upto 68000 entries.
Erik Verbruggen [Wed, 28 Nov 2012 12:44:26 +0000 (13:44 +0100)]
Tune the bucket count a bit to be a prime upto 68000 entries.

The ECMA test suite has some tests that throw in vars with all possible
unicode names. So, this should make it safer for longer.

Change-Id: I4a65ab7d09a357d7665509d38e401098ab6e4607
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoIntroduce a simple string pool to speed up lookups.
Erik Verbruggen [Wed, 28 Nov 2012 12:39:14 +0000 (13:39 +0100)]
Introduce a simple string pool to speed up lookups.

This change uniques string pointers, so the String::isEqualTo will more
often succeed in the pointer-equality case.

Change-Id: I1d4f1a70147c48bc75359642a56a0446b5fbf199
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoStop leaking the DeclarativeEnvironment and ExecutionContext.
Erik Verbruggen [Wed, 28 Nov 2012 12:35:53 +0000 (13:35 +0100)]
Stop leaking the DeclarativeEnvironment and ExecutionContext.

Also fixes non-POD warnings with Clang, as the constructor of the
DeclarativeEnvironment is now gone.

Change-Id: I15e02aabb195243415b088a8b030f0064a7e84a3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoThrow a SyntaxError instead of printing an error message.
Erik Verbruggen [Wed, 28 Nov 2012 10:00:23 +0000 (11:00 +0100)]
Throw a SyntaxError instead of printing an error message.

Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix a bug in Object::__put__()
Lars Knoll [Tue, 27 Nov 2012 23:12:33 +0000 (00:12 +0100)]
Fix a bug in Object::__put__()

The method was always throwing in strict mode, due to
a missing return statement.

Change-Id: I85e44f8067d1f2aea76d03e42abf31a0d5a2d180
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoObey strict mode for property getters and setters
Lars Knoll [Tue, 27 Nov 2012 22:23:04 +0000 (23:23 +0100)]
Obey strict mode for property getters and setters

Change-Id: I6f51cd72c2607989c55373dfee53130381f5ef75
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoRemove unused methods
Lars Knoll [Tue, 27 Nov 2012 21:59:51 +0000 (22:59 +0100)]
Remove unused methods

Change-Id: I4b0553b1fb6522131a05a66f8cba44bce5192e55
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoImplement the first parts of strict mode.
Lars Knoll [Tue, 27 Nov 2012 21:42:20 +0000 (22:42 +0100)]
Implement the first parts of strict mode.

Tested with eval() which now obeys strict mode
semantics.

Change-Id: Ib3c7f31047e43c1ef0fa74261f23ec4f2ea4244f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoCheck for strict mode, and store it.
Erik Verbruggen [Tue, 27 Nov 2012 15:46:04 +0000 (16:46 +0100)]
Check for strict mode, and store it.

Change-Id: I88e48a982eb6d4041aed085de0420d98cf96d406
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd more built-ins to the interpreter.
Erik Verbruggen [Tue, 27 Nov 2012 11:17:19 +0000 (12:17 +0100)]
Add more built-ins to the interpreter.

Change-Id: I6a1656a8a2042b0a02d6e3bb8e59c9db52f6fd5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCorrectly instantiate variables in the local scope
Lars Knoll [Mon, 26 Nov 2012 22:26:39 +0000 (23:26 +0100)]
Correctly instantiate variables in the local scope

This fixes cases where eval() would create variables
in the wrong scope.

Change-Id: Ie93ec2d1fb125e588c1b6ffa2ca8ca4b6e3112c9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix constant value parameter passing on ia32
Simon Hausmann [Mon, 26 Nov 2012 21:49:35 +0000 (22:49 +0100)]
Fix constant value parameter passing on ia32

Fix the order of tag and value when pushing constants onto the stack, given
that the stack grows in reverse order.

This fixes crypto.js and all sorts of other tests.

Change-Id: I1f6aa546e5453f890db582283fd4da609292f22b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix: do not rune codegen when there is no program.
Erik Verbruggen [Mon, 26 Nov 2012 13:38:14 +0000 (14:38 +0100)]
Fix: do not rune codegen when there is no program.

Happens in valid cases like an empty JS file (or one only containing
comments).

Change-Id: I553f57503b46da29276b06532a14e2a74395d84c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix the worst problems with eval()
Lars Knoll [Sun, 25 Nov 2012 19:53:57 +0000 (20:53 +0100)]
Fix the worst problems with eval()

Support is still not fully compliant. Especially
variables declared within eval() might end
up in the wrong (global) scope in some cases.

Change-Id: I44d60f57b2af0b54a2759bd887fb2b3751116cd2
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix some issues with the delete operator
Lars Knoll [Sat, 24 Nov 2012 23:26:28 +0000 (00:26 +0100)]
Fix some issues with the delete operator

Properly implement delete operator for identifiers
and local variables.

Change-Id: I8ac55edc80c31a94d11444c9f5c78caf4b131c95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSupport for the with statement
Lars Knoll [Sat, 24 Nov 2012 21:07:02 +0000 (22:07 +0100)]
Support for the with statement

Add the with object (list) to the environment, and check properties
there if it's available.
Generate IR statements implementing with() support.
Add two new builtin methods to enter and leave a with scope.
Implement support for the builtin's in masm.
Make sure exception handling works across with scopes.

Change-Id: I8257a16cfccc91a1acedfd740ade711b016b33fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove some unused methods
Lars Knoll [Sat, 24 Nov 2012 21:04:33 +0000 (22:04 +0100)]
Remove some unused methods

Change-Id: Ic23a93822ff28701890e97c2d5844fa9a23c4b4a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix return from generated code when return value is passed on the stack
Simon Hausmann [Sat, 24 Nov 2012 08:59:51 +0000 (09:59 +0100)]
Fix return from generated code when return value is passed on the stack

On ia32 the return VM value doesn't fit into a register. Instead the
caller provides a pointer to where the return value can be stored
as a first invisible argument. This is where we then copy the return
value to. It is the callee's responsibility to remove that one invisible
argument from the stack. Usually this is done using a "ret <n>" instruction,
which however masm doesn't support, so we emulate it. That might not be
any slower, since it's kind of replacing the CISC ret <n> instruction with
RISC :)

Change-Id: I4cb842e5a0a95a3d52867e66216dd711d627cf25
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation on ia32
Simon Hausmann [Sat, 24 Nov 2012 07:37:20 +0000 (08:37 +0100)]
Fix compilation on ia32

Added a stub loadArgument(Expr, Register) that isn't actually
used at run-time

Change-Id: Ie75df4dbdde84f9c51f164292ff2fc9b01aa1da3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCorrectly bind varibles in the global context
Lars Knoll [Fri, 23 Nov 2012 22:56:25 +0000 (23:56 +0100)]
Correctly bind varibles in the global context

Variables need to be bound to the execution context
before entering the method. For the global scope this
implies that declared variables are available, but may
be undefined. The lines:

print(x)
var x = 1;

has to print 'undefined' and not throw a type error.

Change-Id: I9d7062823da83cd4c4e74588693bb0ce8dc85c6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixed temp compression and added a whole lot of debug info.
Erik Verbruggen [Thu, 22 Nov 2012 15:28:13 +0000 (16:28 +0100)]
Fixed temp compression and added a whole lot of debug info.

Unlike the variables (locals), the return value did not have a fixed
temp. So by pinning it, it won't move around.

Change-Id: Ib35024e2baa60b64fcb05ca4aa7f49acad89e7cb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix for local count in the global context.
Erik Verbruggen [Thu, 22 Nov 2012 11:18:56 +0000 (12:18 +0100)]
Fix for local count in the global context.

Change-Id: If0f07c995a51df45603c5581c721da15c1050158
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoKeep the EvalISelFactory in the ExecutionEngine.
Erik Verbruggen [Tue, 20 Nov 2012 12:41:49 +0000 (13:41 +0100)]
Keep the EvalISelFactory in the ExecutionEngine.

Also corrected the class name cApiTaliSatiOn.

Change-Id: I131566e904c8ee575686a469f16d098dd512d865
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix function calls on linux/ia32
Simon Hausmann [Tue, 20 Nov 2012 09:50:42 +0000 (10:50 +0100)]
Fix function calls on linux/ia32

Remove supposed stack size alignment correction after function calls

This code was supposed to "align" the stack pointer after a function call,
but we can't really add more to the stack pointer than what we previously
subtracted.

It should've practically been a noop on amd64 since we don't actually
use the stack for function calls there, which is why this manifested only
on ia32.

Change-Id: I5644e9e179bd1b7c45daca7d88687bd5d83a4104
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoUse an isel factory instead of MASM in FunctionCTor.
Erik Verbruggen [Tue, 20 Nov 2012 12:24:24 +0000 (13:24 +0100)]
Use an isel factory instead of MASM in FunctionCTor.

Change-Id: I070f056411f16d837ff5eac191fac11cd0bd3c47
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCleanup instruction selection interface for MASM and MOTH.
Erik Verbruggen [Tue, 20 Nov 2012 11:45:36 +0000 (12:45 +0100)]
Cleanup instruction selection interface for MASM and MOTH.

This fixes a regression in MOTH.

Change-Id: Icd9e2ebf49ab6190bf932a94da03c4171c8d9c61
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCompress temp usage in the interpreter.
Erik Verbruggen [Tue, 20 Nov 2012 08:35:32 +0000 (09:35 +0100)]
Compress temp usage in the interpreter.

Uses a variation on linear scan register allocation as the algorithm. As
it depends on liveness analysis, keep that data around after codegen is
finished (in IR::Stmt::Data). Added clean-up code for it in the
IR::Function destructor.

Change-Id: If3636648efbafcc1df469a24aaa885e21e6a2f16
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoActually return the return value from the interpreter.
Erik Verbruggen [Tue, 20 Nov 2012 08:48:11 +0000 (09:48 +0100)]
Actually return the return value from the interpreter.

Change-Id: I38cb4bc431f1bab796f08fc217747e06070a2c78
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMake LLVM backend compile again.
Erik Verbruggen [Tue, 20 Nov 2012 08:47:18 +0000 (09:47 +0100)]
Make LLVM backend compile again.

Moved common code into a separate function.

Change-Id: Iaa96c27214659a23b3df70b80560fb8f42792b38
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix debug code and add some asserts.
Erik Verbruggen [Tue, 20 Nov 2012 09:08:14 +0000 (10:08 +0100)]
Fix debug code and add some asserts.

Change-Id: I947a72ff43190d15fd4a2857ed97b75cc510db66
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMove the exception variable into the engine
Lars Knoll [Mon, 19 Nov 2012 21:24:12 +0000 (22:24 +0100)]
Move the exception variable into the engine

It's easier to store this in the engine then
in the execution context.

Change-Id: I01ff447602a7d785165e774bdf6e1735c073be2d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoRemove the unused handlersBlock in the IR::Function
Lars Knoll [Mon, 19 Nov 2012 20:32:15 +0000 (21:32 +0100)]
Remove the unused handlersBlock in the IR::Function

This block was used for the old exception handling mechanism
that is not in use anymore.

Change-Id: If5adf89e43a22ab167378827c0e97f9907d8a366
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoMake masm work again
Lars Knoll [Mon, 19 Nov 2012 15:14:37 +0000 (16:14 +0100)]
Make masm work again

Masm can't currently deal correctly with a single
instance of the isel object. Otherwise we'll
get completely wrong pointers to the different
methods set up.

Change-Id: Ic3ee06f2f83e5491a6b9ee422ae39611b89d1460
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoreturn results directly instead of using the context
Lars Knoll [Sun, 18 Nov 2012 23:00:50 +0000 (00:00 +0100)]
return results directly instead of using the context

The result variable in the context is not really
required, as we can return results directly in the
return value register.

Change-Id: I12554c228500aa24625ef82e31fd7f72989a71bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoAdded missing file.
Erik Verbruggen [Mon, 19 Nov 2012 13:59:53 +0000 (14:59 +0100)]
Added missing file.

Change-Id: I2b55ed78e8b30bffc67c4a1eee0bf4a438f0f29a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix isel for eval and a whole bunch of other warnings.
Erik Verbruggen [Mon, 19 Nov 2012 12:15:25 +0000 (13:15 +0100)]
Fix isel for eval and a whole bunch of other warnings.

A factory is now passed along to do the codegen for eval().

Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdded isNaN and isFinite to the global context.
Erik Verbruggen [Mon, 19 Nov 2012 10:54:54 +0000 (11:54 +0100)]
Added isNaN and isFinite to the global context.

Change-Id: Ia85d27a6ac82fd5dbf6b0f706747afa6418626b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoBetter handling of contexts and environments
Lars Knoll [Sun, 18 Nov 2012 22:33:06 +0000 (23:33 +0100)]
Better handling of contexts and environments

Make the ExecutionContext standard compliant.
Move most of it's members into a new
DeclarativeEnvironment data structure that
contains locals and arguments.

Change-Id: I094f559168810dbd3717d677fe28750076015976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoProperly namespace the math header
Lars Knoll [Sat, 17 Nov 2012 21:14:06 +0000 (22:14 +0100)]
Properly namespace the math header

Change-Id: I0f4ac76376028081b13b1cdeaadc4c9b09c1556d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove Value into it's own header/cpp file
Lars Knoll [Sat, 17 Nov 2012 21:10:52 +0000 (22:10 +0100)]
Move Value into it's own header/cpp file

Change-Id: I2872d824a2016a653e64f0332f6416f416eef0e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the engine and context classes into their own files
Lars Knoll [Sat, 17 Nov 2012 20:54:26 +0000 (21:54 +0100)]
Move the engine and context classes into their own files

Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRename Context to ExecutionContext
Lars Knoll [Fri, 16 Nov 2012 22:07:10 +0000 (23:07 +0100)]
Rename Context to ExecutionContext

This is so it'll map to the name used in the
ECMAScript spec once the other refactorings
are in.

Change-Id: I8dcc7ad43b457ce50e7123c57bc4c770bcda8d11
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCreate a proper function object for eval
Lars Knoll [Fri, 16 Nov 2012 21:21:34 +0000 (22:21 +0100)]
Create a proper function object for eval

Still doesn't work correctly, as we can't modify
the global context there.

Change-Id: Ifd0ab217c3cf2d0c1b86f09907b440ea31c29ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix __qmljs_string_to_number.
Erik Verbruggen [Thu, 15 Nov 2012 15:56:52 +0000 (16:56 +0100)]
Fix __qmljs_string_to_number.

Stop using QString::toDouble, because it doesn't handle Infinity,
-Infinity, 10e10000, etc.

Change-Id: Ic51bc1d7fe4d2d233b551b87d48833f3ba76a6dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix possible null-pointer deref.
Erik Verbruggen [Thu, 15 Nov 2012 15:31:03 +0000 (16:31 +0100)]
Fix possible null-pointer deref.

Change-Id: I8c4e2c34b2a3803d1346a1f716a0e40bde6bfdff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDo not save/restore interpreter stack for exceptions.
Erik Verbruggen [Thu, 15 Nov 2012 15:29:47 +0000 (16:29 +0100)]
Do not save/restore interpreter stack for exceptions.

Only the instruction pointer and targetTempIndex are needed.

Change-Id: I21279d68e74dac42d875e3ced9004e9d3c42c29d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix for calling Error constructor as a function (15.11.1).
Erik Verbruggen [Wed, 14 Nov 2012 14:16:17 +0000 (15:16 +0100)]
Fix for calling Error constructor as a function (15.11.1).

Change-Id: I989c2a546b7e4d9a4fd2f7ff8b682c747d38332f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoTune break/continue exception trampoline block generation.
Erik Verbruggen [Thu, 15 Nov 2012 12:33:36 +0000 (13:33 +0100)]
Tune break/continue exception trampoline block generation.

If the break/continue trampoline blocks get reached, there cannot be a
pending exception, so don't bother with saving it.

Change-Id: Id079d48d961f21dd236dbc33fad1712edbd2df97
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdded all missing error objects.
Erik Verbruggen [Wed, 14 Nov 2012 15:44:08 +0000 (16:44 +0100)]
Added all missing error objects.

Change-Id: I806184c5593af44d79b21afb1e3235ec9afa1e2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoCleanup Context initialization
Lars Knoll [Thu, 15 Nov 2012 12:31:57 +0000 (13:31 +0100)]
Cleanup Context initialization

Make the initialization for call() compliant
with the standard, and add a strict mode boolean.

Change-Id: I8617af8dbfde47d8b2a8a0a7ce0ab491031ba4ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller cleanups in the Context class
Lars Knoll [Thu, 15 Nov 2012 11:58:49 +0000 (12:58 +0100)]
Smaller cleanups in the Context class

Change-Id: I02bc1cad6231988fdf453d0b4fdde55dd1ae9148
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoStore the activation object as a pointer, not as a Value.
Lars Knoll [Thu, 15 Nov 2012 11:23:39 +0000 (12:23 +0100)]
Store the activation object as a pointer, not as a Value.

The activation object inside the context is always an object,
or null. This avoids some needless conversions to and from
Value's.

Change-Id: Ibbd88c83fa073a4ed3cf03742129357dd9567cec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused variable and method
Lars Knoll [Thu, 15 Nov 2012 11:11:38 +0000 (12:11 +0100)]
Remove unused variable and method

Change-Id: I357f3062f58e76c1749c9818426be5c0eedf3327
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRethrow the right exception after finally if catch is missing.
Erik Verbruggen [Thu, 15 Nov 2012 12:12:55 +0000 (13:12 +0100)]
Rethrow the right exception after finally if catch is missing.

Save the (unhandled) exception, because there might be another try block
with a catch in the finally block. Restore it at the end of the finally
block.

The codegen for the finally, which is also needed for the break/continue
trampoline blocks, has moved into a helper method.

Change-Id: Iff28506b92a3749c6a5585fb6d94f3120696e89a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd missing message property to the ErrorObject.
Erik Verbruggen [Wed, 14 Nov 2012 13:12:16 +0000 (14:12 +0100)]
Add missing message property to the ErrorObject.

Change-Id: Ice16360f98d1d66162440d972c6bfbc416884474
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoChanged the interpreter and compiler backends to move consts.
Erik Verbruggen [Wed, 14 Nov 2012 11:51:54 +0000 (12:51 +0100)]
Changed the interpreter and compiler backends to move consts.

See https://codereview.qt-project.org/39510 for details.

Change-Id: I308364cd7d66ad2fd12e6ab7e185882fe8d1795e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix optimisation for passing a single argument to a call.
Erik Verbruggen [Wed, 14 Nov 2012 11:18:50 +0000 (12:18 +0100)]
Fix optimisation for passing a single argument to a call.

Change-Id: I57a881ccd9f86a36d2d2ea5451046652ac0aca21
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoOptimise move instructions involving constants
Lars Knoll [Wed, 14 Nov 2012 08:07:01 +0000 (09:07 +0100)]
Optimise move instructions involving constants

Change-Id: Ic12a54ab1c5789cc5684d38961c58f6b34f9597a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoAdded more built-ins to the llvm backend and runtime.
Erik Verbruggen [Wed, 14 Nov 2012 09:10:04 +0000 (10:10 +0100)]
Added more built-ins to the llvm backend and runtime.

Change-Id: I7c63395bc80ce8d37d04f1102b02220a54050d06
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix codegen for try-statements in loops.
Erik Verbruggen [Wed, 14 Nov 2012 10:39:38 +0000 (11:39 +0100)]
Fix codegen for try-statements in loops.

The tricky part is that a break/continue in a try or catch block must
still execute the finally block.

Change-Id: I5215c1b5688d87f3c9d1dd168eed7f3555bae22a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix interpreter exception handling.
Erik Verbruggen [Wed, 14 Nov 2012 09:15:19 +0000 (10:15 +0100)]
Fix interpreter exception handling.

The stack frame of the interpreting function is restored, but all the
datastructures live on the heap. So, save them out on handler creation,
and restore them afterwards.

Change-Id: I84b84007cc9944b56926bf0387c2798f7841cd2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUntangle the Jump/CJump interpreter instructions.
Erik Verbruggen [Wed, 14 Nov 2012 09:12:42 +0000 (10:12 +0100)]
Untangle the Jump/CJump interpreter instructions.

Shrinks the instruction size of a Jump a bit.

Change-Id: I1a6b043d13e8493d8b0d23011141d46c10414fa8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove the tempRegister from moth by loading/storing values directly.
Erik Verbruggen [Tue, 13 Nov 2012 11:25:23 +0000 (12:25 +0100)]
Remove the tempRegister from moth by loading/storing values directly.

Change-Id: I51982d5852db2e10234620d63c235484c5b8a573
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGive an error message when a JS file does not exist.
Erik Verbruggen [Tue, 13 Nov 2012 12:44:16 +0000 (13:44 +0100)]
Give an error message when a JS file does not exist.

Instead of silently failing, which is a bit ambiguous in case of test262.

Change-Id: I8b8dc066df63f93273ccc6c27547edfcd1a68cb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdded different output types to LLVM backend to ease debugging.
Erik Verbruggen [Tue, 13 Nov 2012 08:54:24 +0000 (09:54 +0100)]
Added different output types to LLVM backend to ease debugging.

While in that area of code, also throw in the pass-managers for
some extra optimisations during compilation.

Change-Id: I1239ab9d21fc50b2e65c2f9d77a03ae593b607bc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd a script to test the interpreter on *.js files.
Nikolai Kosjar [Fri, 9 Nov 2012 14:16:58 +0000 (15:16 +0100)]
Add a script to test the interpreter on *.js files.

By default this will run ./v4 on all *.js files in test262 and generate
test reports based on the exit code and the output of the interpreter.

Change-Id: I5a90b9f4c5bf376c5c8df12b5e777d0626d9d82e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix property deletion.
Erik Verbruggen [Mon, 12 Nov 2012 15:19:04 +0000 (16:19 +0100)]
Fix property deletion.

Also tweak the bucket size calculation to be prime for just a bit
longer than.

Change-Id: I9fc6779956693301eb01a6558d4c20d8e39d8bad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdded more builtins to moth.
Erik Verbruggen [Mon, 12 Nov 2012 13:31:05 +0000 (14:31 +0100)]
Added more builtins to moth.

- delete member
- delete subscript
- delete name
- delete value
- foreach-iterator-object
- foreach-next-property-name

Change-Id: I639a3c3a293ea88019e2f69e1f51ce2264a68bcc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoChanged the LLVM backend to also support the LLVM JIT.
Erik Verbruggen [Mon, 12 Nov 2012 11:22:22 +0000 (12:22 +0100)]
Changed the LLVM backend to also support the LLVM JIT.

This is useful for quick LLVM codegen testing.

Change-Id: I45778371375b903e154222c47b15411d08085ae5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAllow Const's as operands to Binop in moth.
Erik Verbruggen [Mon, 12 Nov 2012 08:39:06 +0000 (09:39 +0100)]
Allow Const's as operands to Binop in moth.

Change-Id: Ic0954c8170bc720a02fa88f3ab50112bff4767a7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSmaller 64 bit optimisation
Lars Knoll [Sun, 11 Nov 2012 21:29:25 +0000 (22:29 +0100)]
Smaller 64 bit optimisation

Change-Id: I78311310c6f986bf187e3923d1fb71e09f4569fb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoAllow Const's as operands to Binop
Lars Knoll [Thu, 25 Oct 2012 14:31:12 +0000 (16:31 +0200)]
Allow Const's as operands to Binop

This allows us to use expressions such as
%x = %y + const
in the IR.

This still requires an implementation for moth.

Change-Id: I134e96ddad08bcbe4f3ea5fa27c5338a96acac80
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoBetter argument ordering.
Lars Knoll [Sun, 11 Nov 2012 21:08:39 +0000 (22:08 +0100)]
Better argument ordering.

Change-Id: I1d47ce7bd2cf27bc43a0e9afbfb2914296c9d704
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoClean up inplace binary operations for subscripts.
Lars Knoll [Sun, 11 Nov 2012 20:56:38 +0000 (21:56 +0100)]
Clean up inplace binary operations for subscripts.

Remove a lot of duplicated code, and make it a lot
easier to implement JS compliant semantics.

Change-Id: Ic5ecb58d34a5df8fe05e86c5f906d70c50c51b54
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoThese methods are actually used now.
Lars Knoll [Sun, 11 Nov 2012 20:23:59 +0000 (21:23 +0100)]
These methods are actually used now.

Change-Id: Ic0d43902fec5d3b752678eadfbccb9f71e21d895
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoCorrect implementation of inplace binops
Lars Knoll [Sat, 10 Nov 2012 23:08:44 +0000 (00:08 +0100)]
Correct implementation of inplace binops

Fix the last parts of the inplace bitops to
do the correct thing.

Change-Id: I748dde919082193c034cdc20e92cc568d8efa225
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoImprove handling of binops on LHS expressions
Lars Knoll [Sat, 10 Nov 2012 22:35:06 +0000 (23:35 +0100)]
Improve handling of binops on LHS expressions

Add a generic method to handle binops such as +=
to Object and use it. We can probably remove
most of the __qmljs_inplace_xxx methods later
on and call one generic method instead.

Change-Id: If7cbd2e3012ad381e29b9eec2059e17f02a0a38a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoCleanup call and construct semantics
Lars Knoll [Sat, 10 Nov 2012 11:45:00 +0000 (12:45 +0100)]
Cleanup call and construct semantics

Implement proper call() and construct()
methods in FunctionObject, and remove
some duplicated initialization code.

Change-Id: I5c86f9f2cf6e4b65d23d000149db2b79c35538c4
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoImplement member operations for non integers indices
Lars Knoll [Fri, 9 Nov 2012 22:33:07 +0000 (23:33 +0100)]
Implement member operations for non integers indices

Implement the more general foo[expr] op= bar

Change-Id: Idb2143cfe4b48fc9ce177d699970818e877dc735
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoChange ConvertibleToInt to not interfere with valid addresses.
Erik Verbruggen [Wed, 7 Nov 2012 14:34:34 +0000 (15:34 +0100)]
Change ConvertibleToInt to not interfere with valid addresses.

Change-Id: I1415907f94d064e64bf5495b7c136355ffd866fe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFixed compilation of LLVM glue-code.
Erik Verbruggen [Thu, 8 Nov 2012 13:54:37 +0000 (14:54 +0100)]
Fixed compilation of LLVM glue-code.

Change-Id: I3adc68012f7492281fe8849f58764473dcb3671e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChanged commandline and return codes for test harness.
Erik Verbruggen [Thu, 8 Nov 2012 11:45:40 +0000 (12:45 +0100)]
Changed commandline and return codes for test harness.

The different backends can now be selected by command-line options,
and when none is specified, masm is used. The difference is that the
environment variable USE_MOTH is not used anymore.

The return codes are 0 or -1, so the test harness can easily check for
errors.

The ECMA test262 harness uses the $ERROR function to report errors. When
the environment variable IN_TEST_HARNESS is set, this function will get
added to the global object.

Change-Id: I291c72332ea50892afb99f9a0a15004ffc81c200
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixed/added name handling in expressions for moth.
Erik Verbruggen [Wed, 7 Nov 2012 15:31:10 +0000 (16:31 +0100)]
Fixed/added name handling in expressions for moth.

Change-Id: I6dc2faed00a465b74735d23e4c0bda9498dc7bd9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix free memory reads
Lars Knoll [Fri, 2 Nov 2012 21:07:58 +0000 (22:07 +0100)]
Fix free memory reads

This doesn't quite fix all issues, as activation records
and arguments objects will still not work correctly in
all cases (esp. the inplace operators).

Change-Id: I0ebf2a08e6c61e4049d4b6f449987757bfc3f81c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix use of uninitialised values.
Erik Verbruggen [Wed, 7 Nov 2012 10:19:09 +0000 (11:19 +0100)]
Fix use of uninitialised values.

Also fix a typo in a variable name.

Change-Id: I5e21544b69bed777c6733e2f517d52aca93a900b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix build with shadow builds
Thiago Macieira [Wed, 7 Nov 2012 09:11:21 +0000 (10:11 +0100)]
Fix build with shadow builds

Otherwise, we get:
gmake: *** No rule to make target `/home/thiago/src/qt/qt5/v4vm/udis86_itab.c', needed by `udis86_itab_holder.o'.  Stop.

Change-Id: I1d84ec00b6422fb8601e271d427ef619d462fd28
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix codegen for void expressions.
Erik Verbruggen [Wed, 7 Nov 2012 08:54:30 +0000 (09:54 +0100)]
Fix codegen for void expressions.

Change-Id: If89306aa91995e84106437a802e1d6d1940f17e7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdded more instruction selection to moth to get crypto.js through.
Erik Verbruggen [Tue, 6 Nov 2012 11:54:20 +0000 (12:54 +0100)]
Added more instruction selection to moth to get crypto.js through.

Change-Id: Ic9582ea3241d97ef619304ece9f18c7eaae90407
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix temp/local addressing in MOTH.
Erik Verbruggen [Tue, 6 Nov 2012 11:31:53 +0000 (12:31 +0100)]
Fix temp/local addressing in MOTH.

Change-Id: Iae9d7a7679b2e315c671de6890ccdaafa28f8a03
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd tracing for runtime methods.
Erik Verbruggen [Tue, 6 Nov 2012 11:31:02 +0000 (12:31 +0100)]
Add tracing for runtime methods.

Change-Id: I540297e83e3e297d0724c3e08e5780eee0d2fac8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation of LLVM backend.
Erik Verbruggen [Tue, 6 Nov 2012 11:24:32 +0000 (12:24 +0100)]
Fix compilation of LLVM backend.

Change-Id: I654f30c9811a74634cef9d27e07d016f73daa141
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdded calls to built-ins to moth.
Erik Verbruggen [Thu, 25 Oct 2012 08:08:22 +0000 (10:08 +0200)]
Added calls to built-ins to moth.

Change-Id: I277b1136ed3b073a9fc85726dc714ef68109fbfa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>