Commit Graph

83 Commits

Author SHA1 Message Date
Lars Knoll de8f2e2044 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>
2012-10-19 07:36:30 +02:00
Erik Verbruggen afee906baf Fix insecure use of format string.
Change-Id: I6cd282d5780e418bea7a07d4639c035a98b3ed65
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-18 11:01:56 +02:00
Lars Knoll af12a21b1b Inline string creation in the generated JIT code
Change-Id: Ifaef87046c083b36222f6204291ee3a61ffcd20b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-18 10:32:50 +02:00
Simon Hausmann ccd7b9f216 Fix warning about unused opName parameter
Pass it up to generateFunctionCall :)

Change-Id: Ic05854e2a7b8bea09eb652e37df43587ffe62824
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-17 23:00:39 +02:00
Lars Knoll fcb4563191 Add missing break statement
Change-Id: I9f5d4cb6a7db0cd63c419cdf41c1a7497453559e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 22:47:47 +02:00
Simon Hausmann 97fa8c5de8 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>
2012-10-17 21:26:29 +02:00
Lars Knoll 2fe85372df Simplify some builtin methods
Change-Id: I2c524b3634c65e7cc0ee72a21937048c4e3ae10a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 17:41:14 +02:00
Simon Hausmann 49ca70f380 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>
2012-10-17 15:07:29 +02:00
Lars Knoll 12395b3201 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>
2012-10-17 15:02:18 +02:00
Lars Knoll 52a30a1e6f Fixed more calling conventions
Implemented a few stubs for qmljs_inplace_op_member

Change-Id: I542a535862339285db7ec0b547754453545a3dc0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 14:52:41 +02:00
Lars Knoll 649c318d39 Fix order of arguments
Change-Id: I8ecf66667f1dfebc33715ba396cb4bf7d27535d0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 14:51:46 +02:00
Lars Knoll 617240f92a More changes to the new calling convention
Change-Id: Icc22f2ed342ced9eac0d62307151acca8031d2c2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 14:40:40 +02:00
Lars Knoll f5b98f6386 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>
2012-10-17 09:35:39 +02:00
Lars Knoll d268d6f821 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>
2012-10-17 09:32:38 +02:00
Lars Knoll bd0e6209dd Convert most operations to the new calling convention
Change-Id: I2dbf61b215a03a3c44c9c6bc431859bb9d067625
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 09:32:13 +02:00
Lars Knoll 35bb45863d Small cleanup
Change-Id: I81f9f49df0ecd94081d111e691494ec746ca58ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-17 09:16:02 +02:00
Lars Knoll bb09c83bcf Converting more runtime methods to the new calling convention
Change-Id: I331e7ebe6479bc5b6bac9cf4e3e6506a1cae1053
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 17:26:25 +02:00
Lars Knoll 537c5fa10d Move conversions to new calling convention
Change-Id: Iec01835b4fd27d8b71b7e709b05bcc757d09e417
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:24 +02:00
Lars Knoll 644804d6b8 More conversions to new calling convention
Change-Id: I6002715cc3f5c22d90a9ade6ae2152c2c3c8ebb2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:13 +02:00
Lars Knoll 3cdb661ee0 Converting more methods to the new calling convention
Change-Id: I5199a9e5439644cc259f131c8b0ba6a941989615
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:09 +02:00
Lars Knoll a1475002d6 Converting more runtime methods.
Change-Id: I9e5d73004e377cff2819cb82240d50e73c8bda94
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:05 +02:00
Lars Knoll c63e799fc2 Convert Value constructors to new calling convention
Change-Id: I433f72666499e660618b061cfcf3407f5f9bb166
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:01 +02:00
Lars Knoll 013098cae8 Further convert runtime methods to the new calling convention
Value bassed argument passing.

Change-Id: I95e49ae301221e36946c2ce4f25081461513a6bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:56:52 +02:00
Lars Knoll d4e6330737 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>
2012-10-16 16:56:47 +02:00
Simon Hausmann 76dbe13caf 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>
2012-10-16 16:18:04 +02:00
Simon Hausmann 54e5b42950 Prospective Mac OS X build fix
open_memstream is not supported beyond Linux it seems, so do the
symbol replacing disassembly printing only on Linux.

Change-Id: I1eff6db9e10bd0ebbc06e967a61f998ee42438a8
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-10-12 12:33:20 +02:00
Simon Hausmann c13a95361a Add missing license headers
Change-Id: I59d602a0f2c1fefb03994ed32a3d697b176791ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-12 10:51:06 +02:00
Simon Hausmann f9b181e4ea Clean up arithmetic operation calls
Don't repeat calls to generateFunctionCall but use a helper macro to
get the name.

Change-Id: I394b1980cbd67f3ca94fc41402de2d5b99c45016
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-12 09:49:24 +02:00
Lars Knoll 67c0513d25 Store booleans as 32 bit integers
The old code was giving valgrind warnings, because
we loaded the boolean (1 byte) as a 32 bit integer.
Instead simply store all booleans as 32 bit ints
to avoid the warnings.

Change-Id: I46c7f9fc9d8dfe52afd9bab2dbab8923aaa630f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-12 09:20:01 +02:00
Lars Knoll f17248441d Send all debug output to stderr
qDebug() was used for part of the logging, which
uses stderr. Send everything else there as well.

Change-Id: I363dff3d2e4dd6f95bf0347f1df589ae2528fd32
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-12 09:18:43 +02:00
Lars Knoll bd0ff1b50d Remove almost all uses of __qmljs_init_string
Change-Id: I88130ec39958c75b70d898a352423908ac2ef1d4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-12 09:17:40 +02:00
Simon Hausmann 54fb3b7af1 Fix stack corruption on ia32
On ia32 sizeof(void*) < sizeof(Value), so we need to subtract
sizeof(Value) instead of sizeof(void*) before reaching the first
temp.

Added comments to explain the offsets.

Change-Id: Iefbb1dc762fdf36d73002c52dc9c471ec15ff403
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-12 09:00:35 +02:00
Simon Hausmann 993eedc43e Initial build fixes for arm 2012-10-11 10:56:03 +02:00
Simon Hausmann ca56a7a163 Implement copyValue using a single load/store pair in the common case of copying temps 2012-10-10 21:56:07 +02:00
Simon Hausmann a13f5069a9 Simplify boolean conditional jumps
* Expect the boolean value to be in Gpr0, which means after the __qmljs_to_boolean
  call the move(ReturnValueRegister, Gpr0) becomes a noop
* Instead of loading the true/1 into a register, use it as immediate value in the cmp
2012-10-10 21:56:07 +02:00
Simon Hausmann a1e4d16244 Make conditional jumps more readable 2012-10-10 21:56:07 +02:00
Lars Knoll a9ed16acf3 Fix stack corruption
The position of temporaries on the stack was
off by 1, leading to us overwriting other r14, that gets
pushed to the stack after we have allocated space for temps.
2012-10-10 21:15:43 +02:00
Lars Knoll 7a9ece649e Emit code for copying values
Remove __qmljs_copy in the process.
2012-10-10 13:49:35 +02:00
Simon Hausmann 85dc29103f Work around gcc bug on amd64 with function pointer assignment 2012-10-10 13:22:47 +02:00
Lars Knoll dcfb63f566 Make it really work for 64 bit.
crypto.js passes now :)
2012-10-10 13:10:07 +02:00
Simon Hausmann 91fe97626d Fix rethrow 2012-10-10 10:30:07 +02:00
Simon Hausmann d4d1b00f8b Centralize value copying 2012-10-09 10:05:58 +02:00
Simon Hausmann 1f28ba475e Save and restore context register before calls 2012-10-09 09:59:02 +02:00
Simon Hausmann 115d570a86 More debug info 2012-10-09 09:06:12 +02:00
Simon Hausmann a084733c14 First shot at more readable call instructions in output 2012-10-09 08:17:47 +02:00
Simon Hausmann ea408f812e Fix array subscript write: add missing context pointer argument to qmljs_set_element call 2012-10-08 21:58:24 +02:00
Simon Hausmann 183d1c4e39 Add missing return 2012-10-07 22:14:01 +02:00
Simon Hausmann 9047b986ea Implement missing movs 2012-10-07 22:10:27 +02:00
Simon Hausmann 33d90f1ed0 implement visitExp 2012-10-07 22:02:41 +02:00
Simon Hausmann 8f87666256 Implement construct property/value 2012-10-07 22:02:06 +02:00