platform/upstream/qtdeclarative.git
12 years agoInitial implementation of the Error prototype and constructor
Lars Knoll [Thu, 1 Nov 2012 14:37:47 +0000 (15:37 +0100)]
Initial implementation of the Error prototype and constructor

Change-Id: Iffd1a01b75bc923c0cd8c0b786558be20a52ab2c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoImplement Function(...) and new Function(...)
Lars Knoll [Thu, 1 Nov 2012 13:49:09 +0000 (14:49 +0100)]
Implement Function(...) and new Function(...)

Change-Id: I3ff229740820883a99dee6e32370fc528bf9169c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdd undefined, NaN and Infinity to the global object
Lars Knoll [Tue, 30 Oct 2012 06:45:58 +0000 (07:45 +0100)]
Add undefined, NaN and Infinity to the global object

Change-Id: Ic5047c231ab54ccc04043bf95418c0f6511b10bf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdd missing break statement
Lars Knoll [Tue, 30 Oct 2012 06:39:45 +0000 (07:39 +0100)]
Add missing break statement

Change-Id: I61e91701bbaa173c8189af9f703ac2b509b99cd0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoImplement initial support for the delete operator
Lars Knoll [Tue, 30 Oct 2012 06:29:14 +0000 (07:29 +0100)]
Implement initial support for the delete operator

And don't dump the assemply unless SHOW_CODE is set.

Change-Id: I17ad36f002404b57c65f910048e5c82d42307976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoSet property attributes more correctly
Lars Knoll [Mon, 29 Oct 2012 14:50:07 +0000 (15:50 +0100)]
Set property attributes more correctly

Also now check for enumerable in for/in statements.

Change-Id: I03a9968fc3d7f8f5e4eaf26591040acd9cc8ced1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConformant implementation of the object internal methods
Lars Knoll [Mon, 29 Oct 2012 14:37:02 +0000 (15:37 +0100)]
Conformant implementation of the object internal methods

See section 8.12 of the standard. This implements
8.12.1 - 8.12.7 and 8.12.9

Also gave these methods standard conformant names.
They are marked as [[foo]] in the standard, which
translates to __foo__ in our code.

Change-Id: I1990d6c6dd24e929c23d5c51d36f1e2e0a0a3b63
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdd a Value::sameValue() method
Lars Knoll [Mon, 29 Oct 2012 11:26:40 +0000 (12:26 +0100)]
Add a Value::sameValue() method

This implements Section 9.11 of the spec.
Also simplify __qmljs_strict_equal().

Change-Id: I99b33308c33f4d4732b4a72bd5327336b2b22257
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoRework properties
Lars Knoll [Sun, 28 Oct 2012 20:56:15 +0000 (21:56 +0100)]
Rework properties

This brings the basic structure or accessing properties
more in line with the EcmaScript 5.1 specification.

There's however still quite some work to be done to
make things fully compliant.

Change-Id: If55afd7ae6e4f7aa5ce06afe49b1453b537ac98b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoImplement the other variant of the 'for in' statement
Lars Knoll [Sun, 28 Oct 2012 19:33:54 +0000 (20:33 +0100)]
Implement the other variant of the 'for in' statement

Change-Id: I90823a97331fd15a8289bab93d7e9c1f34aaa10d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdded basic support for 'for (var x in y)' statement
Lars Knoll [Sun, 28 Oct 2012 15:24:06 +0000 (16:24 +0100)]
Added basic support for 'for (var x in y)' statement

Change-Id: I8f3c8add78bebf92e0073348d1ecbdf3f328af6d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConstant folding for unary operations
Lars Knoll [Thu, 25 Oct 2012 12:14:10 +0000 (14:14 +0200)]
Constant folding for unary operations

Do constant folding for unary operators.

Change-Id: I88f8b73c947d719ef089a9e53f7949fc6d66134b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMore correct type tagging for constant created from binops
Lars Knoll [Thu, 25 Oct 2012 12:27:14 +0000 (14:27 +0200)]
More correct type tagging for constant created from binops

In many cases the result of the binop is actually a boolean,
not a number. Correctly type the constant as boolean in this
case.

Change-Id: I3c9b1f5b9fbd15bf97e4bafc9ceee6947343fd32
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMoved definition of Value before the extern block to suppress warnings.
Erik Verbruggen [Thu, 25 Oct 2012 07:24:11 +0000 (09:24 +0200)]
Moved definition of Value before the extern block to suppress warnings.

Change-Id: Ic400255d0a7f6830dcb0604688d88d5020628b15
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoRemove all is*Object methods.
Erik Verbruggen [Thu, 25 Oct 2012 07:15:11 +0000 (09:15 +0200)]
Remove all is*Object methods.

They differ from the isObject/isUndefined/etc. methods because they do
an extra virtual function call. And with isObject and friends being
cheap, is*Object methods could have made the same (but faulty)
impression.

Change-Id: I32f26a96e73251bd14f8198b0a1ffb5d59e53f31
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoReadability change: builtin_invalid implies baseName->id being set.
Erik Verbruggen [Wed, 24 Oct 2012 15:05:44 +0000 (17:05 +0200)]
Readability change: builtin_invalid implies baseName->id being set.

And vice-versa, so drop the wrapping if statement.

Change-Id: I57b7aef23feeee6b3f94edd5ca85bfc460bb2307
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoImplemented calls in the interpreter.
Erik Verbruggen [Wed, 24 Oct 2012 15:04:29 +0000 (17:04 +0200)]
Implemented calls in the interpreter.

Change-Id: Iafc9b04a1aa39272ab8aac24fb410a23df02a756
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoRemoved duplicate code for the various function call methods.
Erik Verbruggen [Wed, 24 Oct 2012 14:35:15 +0000 (16:35 +0200)]
Removed duplicate code for the various function call methods.

The main change is renaming __qmljs_call_function to callFunction, and
move duplicate error checking in there. Now __qmljs_call_value does not
do its own call anymore, but calls __qmljs_call_function. All calls to
__qmljs_call_function are replaced by calls to __qmljs_call_value.

Change-Id: I7fffc2e811c43e84e7344d70e2ed521331ed710d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoAdded loading of "this" and renamed "ActivateProperty" to "StoreName".
Erik Verbruggen [Wed, 24 Oct 2012 11:45:43 +0000 (13:45 +0200)]
Added loading of "this" and renamed "ActivateProperty" to "StoreName".

Change-Id: I033abe53368a815a9e3d036021429732f5526ea2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix LLVM backend compilation.
Erik Verbruggen [Wed, 24 Oct 2012 08:09:30 +0000 (10:09 +0200)]
Fix LLVM backend compilation.

Change-Id: I326cf2531a600fd09b888e9955052b29624ccdbe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix stack alignment to align on 16 byte boundaries.
Erik Verbruggen [Tue, 23 Oct 2012 12:37:26 +0000 (14:37 +0200)]
Fix stack alignment to align on 16 byte boundaries.

Aligning on 16 byte boundaries is a requirement for MacOS, and it gives
the optimal performance when using MMX on stack allocated data.

Change-Id: I1c9a27e796f1c240002a05196490f15df68c3f73
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoProper exception handling
Lars Knoll [Sun, 21 Oct 2012 22:18:31 +0000 (00:18 +0200)]
Proper exception handling

Implement exceptions using setjmp/longjmp. The
advantage is that this removes all exception
handling overhead from regular code, the only
code that still has a (very small) overhead
is the try{} catch() {} statement.

Change-Id: I43d6a60dfc9dfd4b7a20d2e99ab0a9315b4d8a2f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdded property activation to the interpreter.
Erik Verbruggen [Tue, 23 Oct 2012 14:06:52 +0000 (16:06 +0200)]
Added property activation to the interpreter.

Change-Id: Icbc900f8d617c8736a5663d19f5691f336bedb30
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years ago[masm] Cleanup: Eliminate ScratchRegister2 on AMD64
Simon Hausmann [Mon, 22 Oct 2012 13:03:43 +0000 (15:03 +0200)]
[masm] Cleanup: Eliminate ScratchRegister2 on AMD64

Functions like loadArgument and storeValue that work right above
the macro assembler may use ScratchRegister because they only call
functions that do not "allocate" that register themselves.

copyValue on the other hand is a higher-level function and may not use
ScratchRegister because the functions it calls (i.e. loadArgument)
may clobber it. In the 64-bit case of quickly copying one VM value
to another location, we might as well use the ReturnValueRegister
as intermediate register and therefore re-allow the use of ScratchRegister
in the lower-level loadArgument/storeArgument functions.

Change-Id: I9f0c0d326e5af87101972f0cceb86cffe4ebdd0d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years ago[masm] Cleanup: Use load64/store64 masm interface
Simon Hausmann [Mon, 22 Oct 2012 09:37:03 +0000 (11:37 +0200)]
[masm] Cleanup: Use load64/store64 masm interface

The API allows us to distinguish between loading/storing a 64-bit value
or a pointer and we should make use of that to make the code more readable
and to be able to run on x32 in the future.

Change-Id: Id2e1d8af566486540a1f6d086fb8db91f0fed6f8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix ScratchRegister usage on x86_64
Lars Knoll [Sun, 21 Oct 2012 16:22:26 +0000 (18:22 +0200)]
Fix ScratchRegister usage on x86_64

r11 is already being used quite a bit internally in
the macro assembler, leading to collisions and crashes.
Rather use r10 for most scratch operations.

Change-Id: I27bbbf825ca0e90af4ec85b8da12c25ae8ca00df
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMore LLVM code generation. This should complete the expressions.
Erik Verbruggen [Mon, 22 Oct 2012 08:33:04 +0000 (10:33 +0200)]
More LLVM code generation. This should complete the expressions.

Change-Id: Ic920ceb85cab38093b565acd1c14aeddf20d0bb3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix: implement missing virtual method.
Erik Verbruggen [Mon, 22 Oct 2012 08:40:20 +0000 (10:40 +0200)]
Fix: implement missing virtual method.

Change-Id: Iec6a70155ff2343dafa2116fa54740e891539c61
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoCleanup: Eliminate Gpr0-3 register aliases
Simon Hausmann [Sat, 20 Oct 2012 12:17:03 +0000 (14:17 +0200)]
Cleanup: Eliminate Gpr0-3 register aliases

Instead introduce a ScratchRegister which is explicitly different from
the ReturnValueRegister and is therefore safe to use.

Change-Id: I4675b6a4d242f3e02a4e848c7b65660ffa97cfe6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoCleanup: Reduce use of Gpr0
Simon Hausmann [Sat, 20 Oct 2012 11:48:43 +0000 (13:48 +0200)]
Cleanup: Reduce use of Gpr0

We don't need to explicitly operate on Gpr0 for the return value when we can
use the ReturnValueRegister alias instead. No change in code generation because
on Amd64 and Ia32 Gpr0 == ReturnValueRegister.

Change-Id: Ia21613a51878093a9fb425879645ea3b8a4dbf72
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix build on ia32
Simon Hausmann [Sat, 20 Oct 2012 12:13:42 +0000 (14:13 +0200)]
Fix build on ia32

Fix undefinedValue() and nullValue() initializers.

Change-Id: I7117331137c7d76b39099b57a5dc17b15136fd26
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix build on Ubuntu 12.10
Simon Hausmann [Sat, 20 Oct 2012 12:13:23 +0000 (14:13 +0200)]
Fix build on Ubuntu 12.10

Include unistd.h for sysconf as per man-page.

Change-Id: Iafd7687e6f12beda5ace1442c4d436c051d1beb0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoImplement regexp support
Lars Knoll [Fri, 19 Oct 2012 21:10:42 +0000 (23:10 +0200)]
Implement regexp support

Change-Id: I86c9bbe69c9ba4ae9d300b62e7d16b372f3478ea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdded LLVM code generation for in-place operators.
Erik Verbruggen [Fri, 19 Oct 2012 13:03:28 +0000 (15:03 +0200)]
Added LLVM code generation for in-place operators.

E.g. +=, <<=, etc.

Change-Id: Iffd5eac413e3c3714fedbab58415d9dc4ba42fa6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix the dataLog methods
Lars Knoll [Fri, 19 Oct 2012 08:23:09 +0000 (10:23 +0200)]
Fix the dataLog methods

qDebug doesn't have an overload taking a va_list.

Change-Id: Ic8d58d0a37c0bac11f1146eed9fdc105ddf1dfc8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMake Value a real POD
Lars Knoll [Thu, 18 Oct 2012 22:02:21 +0000 (00:02 +0200)]
Make Value a real POD

Remove the inheritance from ValueData and ValueBase.
Use a few ifdef's for 64 bit instead of a lot of
template magic and inheritance to get the correct
implementations for 32 and 64 bit.

Saves some code, and makes Value a real POD type.

Apparently this also helps gcc generate better code,
crypto.js runs another few percent faster now.

Change-Id: I9dac488b27e629e6ef8c096f2bee86a5d678fd49
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoUse some tricks to speed up binary operators
Lars Knoll [Thu, 18 Oct 2012 21:48:31 +0000 (23:48 +0200)]
Use some tricks to speed up binary operators

Add some flags to the Value's tag that allow us to
simplify type conversion from null and bool to integer.
Add a method to allow checking in one go whether two
values are "integer compatible"

Change-Id: I0a05bdf881836ad3f8286c0365dd192bf7f6e5d6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoRemove the is(Type) methods in Value
Lars Knoll [Thu, 18 Oct 2012 19:48:57 +0000 (21:48 +0200)]
Remove the is(Type) methods in Value

Simplify and optimise the Value::isXxx() methods
at the same time.

Change-Id: I3e8fa98cf7b91079a4450c048c6d0795d1684724
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMicro optimisations
Lars Knoll [Thu, 18 Oct 2012 12:52:22 +0000 (14:52 +0200)]
Micro optimisations

Change-Id: Ifae82d259f55e8e3791ef05eb7ea5f607fbfd747
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoOptimise function calls a little.
Lars Knoll [Thu, 18 Oct 2012 12:39:59 +0000 (14:39 +0200)]
Optimise function calls a little.

Change-Id: I906a4f27bf47ae0ae088ae40a747b28ba827e10a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoRemove unused, commented out methods
Lars Knoll [Thu, 18 Oct 2012 10:15:48 +0000 (12:15 +0200)]
Remove unused, commented out methods

They don't make sense with the calling convention we now have.

Change-Id: I92f773c96588dd276227ba9bbe7414dbd7752db7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix integer arithmetics
Lars Knoll [Thu, 18 Oct 2012 10:04:51 +0000 (12:04 +0200)]
Fix integer arithmetics

The inline assembly could create incorrect results for
overflows, esp when multiplying.
Also fix the return type of Value::integerValue()

Change-Id: I4c8f195b37bcbb8fd4f0f3d0cd04a8cf73f193cd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoRemove unused method
Lars Knoll [Thu, 18 Oct 2012 10:04:22 +0000 (12:04 +0200)]
Remove unused method

Change-Id: I780afc37dd651922ca66770a69e9ae2050d198c4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMoved LLVM specific code out of main.cpp.
Erik Verbruggen [Thu, 18 Oct 2012 09:07:10 +0000 (11:07 +0200)]
Moved LLVM specific code out of main.cpp.

Change-Id: I16c79667625d5034acb91cec13c22ed58b74984f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoClean up #ifdefs in storeValue
Simon Hausmann [Thu, 18 Oct 2012 08:35:27 +0000 (10:35 +0200)]
Clean up #ifdefs in storeValue

Use VALUE_FITS_IN_REGISTER instead of hard-coding CPU architectures

Change-Id: I6d5caa6b2cd8e379517d83fdebef46217f79a8d5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoSilence signed/unsigned comparison warning.
Erik Verbruggen [Thu, 18 Oct 2012 08:57:00 +0000 (10:57 +0200)]
Silence signed/unsigned comparison warning.

Change-Id: Id23e48b370a73baabcc6875b51067f60dadec0c4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix LLVM code generation to call the right methods.
Erik Verbruggen [Thu, 18 Oct 2012 08:46:31 +0000 (10:46 +0200)]
Fix LLVM code generation to call the right methods.

Change-Id: Ia63342d2808ca2e3cdd5b19e94054786cc34c495
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix insecure use of format string.
Erik Verbruggen [Thu, 18 Oct 2012 08:44:09 +0000 (10:44 +0200)]
Fix insecure use of format string.

Change-Id: I6cd282d5780e418bea7a07d4639c035a98b3ed65
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix unused parameter/variable warnings.
Erik Verbruggen [Thu, 18 Oct 2012 08:43:49 +0000 (10:43 +0200)]
Fix unused parameter/variable warnings.

Change-Id: I1e1fad753b99a52a1e65dcf38f64c394fa506735
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoClean up the relational operators
Lars Knoll [Thu, 18 Oct 2012 07:52:38 +0000 (09:52 +0200)]
Clean up the relational operators

Change-Id: I83cf1dd9204b95b0238ed2476cf2a3800b25a017
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoCleanup
Lars Knoll [Thu, 18 Oct 2012 06:52:40 +0000 (08:52 +0200)]
Cleanup

Remove __qmljs_init_object and replace it with
Value::fromObject

Change-Id: Ibc8bd9e7ecd56c6713dc08add72e5cd35ffea78e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoInline string creation in the generated JIT code
Lars Knoll [Thu, 18 Oct 2012 06:49:22 +0000 (08:49 +0200)]
Inline string creation in the generated JIT code

Change-Id: Ifaef87046c083b36222f6204291ee3a61ffcd20b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoChange usage of qIsNaN to std::isnan.
Erik Verbruggen [Wed, 17 Oct 2012 12:34:44 +0000 (14:34 +0200)]
Change usage of qIsNaN to std::isnan.

By using std::isnan the compiler/std-lib has a chance to optimize the
call away or maybe even generate an intrinsic. Furthermore, when the
runtime is compiled to bitcode for inclusion in generated code, we now
do not need to link against QtCore to get just one single function.

Change-Id: I79995afc1ba215f1ffd9a43df1808b833dfa8481
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix the shift operators
Lars Knoll [Wed, 17 Oct 2012 21:07:41 +0000 (23:07 +0200)]
Fix the shift operators

The JS spec demands that the right hand argument is being
masked with 0x1f before applying the nit shift.

See e.g. http://bclary.com/2004/11/07/#a-11.7

Change-Id: I6a7dee4708b2fe93df984f13752f7f00b5f2f367
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoCompile fixes on amd64
Lars Knoll [Wed, 17 Oct 2012 21:03:04 +0000 (23:03 +0200)]
Compile fixes on amd64

Change-Id: I767d2d8b8e6dec738fe6ed63a1ced781629b81ce
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix warning about unused opName parameter
Simon Hausmann [Wed, 17 Oct 2012 20:55:19 +0000 (22:55 +0200)]
Fix warning about unused opName parameter

Pass it up to generateFunctionCall :)

Change-Id: Ic05854e2a7b8bea09eb652e37df43587ffe62824
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoPort to ia32 (stack based value passing)
Simon Hausmann [Wed, 17 Oct 2012 20:43:07 +0000 (22:43 +0200)]
Port to ia32 (stack based value passing)

In the architecture section, introduce a VALUE_FITS_IN_REGISTER
macro as well as a RegisterSize constant.

When storing the return value into a IR::Temp, either copy straight
from the return value register if the architecture supports values
in registers, otherwise do a load/store copy.

Added push() overload that allows pushing constant values.

push() with an IR::Temp* now pushes the actual value onto the stack,
because our run-time functions expect values to be passed by... value :)

Extended the function call logic to reserve space on the stack for
the function return value if it doesn't fit into a register. In that
case at least the ia32 ABI specifies that there is a hidden first
argument which is the address of the space where the callee can place
the return value itself.

Change-Id: Ice9435dfc1482f4045a4ec4ad2c9ab58d4dfc7aa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix build on ia32
Simon Hausmann [Wed, 17 Oct 2012 20:38:55 +0000 (22:38 +0200)]
Fix build on ia32

Use the "q" constraint with the argument to seto to ensure we get
a lower-8-bit register

Change-Id: I483a8b37df9b726d78c050db97b58c5b62fde8e4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoClean up toUInt16 and fix a small typo in toUInt32
Lars Knoll [Wed, 17 Oct 2012 20:52:46 +0000 (22:52 +0200)]
Clean up toUInt16 and fix a small typo in toUInt32

Change-Id: I49e57cb8eed83237d8b2477297e429cd38d07c19
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoClean up to(U)Int and toInteger conversions
Lars Knoll [Wed, 17 Oct 2012 20:40:49 +0000 (22:40 +0200)]
Clean up to(U)Int and toInteger conversions

Change-Id: Ifdd4f22bd50ba2a4c0dd710ba346a36c84b2c305
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoAdd missing break statement
Lars Knoll [Wed, 17 Oct 2012 20:40:28 +0000 (22:40 +0200)]
Add missing break statement

Change-Id: I9f5d4cb6a7db0cd63c419cdf41c1a7497453559e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoSimplify function call generation (part 2)
Simon Hausmann [Wed, 17 Oct 2012 17:28:44 +0000 (19:28 +0200)]
Simplify function call generation (part 2)

Hide the mapping from function argument to register in a small
section of the architecture specific code at the top of the
instruction selector and use a generic ArgumentLoader helper class
to first try loading function parameters in registers and then fall
back to the stack.

This is only tested on amd64 right now where we don't end up using
the stack right now, so it will need testing/tweaking for ia32/arm.

Change-Id: If073cd92a674e90dc28f2c9bdf2841bb07c020f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoSimplify function call generate (part 1)
Simon Hausmann [Wed, 17 Oct 2012 16:28:45 +0000 (18:28 +0200)]
Simplify function call generate (part 1)

This gets rid of the ia32 and arm variants of generateFunctionCall
(they'll have to be re-done anyway) and replaces the duplicated
bodies of the generateFunctionCallImp overloads with calls to
one single instance that has the maximum number of supported arguments.

The recently introduce VoidType takes care of non-existant arguments.

Change-Id: I7c41f58a72840837709e65620d7f384e4b18f2a8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoSimplify some builtin methods
Lars Knoll [Wed, 17 Oct 2012 15:31:53 +0000 (17:31 +0200)]
Simplify some builtin methods

Change-Id: I2c524b3634c65e7cc0ee72a21937048c4e3ae10a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoNo need to clear a register twice.
Lars Knoll [Wed, 17 Oct 2012 14:42:47 +0000 (16:42 +0200)]
No need to clear a register twice.

Change-Id: I51235825566c6e7781af4c168b4902a90350b5cc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMake some methods inline
Lars Knoll [Wed, 17 Oct 2012 14:37:07 +0000 (16:37 +0200)]
Make some methods inline

Change-Id: Ic36761b9ee95c7b51b0eb2c23daa01084d316067
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoRename generateFunctionCall2 and loadArgument1.
Simon Hausmann [Wed, 17 Oct 2012 13:02:54 +0000 (15:02 +0200)]
Rename generateFunctionCall2 and loadArgument1.

The old functions that implement the old calling convention are unused now.

Change-Id: I8a6ba76c0ba2442f48a0dc331196ef399a902da0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoFix massive parallel builds
Simon Hausmann [Wed, 17 Oct 2012 12:34:46 +0000 (14:34 +0200)]
Fix massive parallel builds

Some of the udis86 files depend on a generate .c file, which if qmake
knows about will be generated _before_ building the file that includes
it.

Change-Id: I8cf2b63d2c111fc5a64002f40f3e30210095cb29
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoDirectly store constants as immediate Value's
Lars Knoll [Wed, 17 Oct 2012 12:55:52 +0000 (14:55 +0200)]
Directly store constants as immediate Value's

This removes a link from the JIT code to the IR,
and should improve performance as we need slightly
less copies.
On 64 bit, Values are stores in 2 instructions instead
of 4 now.

Change-Id: I4a90165fcdfc2d77ac3f6e7e9accdef8600fadd6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoImplement some stubbed out methods
Lars Knoll [Wed, 17 Oct 2012 12:19:05 +0000 (14:19 +0200)]
Implement some stubbed out methods

Change-Id: I7533c33850235fb914e35e4fbd92def654158db7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoPass Value, not 'const Value'
Lars Knoll [Wed, 17 Oct 2012 11:43:33 +0000 (13:43 +0200)]
Pass Value, not 'const Value'

Passing const values doesn't make a whole lot of sense,
esp. when the passed object is POD.

Change-Id: I7372407862828cf7fa8461583069743ecf583170
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFixed more calling conventions
Lars Knoll [Wed, 17 Oct 2012 11:38:59 +0000 (13:38 +0200)]
Fixed more calling conventions

Implemented a few stubs for qmljs_inplace_op_member

Change-Id: I542a535862339285db7ec0b547754453545a3dc0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix order of arguments
Lars Knoll [Wed, 17 Oct 2012 11:38:56 +0000 (13:38 +0200)]
Fix order of arguments

Change-Id: I8ecf66667f1dfebc33715ba396cb4bf7d27535d0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMore changes to the new calling convention
Lars Knoll [Wed, 17 Oct 2012 11:38:50 +0000 (13:38 +0200)]
More changes to the new calling convention

Change-Id: Icc22f2ed342ced9eac0d62307151acca8031d2c2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoUpdate wtf and masm from upstream (http://svn.webkit.org/repository/webkit/trunk...
Simon Hausmann [Wed, 17 Oct 2012 11:43:58 +0000 (13:43 +0200)]
Update wtf and masm from upstream (svn.webkit.org/repository/webkit/trunk@131582)

This brings in the distinction between loadPtr and load64 in the assembler.

Change-Id: Ifd8a8fe727f4fdb56b1d1d8bdd7065604904c472
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoProspective mac build fix
Simon Hausmann [Wed, 17 Oct 2012 11:34:27 +0000 (13:34 +0200)]
Prospective mac build fix

Don't try to link the generated header file

Change-Id: Iebe425ddd7cec5be731b3e8f4f5ca1a73990d0db
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
12 years agoChange usages of math.h into cmath. Fixes MacOS build.
Erik Verbruggen [Wed, 17 Oct 2012 11:24:46 +0000 (13:24 +0200)]
Change usages of math.h into cmath. Fixes MacOS build.

At least on MacOS, but possibly elsewhere too, including cmath before or
after math.h will undefine e.g. the isinf macro (and others). The math.h
include headers will make sure that math.h cannot get included twice,
so this will end with a situation where isinf is undefined, but
std::isinf is there.

Change-Id: Ie59aeadf2adde511ea8db5eb2fafd3272a7e9d51
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoGenerate correct code when calling values
Lars Knoll [Wed, 17 Oct 2012 07:05:56 +0000 (09:05 +0200)]
Generate correct code when calling values

__qmljs_call_value was still using a pointer to a Value.
In addition, qcv4isel_masm.cpp was using a wrong order
of the arguments.

Change-Id: I0414aa732ae8074420e4f11525f5b04712cc1bab
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoStore results as integers in a few more places
Lars Knoll [Tue, 16 Oct 2012 22:20:00 +0000 (00:20 +0200)]
Store results as integers in a few more places

Speeds up crypto.js by another 20%.

Change-Id: Ic16c824bf337392d64dc0bb3275f8b6a6c27f792
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFix typo
Lars Knoll [Tue, 16 Oct 2012 22:10:09 +0000 (00:10 +0200)]
Fix typo

Change-Id: I0620cf0521a22cd8ea497eac31fe29896cd1cb98
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoStore integer constants as integer Values
Lars Knoll [Tue, 16 Oct 2012 20:26:52 +0000 (22:26 +0200)]
Store integer constants as integer Values

Generate integer Value's during instruction
selection. Value is already prepared for it,
so this simply speeds up integer heavy JS
execution.

Speeds up crypto.js by around 60%

Change-Id: I3781767fd5b5c799365f3c75245409a9760ae7fb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConvert most operations to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 20:00:49 +0000 (22:00 +0200)]
Convert most operations to the new calling convention

Change-Id: I2dbf61b215a03a3c44c9c6bc431859bb9d067625
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoSmall cleanup
Lars Knoll [Tue, 16 Oct 2012 20:19:33 +0000 (22:19 +0200)]
Small cleanup

Change-Id: I81f9f49df0ecd94081d111e691494ec746ca58ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConvert some more methods to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 19:08:52 +0000 (21:08 +0200)]
Convert some more methods to the new calling convention

Change-Id: Ieeeb86d94d1094213430a1b4afa0d3a91785ac45
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoIntroduce a Bool typedef for boolean return values
Lars Knoll [Tue, 16 Oct 2012 18:43:43 +0000 (20:43 +0200)]
Introduce a Bool typedef for boolean return values

This helps in the interpretation of the type returned
by a method. It also makes it easier to later on change
the type back to a real bool if it makes sense. Bool
is currently typedef'ed to uint.

Change-Id: I905d828f4f7b0f7e778b7f197c4ed61117ce5d16
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConvert some more methods to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 18:38:11 +0000 (20:38 +0200)]
Convert some more methods to the new calling convention

Change-Id: I73a0e0e12b75828c83c5422d1c04a4ade4718324
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConverting more runtime methods to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 15:02:28 +0000 (17:02 +0200)]
Converting more runtime methods to the new calling convention

Change-Id: I331e7ebe6479bc5b6bac9cf4e3e6506a1cae1053
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMove conversions to new calling convention
Lars Knoll [Tue, 16 Oct 2012 14:21:00 +0000 (16:21 +0200)]
Move conversions to new calling convention

Change-Id: Iec01835b4fd27d8b71b7e709b05bcc757d09e417
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMore conversions to new calling convention
Lars Knoll [Tue, 16 Oct 2012 13:47:46 +0000 (15:47 +0200)]
More conversions to new calling convention

Change-Id: Iac67c9923bc3d7af76bb490cc8ca7cd3e922e192
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoMore conversions to new calling convention
Lars Knoll [Tue, 16 Oct 2012 13:37:31 +0000 (15:37 +0200)]
More conversions to new calling convention

Change-Id: I6002715cc3f5c22d90a9ade6ae2152c2c3c8ebb2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConverting more methods to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 13:10:47 +0000 (15:10 +0200)]
Converting more methods to the new calling convention

Change-Id: I5199a9e5439644cc259f131c8b0ba6a941989615
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConverting more runtime methods.
Lars Knoll [Tue, 16 Oct 2012 12:17:36 +0000 (14:17 +0200)]
Converting more runtime methods.

Change-Id: I9e5d73004e377cff2819cb82240d50e73c8bda94
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConvert Value constructors to new calling convention
Lars Knoll [Tue, 16 Oct 2012 11:40:02 +0000 (13:40 +0200)]
Convert Value constructors to new calling convention

Change-Id: I433f72666499e660618b061cfcf3407f5f9bb166
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoConvert string literals to new calling convention
Lars Knoll [Tue, 16 Oct 2012 11:13:44 +0000 (13:13 +0200)]
Convert string literals to new calling convention

Change-Id: I8dd6b1975351c36230ed512c55944c9b748ca38b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoFurther convert runtime methods to the new calling convention
Lars Knoll [Tue, 16 Oct 2012 10:56:50 +0000 (12:56 +0200)]
Further convert runtime methods to the new calling convention

Value bassed argument passing.

Change-Id: I95e49ae301221e36946c2ce4f25081461513a6bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoStart changing signatures of the runtime to being value based.
Lars Knoll [Tue, 16 Oct 2012 10:27:14 +0000 (12:27 +0200)]
Start changing signatures of the runtime to being value based.

Value's should be passed by value and returned by value between JIT
and the JS runtime. This should give us better performance on
x86_64 and ARM.

Change-Id: I4fa286c6164f0143adb72d07c737fa273c8a5eb6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoOptimize boolean test
Simon Hausmann [Tue, 16 Oct 2012 08:19:23 +0000 (10:19 +0200)]
Optimize boolean test

Use != 0 instead of == 1, as it allows for a more efficient encoding
on ia32/amd64 (using test eax, eax)

Change-Id: I7a29139d8e6e9b843bf8df6f20f5ef7cc9b2e8cc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
12 years agoGet rid of compiler warning.
Lars Knoll [Tue, 16 Oct 2012 11:11:59 +0000 (13:11 +0200)]
Get rid of compiler warning.

Change-Id: I3b92819ac1bf8e4f98c266d4136ed05235e06faf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoDo not return booleans from methods called by JIT generated code
Lars Knoll [Mon, 15 Oct 2012 20:32:06 +0000 (22:32 +0200)]
Do not return booleans from methods called by JIT generated code

For a boolean, only one byte of the the value returned in the
register is defined. But the compiled code afterwards does a
32 bit comparison with 0 or 1, leading to random failures
depending on compiler optimisation settings.

Instead we now consistently return uints, and all boolean
tests in the JIT generated code have to be done as
branch32((Not)Equal, register, TrustedImm32(0)). Never
compare against 1 to avoid potential problems.

Change-Id: I9d7545dd6705bca82dc49f1eedb329fffb86cdb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 years agoClean up callee save register push/pop code to have less #ifdefs
Simon Hausmann [Mon, 15 Oct 2012 18:34:21 +0000 (20:34 +0200)]
Clean up callee save register push/pop code to have less #ifdefs

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