Simon Hausmann [Tue, 26 Feb 2013 11:49:38 +0000 (12:49 +0100)]
Fix build with clang
It tells us quite explicitly how it wants a default constructor
for VoidType :)
Change-Id: I854370c869f179da7f842fbf675e05678285630d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 26 Feb 2013 11:45:47 +0000 (12:45 +0100)]
Fix failing assertion when running the test suite
The test suite does things like "1 instanceof 1" and expects a
type error to be thrown. Therefore we should not assert(!"unreachable")
when instanceof is called with a numberic constant but just fall back
to the run-time implementation, which does the right thing.
Change-Id: Iced93e679d56f4491d38c50b669e12dd160c220c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 25 Feb 2013 09:13:46 +0000 (10:13 +0100)]
[masm] Implement sign text using cross-arch masm api
Use branchTest32 to implement the test for the sign bit in right
shift operations.
Change-Id: I07b3ead4d32761ee3d5f529259be5b5987b7ec5a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 24 Feb 2013 21:31:58 +0000 (22:31 +0100)]
Some smaller optimisations
Ideally these checks should get inlined in the generated
assembly.
Change-Id: I4f63f7235a7d3bbdf8413df9f7d674104ff95b07
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 16 Feb 2013 22:27:07 +0000 (23:27 +0100)]
Small cleanup
Change-Id: I1733ad823ef00114b4544bb0bdf40fede4eea073
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 16 Feb 2013 22:26:16 +0000 (23:26 +0100)]
Fix the sameValue algorithm when comparing ints to doubles.
Change-Id: I96fb3e8c47a336ef4e0e3cab44e6dfd4d5aff70a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 16 Feb 2013 19:44:53 +0000 (20:44 +0100)]
Fix inline assembly version of ushr
-1 >> 0 should return UINT_MAX, as the result is an
unsigned int according to spec. The only way the result
of the inline shr operation can be signed is by shifting
0 bytes. But the easiest implementation is to test the
result for signed-ness and then fall back to the slow
implementation.
Change-Id: Ic4614006d06cf01376ef95b6f23ca2c7216a2812
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 16 Feb 2013 12:19:36 +0000 (13:19 +0100)]
Store 0 constants as integers, not as doubles
Change-Id: Ibb49d1fd8221d65262b1c18b9833233ef97cee8e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 21 Feb 2013 11:07:17 +0000 (12:07 +0100)]
Fix use of CPU(X86_64) to determine 64-bit architecture
Use QT_POINTER_SIZE == 8 instead
Change-Id: I7e3283132682c9f882b4d7b1ee067428bb23d42a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 21:21:51 +0000 (22:21 +0100)]
Port __qmljs_get_thisobject to new calling convention
Change-Id: I59a921d6838fd4e8419bf6cf62d5dca39e1142cd
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 21:12:22 +0000 (22:12 +0100)]
[masm] Fix function name replacement in disassembly on ia32
Cast the void* to a quintptr, to make sure we call the right
QByteArray::number overload depending on the size of a pointer
on the archicture. Otherwise we generate 0x1324 strings that
we can't successfully replace with the function names in the
disassembler output.
Change-Id: Iddc82534487d93547b597d39286b92ffdff6da6c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 20:44:05 +0000 (21:44 +0100)]
[masm] Fix writing of return value on arm
On arm the pointer to the storage of the VM::Value to return is passed in r0.
The value in that register is destroyed soon after, so later when we want to
access it in visitRet() we'll get garbage.
To solve this we behave similar to gcc now, which upon function entry saves the
values of the registers used for parameter passing onto the stack. Except that
on arm we now do this before pushing the link register, which makes the stack
frame look identical to ia32. (old ebp / return address / arg 0 / arg 1 / ...)
With that we can theoretically access the pointer to the return value storage.
In practice we also need to change meaning of the addressForArgument() helper
function to only return the address of arguments on the stack. But that makes
sense since Address() is meaningless for values passed in registers.
Also tightened the #ifdef in visitRet() for determining whether to use the
return value register or not. That wasn't strictly necessary, but makes
the condition a bit clearer.
Change-Id: I6fbef6645275ebaa75484d666b4bbfd073f945a5
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 20:36:02 +0000 (21:36 +0100)]
[masm] Fix function return on arm
Whether we should do ret(n) or ret should depend on whether the caller
provides the pointer to the return value as hidden first parameter or not.
That's the case on ia32 but not on x86-64 or arm, where the first parameter
register is used instead. So the correct preprocessor macro to use here
is ARGUMENTS_IN_REGISTERS instead of VALUE_FITS_IN_REGISTER.
Change-Id: I3a8a8fa316896848baca37626f87ed98c096e14a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 20:15:29 +0000 (21:15 +0100)]
[masm] Cleanup argument handling
Simplify the code for determining whether to push a function call parameter
onto the stack or into a register.
Change-Id: I3ab9230b8c0a3b2466c3000d89faf4fd79f927eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 20:06:13 +0000 (21:06 +0100)]
[masm] Support inline ops on architectures without memory src operands
Change-Id: Idc4240c0fae35e42246f176536b9c16ee28123d2
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 19:44:48 +0000 (20:44 +0100)]
[masm] Fix typo on register assignment
On ARM registers are in JSC::ARMRegisters instead of JSC::X86Registers :)
Change-Id: Ib11f0b3caa84a5015905f0a7937b4250c6f76c78
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Sun, 17 Feb 2013 19:42:21 +0000 (20:42 +0100)]
[masm] Fix incorrect stack pointer adjustment when leaving function
Make sure to calculate the frame size when entering the function the
same way as when leaving it, otherwise the stack pointer adjustment
is wrong and we get nice crashes.
Change-Id: I19f953c3243cf6f1448ad95cad7587fbdca2ae6d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Fri, 15 Feb 2013 23:15:34 +0000 (00:15 +0100)]
Minor cleanup
Change-Id: I8c3fea7c6b330c3e32b10c945f6e7b96a06daa8e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 15 Feb 2013 12:36:49 +0000 (13:36 +0100)]
reference locals in outer functions by index
This makes V4 reference all variables in scopes
that are not the global scope by index. The JIT and
the interpreter walk up the scope chain to get the
correct reference.
Variables are only resolved by name for the global
scope, if the scope contains an eval statement (as
eval can define new variables) and inside with and
catch scopes.
Change-Id: Ib9f9d1a03d50124130aefd169eeb071533ba3520
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 15 Feb 2013 12:31:32 +0000 (13:31 +0100)]
Retain the proper nesting structure in the VM:Function objects
Change-Id: I83c0889be7fe354f96fca68f786ca2a05121bb56
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 15 Feb 2013 11:40:09 +0000 (12:40 +0100)]
Fix multiple variable assignments
When doing var foo = bar = 42; then we would assign 42 to bar and bar to foo,
resulting in the wrong value for foo if bar was read-only for example.
The spec says in 11.13.1.6 that the rval is to be returned, so we just do
that via the temp we already have.
Change-Id: I44ea895abe4796af10c371baac22c2b26f37b519
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 15 Feb 2013 08:54:10 +0000 (09:54 +0100)]
Port the remaining functions called from masm to pass-by-reference/pointer
Change-Id: I1ea15fc500d0d2168aded2b6a2739420eb007b45
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 15 Feb 2013 07:27:21 +0000 (08:27 +0100)]
[masm] Save guard const reference method calls
Introduce a Reference type next to PointerToValue for which we can ensure that
it's non-null using an assert. Otherwise implemented push(PointerToValue)
to push a null pointer if the temp is null, instead of asserting.
Change-Id: I70f15e39dd80a6b2c65630060cba35f3417c0634
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 15 Feb 2013 08:30:24 +0000 (09:30 +0100)]
Don't assert when running into the JS debugger statement
Instead use Q_UNIMPLEMENTED() that just prints a warning. This
really is missing functionality that in the meanwhile shouldn't cause
crashes due to failing assertions.
Change-Id: I85314d04e35af35b95dc81e9cbdd659d13f43798
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Laszlo Papp [Thu, 14 Feb 2013 22:57:59 +0000 (22:57 +0000)]
Add the mandatory license file to be consistent and proper
See the following mailing list thread for further details:
http://lists.qt-project.org/pipermail/development/2013-February/009810.html
Change-Id: Iec80c7cbeeafca7d2cdd63eb9c918d8dedbc6cd0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 14 Feb 2013 22:16:50 +0000 (23:16 +0100)]
cleanup __qmljs_to_boolean vs Value.toBoolean()
Change-Id: Ic93eed2d4e68972d373bf1521387331ce26bac43
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 22:04:12 +0000 (23:04 +0100)]
remove __qmljs_throw_type_error
Change-Id: Ib666fa478e3e306117b50afebbd7826fa5b0738e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 22:00:11 +0000 (23:00 +0100)]
Various cleanups in the runtime
Remove unused code, inline where we only use a method
once.
Change-Id: I1896efc3f4d309082aff2f80f944e19c1ede2f50
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 20:41:49 +0000 (21:41 +0100)]
Fix a few more runtime signatures and optimise toObject conversion
Change-Id: Ibd1e4b7f2c9609b4ac08d75c8a0e2d5a86521605
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 19:58:10 +0000 (20:58 +0100)]
Adapt get/set_element to new calling convention
Change-Id: I5e2bca8ee2435bf678dbf9eb15172ed59c80b52e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 15:18:01 +0000 (16:18 +0100)]
Ported closure init runtime functions to new calling convention
Change-Id: Icb5765069b296977480d896aacfbd09d64dbdad6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 15:15:19 +0000 (16:15 +0100)]
Ported run-time exception throwing functions to new calling convention
Change-Id: Icc05eb78deb6d087a06f77d28b71fd49c9705e4c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 15:11:16 +0000 (16:11 +0100)]
Fix argument order of unary ops
Change-Id: Id108c4b74f03cac8181a9308413b69e6bf1ef83e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 15:04:15 +0000 (16:04 +0100)]
Ported built-in exception getter to new calling convention
Change-Id: Ica14229cfa280afba2003b3b50930c2986aa2f23
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 15:02:40 +0000 (16:02 +0100)]
Convert property deletion runtime functions to new calling convention
Change-Id: I312ccbd65d9aad5e8db349af94c00bed0fd73544
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 14:55:43 +0000 (15:55 +0100)]
Convert unary ops to new calling convention
Change-Id: I974fd474c4f35885e42dd219e2daa65098f4e0a1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 14:47:06 +0000 (15:47 +0100)]
Convert construct runtime functions to new calling convention
Change-Id: I063508ff780d2f6371f77eca7138a09d78e1a45e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 14 Feb 2013 14:00:06 +0000 (15:00 +0100)]
Move the destructor into the new vtable.
This makes all runtime structures fully non virtual.
Change-Id: I804568ca9bc33d4be0324ed542df8eab5892c0eb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 13:21:37 +0000 (14:21 +0100)]
Remove another virtual.
Change-Id: Id83e7e5153160247b15c1506cb3c741cc6b77368
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 13:18:59 +0000 (14:18 +0100)]
Silence compiler
Change-Id: Id248400c50609811baebb1ea710210915e5274c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 13:18:34 +0000 (14:18 +0100)]
Remove another virtual
Change-Id: I185be24d4c09d2078c3459460875c4711bf17ddb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 13:07:57 +0000 (14:07 +0100)]
Move call/construct over into the new vtable.
Change-Id: I4f58a1fac25440695bdc62a49adb51a887616a5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 10:53:23 +0000 (11:53 +0100)]
Remove another virtual and de-inline a call method
Change-Id: Ia7cc0bf9f4024a65020fef75666ae13d3691bc54
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 11:56:05 +0000 (12:56 +0100)]
Convert builtin type of functions to new calling convention
Change-Id: Ie0c9300eead2171c899bca54635e6fdf301385d3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 12:28:49 +0000 (13:28 +0100)]
Converted calling runtime functions to new calling convention
Change-Id: I03837e9b392957bd64a6710c1b85b4429556ba06
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 11:29:16 +0000 (12:29 +0100)]
Fix print and gc in builtin v4 method
Also removed unused TestHarness stuff.
Change-Id: I6332d9a34f471df07cfa0e9709a203e99a48b524
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 11:16:30 +0000 (12:16 +0100)]
Convert builtin typeof to the new calling convention
Change-Id: I40f268c53dacf2ee188b3d1df9391df3e5e812f8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 14 Feb 2013 09:45:49 +0000 (10:45 +0100)]
Convert run-time functions that take a Value * for arguments to use a Value reference
This keeps the C++ implementation code simpler while still providing the same
(pointer based) calling convention.
Change-Id: Ib72acf1dfdf4638f6d109a0771fdafc921a544d2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 14 Feb 2013 10:10:17 +0000 (11:10 +0100)]
Remove the virtual call(ctx) method
This is better handled in ScriptFunction and BuiltinFunctionOld.
Change-Id: Id896b1ddac47a9ce52e86abff901c87b7e627271
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 10:02:57 +0000 (11:02 +0100)]
Don't use the slow call() method for Date()
Change-Id: Ifc29ef18a173a210a8831b87ba3f1adcbe9911d6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 10:00:39 +0000 (11:00 +0100)]
Move the generic construct() implementation into ScriptFunction
This is the only place we really need it, as the generic
construct method defined by the spec mainly applies to
functions defined in script.
Change-Id: I4fe4219715a4a9393900db6a2532e42fafaea2db
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 09:46:30 +0000 (10:46 +0100)]
Remove the virtual contruct(ctx) method
The more general and faster construct method taking
more arguments is now used in all cases.
Change-Id: I183e4279526e5a937938a72d494a537faf4bc825
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 08:20:33 +0000 (09:20 +0100)]
Use faster call/construct methods
Change-Id: I3e3c2ab42f20d9d5f38d3f9681d05de9487d80bd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Feb 2013 08:10:30 +0000 (09:10 +0100)]
Implement hasInstance through the new 'vtable'
Change-Id: I59aea0f64e7ac955c3f1243936d77f2c12103621
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 22:00:10 +0000 (23:00 +0100)]
Add a C style vtable to Managed and use it for markObjects
We need to replace the C++ vtable with a home made one for additional
flexibility. This will help us deal properly with primitive this
values, and allow us to enable certain optimisations where we can
change behavior at runtime (e.g. use optimised lookups as long as
we don't have any accessor properties defined).
Change-Id: I6a3852692bdc5c4f0bde05f6ff2b296013ba47e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 21:27:15 +0000 (22:27 +0100)]
Replace post increment with pre increment if we don't need the result.
Same for decrement operations.
Change-Id: I9ef33f12f8cf009e9d441989dbc6bc6a233b8994
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 21:13:53 +0000 (22:13 +0100)]
Convert post inc/dev operators to new calling convention
Change-Id: Idbfa6852d308337076a1aa18cdeb43460fb5bed6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 20:14:17 +0000 (21:14 +0100)]
Convert inplace binops to pointer based calling convention
Change-Id: Ie39fb9160573c79ea765466fc9750e2f50b52ab3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 15:22:10 +0000 (16:22 +0100)]
make binops pointer based
Change-Id: Ic03e134ba2c0f51f6a72bd875aba1d30eee8fd2d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 14:36:53 +0000 (15:36 +0100)]
throwing a type error doesn't return a value
Change-Id: Id7a03c1804e66dfad8448e3e3ec70832152e09fa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 13:42:56 +0000 (14:42 +0100)]
Move get/set_property over to pointer based calling convention
Change-Id: I4afc0e90bd4763d170e06adddf70cf133c9ebbf7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 13:15:08 +0000 (14:15 +0100)]
Change activition property calls to be pointer based
After longer discussions, we actually found out that
passing Values by reference (ie. as pointers) is most
likely quite a bit more efficient then passing them by
value. This is esp. true on 32bit platforms.
So change the runtime back to a pointer based calling
convention.
Change-Id: I948d361b6876109d77fc58f11ceb47109cf631d1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 12:41:49 +0000 (13:41 +0100)]
Remove unused method
Change-Id: I8fdb8febafa996b26d2db503a57788c9ccbf3307
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Feb 2013 11:44:37 +0000 (12:44 +0100)]
Fix lookups in catch scopes
Change-Id: I6fa7546bb7c8d5bc1b52de8adb5c5cc8cb97c9ad
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 13 Feb 2013 09:35:46 +0000 (10:35 +0100)]
[masm] Remove unused code
We don't need to save & restore esi on ia32 between calls, because it's
actually a callee saved register.
Change-Id: I452bc59c42b5428a4f5f32e379be144c744cfd2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 12:33:50 +0000 (13:33 +0100)]
Fix scoping for catch blocks
Based on Lars' idea, done together with Erik.
For proper scoping of the exception variable in catch blocks, it is necessary
to define the new scope (ExecutionContext for us) at run-time, it cannot be
determined at compile time.
This patch implements the necessary logic to create the new execution context
when entering a try block and re-uses the existing pop_scope infrastructure for
destroying it again. Within the catch scope it is necessary to do all lookups by
name, so the existing _function->insideWith variable was re-used and renamed
to _function->insideWithOrCatch. Additionally the new context also stores the
name and value of the separately scoped exception variable that shadows any
existing equally named variables in outter scopes.
CodeGen::unwindException also had a bug that it would generate the finally code
with the wrong _function->insideWithOrCatch level, resulting in name lookups
inside finally instead of local index lookups.
Change-Id: I5616af38c3558e553e971a6a894ce5239ccb8422
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 12 Feb 2013 21:50:41 +0000 (22:50 +0100)]
Optimise property access
Change-Id: I24e41395cd6f648b121f9a08ab1eaacae234e081
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 12 Feb 2013 14:55:44 +0000 (15:55 +0100)]
Cleanup: Reduce cpu specific #ifdefs in common masm code
Centralize the callee save register handling as well as potentially cpu
specific stack frame enter/leave code (like ARM doesn't automatically save the
link register) inside bigger cpu specific #ifdefs instead of sprinkling them
throughout the code. That should make it easier in the future to port to
new calling conventions and architectures.
Change-Id: I92fed7cc3d0f7eb4da86843b7ad59581a64f635f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 12 Feb 2013 21:25:39 +0000 (22:25 +0100)]
Also lookup properties in the prototype by index
We can only do this when getting properties, as setting
values will always happen on the main object.
Change-Id: I0336dd393bf78144d54ed8b6008011a7046e325d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Feb 2013 20:46:01 +0000 (21:46 +0100)]
Fix a crash in JSON
Fully initialize the property descriptor when parsing
JSON.
Change-Id: Ia43ac2dae573c5d5050cb02ca8f177c363262a05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Feb 2013 15:23:52 +0000 (16:23 +0100)]
Implement a first iteration of the fast property lookup scheme
Fast lookups still require a function call, and will only work
for properties defined on the object itself. Properties of the
prototype will still be slow.
Change-Id: I07c601998d312b1bd8e9977708d3375bf72df3e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Feb 2013 12:14:19 +0000 (13:14 +0100)]
Saner handling of property deleting with internal classes
Build up a new internal class from the empty class with the
deleted member removed. The add a transition for removal from
the current class to the new one.
This avoids bad behavior in pathological cases where someone
would remove a member, then add it again etc.
Change-Id: I9f2138785780bc3b9f529056e27abe51c1055bbe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 11 Feb 2013 15:41:42 +0000 (16:41 +0100)]
Fixes to the memory manager
Don't use the location of the bitfield to store the nextFree
pointer. This can easily lead to trouble when changing the layout
of the bitfield, as a we rely on inUse being 0. Rather use the
location where the vtable is being stored.
Fix the sweep method in the memory manager to correctly insert
all objects into the free list.
Fix mark, to really discard objects that are out of bounds.
Change-Id: I902e46907043c9d4288d0e3d1564460b5b265c4f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Feb 2013 10:05:18 +0000 (11:05 +0100)]
Fix identifier handling in strings
Give identifiers a full 32bit range, so we don't accidentally
get into overflows. Make sure UINT_MAX can be used as an identifier.
Change-Id: I7d031f9eff0ea2edd7d3e182670fbd37aaf04040
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 10 Feb 2013 21:22:53 +0000 (22:22 +0100)]
Use internal classes to store the layout of members
Add an internal class structure to Object that will allow
us to do much more efficient property lookups in the future.
Change-Id: I9ee72f6d73113a489f00ad7a31a20e91fbba18ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 12:25:23 +0000 (13:25 +0100)]
Fix name function expressions
We should also insert those into the environment members if they have
a name and are part of an expression statement. Simple testcase
example:
try {
function foo() { ... }
} catch (e) {}
Then foo should be visible as if it was declared outside of the try.
Change-Id: I8d23a28e1c4537d4f57f9cb0d559e6163e0fdef0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:54:15 +0000 (09:54 +0100)]
Fix debug build with Visual Studio
For some reason it wants to reference the Void "value" that
should really get optimized away. That doesn't seem to be the case
in debug builds, so let's just define it.
Change-Id: Ifb25911d4764af87b5a7d3a04f618ebc5e428ff7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:51:13 +0000 (09:51 +0100)]
Fix build with Visual Studio
VC gets confused by the VM:: namespace prefix here, but it turns
out that it's not necessary in the first place.
Change-Id: I626d0d4e1d64e64d28783045a4d8bf320a060aeb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:45:37 +0000 (09:45 +0100)]
Fix link error on Windows
__qmljs_create_exception_handler was declared without export
but defined with export.
Change-Id: I998d33d64eb8acfaba451582e4c0082685f2b42a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:39:25 +0000 (09:39 +0100)]
Fix build with Visual Studio
Which doesn't have nan(const char *tagp). Instead let's just use
std::numeric_limits<double>::quiet_NaN().
Change-Id: I13127a3813fc84e85681883c5a0ec89f7cd69667
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:30:40 +0000 (09:30 +0100)]
Fix alloca usage on Windows
On Windows it's _alloca, so provide a wrapping macro in qv4alloca_p.h
and use that instead.
Change-Id: I675cb7fd09bab3c84c44e56819c0f17a42b3c211
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Feb 2013 08:23:58 +0000 (09:23 +0100)]
Fix cmath function usage
Some of the cmath functions in std don't work reliably on all platforms
and on top of that with Visual Studio they are not in the std namespace
at all (but for example prefixed as _isnan). Import MathExtras.h from
WTF that includes all the necessary workarounds, including things like
making pow() with MinGW compliant with what JavaScript needs.
Change-Id: I3d8190ce33919db69b2889b439731a9cf5b2a46e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:52:18 +0000 (16:52 +0100)]
Fix build on platforms without INFINITY
Use Q_INFINITY from qnumeric.h as portable wrapper.
Change-Id: I2dc2ef1c5e31ace89730b010c2a884e5b532b01f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:47:03 +0000 (16:47 +0100)]
Simplify UChar stub hack
Don't use uint16_t, because it's not available with all MSVC
versions. Since this is just a stub it's okay to simply write
out the type.
Change-Id: I9220c9476a7263377b723e46e4f49892908bd53c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:46:03 +0000 (16:46 +0100)]
Make ExecutableAllocator compile on Windows
Use VirtualAlloc and friends instead of mmap.
Change-Id: I52a90cebb111cf923d86ce6a821717dc7e02ad85
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:42:55 +0000 (16:42 +0100)]
Centralize code to determine system page size
Use the existing WTF::pageSize() instead of calling sysconf
ourselves.
Change-Id: If68c793898253a239e13070e3454653474f61790
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:38:06 +0000 (16:38 +0100)]
Fix build against Windows.h
The system header file is kind enough to define a macro called CONST,
which conflicts with our IR member function. Resolve the conflict by
deleting the macro.
Change-Id: I19ec1eadd54159a9bea128ef2a586d089f56b548
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:33:57 +0000 (16:33 +0100)]
Fix conflict of member variable with compiler intrinsic
Rename the _asm variable to _as, to avoid a conflict with _asm
with MSVC.
Change-Id: Id8e2ff965c5e26e3d80b1656020d1889b1eb291b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:31:56 +0000 (16:31 +0100)]
Implement thread stack base determination with the MSVC + x86 combination
Change-Id: Idfb4961cc15f9740d3f3bdd126424d3fa7b3e454
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:29:48 +0000 (16:29 +0100)]
Remove unnecessary sys/mman.h inclusion
Change-Id: Ic4bbc6a595849042a9c970ba2d0ad5785fe1b89a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:28:17 +0000 (16:28 +0100)]
Fix build with non-gcc compilers
Properly protect the inline assembler integer math with preprocessor
macros. Enable only with gcc and on x86 and amd64.
Change-Id: I4a422addc1f3aba0f10d5541357d940bb4c29060
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:23:46 +0000 (16:23 +0100)]
Fix build of time related code on Windows
Use Q_OS_WIN instead of the non-existent Q_WS_WIN
Change-Id: Ia64908dfdb234bce5f0a2256bb292d91da2fcb68
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:20:56 +0000 (16:20 +0100)]
Make it possible to omit the udis86 assembler from compilation
Disable it on Windows and enable it generally only on x86 and amd64
architectures.
Change-Id: If8f366a3095608b9afcd30dee6dc636d442d4107
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:16:38 +0000 (16:16 +0100)]
Work around broken min/max macro definitions on Windows
Windows defines min and max to macros, which breaks code that for
example uses std::max. Defining NOMINMAX globally prevents WinDefs.h
from defining those macros.
Change-Id: Ib79a48f9139febd1429a11753ffef4430953a3b4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:15:26 +0000 (16:15 +0100)]
Don't do -rdynamic on Windows
It doesn't make sense :)
Change-Id: I7455cd157e1d5938317c7e488701bbb1651eb449
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:14:44 +0000 (16:14 +0100)]
Fix exports in v4 binary
Don't use the export macro on internal debug classes.
Change-Id: Id2f8069cc8b6703a3fafd3058524d46252eb57f8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 7 Feb 2013 15:13:41 +0000 (16:13 +0100)]
Fix objects dir for debug and release builds
Don't define OBJECTS_DIR, the qmake bits for Qt 5 modules takes
care of setting it to .obj/debug_shared and .obj/debug_release
accordingly for example. Hardcoding it just breaks that.
Change-Id: I1023de159c459194eba74134626892563d069a22
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 6 Feb 2013 08:05:47 +0000 (09:05 +0100)]
Also mark the last item in the last chunk
Change-Id: I9af2232a987c1297cba08579e944b1c30d032088
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Erik Verbruggen [Wed, 6 Feb 2013 14:41:00 +0000 (15:41 +0100)]
Include stdlib for arc4random().
Change-Id: Icf7f09d2007941cd1005e28eaf189d1265c71900
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 6 Feb 2013 12:15:10 +0000 (13:15 +0100)]
Restore the context pointer after returning from setjmp
Change-Id: I68682400c80cf9a8f28d11d8031681d6d92f590b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>