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>
Lars Knoll [Tue, 5 Feb 2013 21:14:03 +0000 (22:14 +0100)]
Don't insert undefined elements into the sparse array
When converting to a sparse array, skip the missing
elements.
Change-Id: Ic5ae7973c200d530ad4f89aa23b46a2581198b5a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Tue, 5 Feb 2013 21:13:27 +0000 (22:13 +0100)]
Inline some code only used from one place
Cleans up the qv4object class definition.
Change-Id: Ifca7f89afb3affce5d940b1b4f7dcfe71779012c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Tue, 5 Feb 2013 15:15:38 +0000 (16:15 +0100)]
Remove some duplicated code
Change-Id: I02857ad6ab74bb70aebe1b6b74c21171e8d87d03
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Sun, 3 Feb 2013 21:08:39 +0000 (22:08 +0100)]
Don't use a QVector to store the array data
Refactor the code to store the array data in a simple
C array. This will later on allow for direct inline
access to the data.
Change-Id: Ic829bf1a90abfcda27ab4291cb7d5721bbd58403
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Erik Verbruggen [Tue, 5 Feb 2013 21:49:26 +0000 (22:49 +0100)]
Fix GC for the last object in a chunk.
heapChunkBoundariesEnd points to the last entry in a chunk, so include
it as a valid address to be candidate for marking.
Change-Id: Ieb1fbb494ae2fd8ee5d38ae59529cf441fbcd729
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 5 Feb 2013 21:47:10 +0000 (22:47 +0100)]
Add memory scribbling back in.
Disabled by default, turn on by setting the env. var. MM_SCRIBBLE.
Change-Id: I616f48976d7f0541390dd1920efc69e294c5056e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 5 Feb 2013 21:41:40 +0000 (22:41 +0100)]
Fix compiler warning.
Change-Id: I8cf22a60dfe42a4fcc3ab130aeb82f46e018c2f5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Sun, 3 Feb 2013 11:19:15 +0000 (12:19 +0100)]
MOTH: have the VM::Function hold on to regexps.
When regexps were created, they were not added to the VM::Function's
generatedValues, resulting in premature collection.
Change-Id: Idac2202e3040c6311c6f1ceead641e51a8de9729
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Sun, 3 Feb 2013 10:03:39 +0000 (11:03 +0100)]
Fix compilation for access to the extensible flag.
Change-Id: Iaff480e43d8bb241d01cd1f6bc75ddf3d060a33c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Fri, 1 Feb 2013 11:57:22 +0000 (12:57 +0100)]
Fixed the llvm bits of the build process.
Change-Id: I618e0ee413e9548817f84473917ccb8051f689f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 3 Feb 2013 11:34:32 +0000 (12:34 +0100)]
Don't use a QVector to hold the member data
We don't need any implicit sharing or atomic refcounting.
In addition, array access is faster this way.
Change-Id: I85e897b74bad92e126e7502fa8e934c9519b4a63
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 3 Feb 2013 10:43:38 +0000 (11:43 +0100)]
Rename qv4array.* to qv4sparsearray.*
Change-Id: I2c5a683145a4a8e4b243a7f2fe4274dfe2b5abe4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 3 Feb 2013 10:36:55 +0000 (11:36 +0100)]
Move the Array code into Object itself
This allows simplifications of the code moving forward.
Change-Id: If65809fd3646e6dc2da6bc62190d6465b1b1ec12
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 3 Feb 2013 09:25:55 +0000 (10:25 +0100)]
Rename variables and functions
Prepare for merging the Array class with ArrayObject
Change-Id: I03a2b10f290e18f8933efc11f83c76716e3721f4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 2 Feb 2013 08:52:27 +0000 (09:52 +0100)]
Move the property data out of the hash table
Change-Id: I814afa75706cec785ed53039f55ee407dec1ef90
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 1 Feb 2013 14:59:22 +0000 (15:59 +0100)]
Refactor property access
Move the property descriptors into a a vector
and separate them from the lookup table.
This is a pre-requirement for a hidden class implementation
later on.
Change-Id: Ib08b8152597ae0b6c883eef0fced55ee0cb4c286
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 1 Feb 2013 13:32:30 +0000 (14:32 +0100)]
Fix a bug in Array::push_back
We would in some cases write the value to the wrong place.
This fixes the type error in the DeltaBlue V8 benchmark.
Change-Id: Ic64570248d83890d5e66d718b9087c2bf966690a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Fri, 1 Feb 2013 13:31:24 +0000 (14:31 +0100)]
Fix possible out of bounds access
This lead to crashes in some complex code where a
pointer was just pointing to the end of the allocated chunk,
and we'd then read outside the chunk bounds for marking.
Change-Id: Ica41c4e98eb9901fbb8d291289a9c91078ded111
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Thu, 31 Jan 2013 22:52:09 +0000 (23:52 +0100)]
Avoid duplicated feature defines between tools/v4/v4.pro and src/v4/v4.pro
Centralize the macros in v4.pri that's included by both.
Change-Id: I1ae2ed3b7b97a4e905d2e4ae563c99c964253bb1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Thu, 31 Jan 2013 11:18:02 +0000 (12:18 +0100)]
Build fix.
Add proper LLVM detection for v4 tool.
Change-Id: I03ad3099ce9622df67b7c61ce1e72752b9f6e4bd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 31 Jan 2013 10:04:47 +0000 (11:04 +0100)]
Re-enable llvm code in main.
The QMLJS_NO_LLVM flag should be provided by a pri file somewhere next
to the other v4.pro, not here.
Change-Id: I55c17d6a09f81141e9fa671bab9d3ee9a5830e6a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 31 Jan 2013 09:58:01 +0000 (10:58 +0100)]
Fix compilation on Mac with clang.
Change-Id: Ib5ecd92a0b7209ed505d17620ba4097e8d54a53c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Jędrzej Nowacki [Thu, 31 Jan 2013 09:00:06 +0000 (10:00 +0100)]
Cleanup namespaces.
QT_BEGIN_NAMESPACE and QT_END_NAMESPACE was added in header
files. Namespace coding convention got unified.
Change-Id: I971c9a9179d5cd512f8214457609f40992a8ca66
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 31 Jan 2013 08:16:48 +0000 (09:16 +0100)]
V8 benchmark suite
We're currently failing two tests. Performance is between 2
and 20 times worse then V8 in full compiler mode.
Change-Id: Ie78b4e996511777cb665dbf161e41dcfa0210b9b
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Simon Hausmann [Thu, 31 Jan 2013 06:21:19 +0000 (07:21 +0100)]
Don't link v4 against QtGui
The QT variable defaults to core and gui it seems, but we don't
need the latter.
Change-Id: I355d2ab5fb42da4eeaebb6a41ed638203d11650a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 30 Jan 2013 16:11:09 +0000 (17:11 +0100)]
Minor improvements to Context creation
Avoid converting the this object for builtins, and
remove the GC blocker that's not needed anymore.
Move some parts of the code out to the caller
of initCallContext().
Change-Id: I8b11dd1604fb14940e4d4e9f403c2a8bfc837c4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 15:39:36 +0000 (16:39 +0100)]
Convert Math functions to contextless form
Change-Id: I49123f4396d64fb5e2a888d339c87c800981f4f3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 19:48:35 +0000 (20:48 +0100)]
Make things more compliant with a regular Qt module
Move the v4 tool into basedir/tools/v4
Small fix to sync.profile
Install v4 into QT_INSTALL_BINS
adjust test262.py to simply call 'v4' by default
Change-Id: If78f40632c226bc26f64b0eea06fe93d7770af3e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 15:25:57 +0000 (16:25 +0100)]
Remove some unused methods
Change-Id: Ib487078db163e03bb0bd1be762f1aa0da04434b4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:43:22 +0000 (15:43 +0100)]
Inline some code for property lookups
Speeds up fact.2.js and crypto.js by ~5-10%
Change-Id: I121b6c3dbbd89060f323a422286adf946d4f924a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:39:08 +0000 (15:39 +0100)]
Make sure we compare identifiers
Change-Id: I1fc63a062799857ccd937c194e7f305b31ca3567
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:10:39 +0000 (15:10 +0100)]
Convert a few more builtins into versions that don't need a context
Change-Id: I24920f3952cd356d50a056891dc075e56c951775
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 13:56:40 +0000 (14:56 +0100)]
Add an identifier cache
This is very similar to the old string cache with a slight
twist:
Only strings we know will be used as identifiers (property names)
get entered into the cache. These are then also persistent and
won't ever get collected.
Change-Id: Id441694ef9faf30a87433ae22eb833d1db1d84f1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 13:56:19 +0000 (14:56 +0100)]
Don't ignore the v4 subdir
Change-Id: Iea769db7251ba6c6289f23a2d29e194e7d6b2ba5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 12:04:16 +0000 (13:04 +0100)]
Add subtypes to String
This allows to store the full array index in the string,
as well as to optimise identifiers going forward.
Change-Id: I08974a5ee1149869ecfb635932bf54026d2bbab4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 10:04:45 +0000 (11:04 +0100)]
Move string hash and error type fields
Move the string hash back into the String class.
Add a subtype field to Managed, and use that to store
the type of the ErrorObject.
Change-Id: I4aa8f1f39f512e3a9084b249e173bff41175d543
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 08:44:15 +0000 (09:44 +0100)]
Optimise decode/encodeURI
The code contained some needless creation of temporary
QStrings, that were taking up ~50% of the time spent in
these methods.
Change-Id: Iba494e5e92c08a0056d6eb6a947d080209aa7ce5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 12:31:35 +0000 (13:31 +0100)]
Fix compilation on 64bit
Change-Id: I044a7aa1b52aa3df86a22db706d05ffd6a8d2e71
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Jędrzej Nowacki [Wed, 30 Jan 2013 12:26:12 +0000 (13:26 +0100)]
Build fixup, QT_BEGIN_HEADER was removed.
Change-Id: I97b33e4c317aac53cfff1c7ef6f1a04bca9434ba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Tue, 29 Jan 2013 13:20:50 +0000 (14:20 +0100)]
Say hello to QtV4 module.
Change-Id: I507cd5707b7d7223a0d901cf939896fb2649b684
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 30 Jan 2013 08:11:18 +0000 (09:11 +0100)]
Fix a bug with Unicode surrogates in decodeURI
Change-Id: Id8348c77ad4d5429c4b4116b8ef0dc94e130c4e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 07:58:27 +0000 (08:58 +0100)]
Allocate larger chunks if we use lots of memory
This avoids excessive GC activity on test cases that allocate
lots of memory. v4 now runs some of the test cases that were
too slow to run before.
Change-Id: Id668b03799b086445ec0fb48d577a5844f962de3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Tue, 29 Jan 2013 21:08:35 +0000 (22:08 +0100)]
Use faster calling path for more builtin methods
This speeds up some test cases I have by a factor of 2.
Change-Id: Ief9e2845c974d701fa032937cafced323279e9ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 21:07:48 +0000 (22:07 +0100)]
Optimise callProperty for Strings.
Don't convert the String to a StringOject, just to
call a method on it's prototype. The result would
in any case be the same.
Change-Id: I74cea392b20b6c5642d010287ebf6e27c91eea83
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 20:23:19 +0000 (21:23 +0100)]
Add a faster code path for calling builtin methods
Builtin methods usually don't need a Context of their own,
so we can fully avoid the overhead of creating and destroying
it.
Implemented the support for making builtin methods context less
and verified it with some of the methods in String.prototype.
Change-Id: I187b46ba684183b4fba49ae70e3139d32ef585e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 13:31:42 +0000 (14:31 +0100)]
Remove the virtual Object::className()
Change-Id: I70ecf244792c1c22b57ba7bdfed64b4b5b055e8c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 12:45:32 +0000 (13:45 +0100)]
Remove Object::call()
The method didn't make any sense. It's easier to directly
cast to a FunctionObject and check whether that succeded.
Change-Id: I8d76e2b93dc32d6a8fa82e66173d1d2c1e5da514
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 12:23:32 +0000 (13:23 +0100)]
Allocate execution context and local variables in one chunk
This avoids a few mallocs and in addition memory leaks where
the local variables or arguments array wasn't destroyed before.
crypto.js seems to run without a mem leak now :)
Change-Id: Icca74c5dba764fadabd7a77f233bdf5883046c86
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 10:24:43 +0000 (11:24 +0100)]
Don't copy formals and locals from VM::Function to FunctionObject
This should make creation of a FunctionObject quite a bit cheaper
Change-Id: I0937f9f2354b7abc47c3673f4957bd70ff9a97b8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 15:46:09 +0000 (16:46 +0100)]
Garbage collection for Strings
Let String inherit from Managed, and manage them through
the same garbage collector as for regular objects.
Change-Id: Iae1e047daeff683519d52beddcaca7824a01bb27
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Sun, 27 Jan 2013 08:59:37 +0000 (09:59 +0100)]
Split CallBuitin variants into separate instructions.
This saves space by removing (sometimes) unused parameters, and the need
to store and switch over another enum to determine which of the various
built-in instructions is called.
Change-Id: Ie59c49608bf445a07d406b45fd48cfb94bbfc919
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 29 Jan 2013 08:17:22 +0000 (09:17 +0100)]
"Fix" llvm build by adding empty definitions for missing methods.
Change-Id: I172ad23bc56bda9b3a8276cb102599d6243026c4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Fri, 25 Jan 2013 18:32:30 +0000 (19:32 +0100)]
Change TEMP handling in the interpreter.
By introducing the Param struct, and moving the ValueOrTemp into it
too, the parameter decoding for instructions is cleaner and less
error-prone: it de-couples the HIR/MIR representation from the
interpreter representation, and allows for proper handling of the
with-context.
Change-Id: I0bc8f72bc7ce62b8efa298cbea5711adac4a4d34
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 28 Jan 2013 12:49:03 +0000 (13:49 +0100)]
Fix build on ia32
loadArgument(PointToValue) is architecture independent :)
Change-Id: I6ce8b7900088bc7052002a9ae60cbebdd5357d8d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 27 Jan 2013 20:16:09 +0000 (21:16 +0100)]
Properly working post increment/decrement operators
This required some larger changes in our infrastructure.
Unfortunately the post increment/decrement operators
don't return the old value unmodified, but return
toNumber(oldValue).
At the same time they need to properly store the new value
into the referenced expression. The only way to solve this
(as we can't have two return values) is to pass a proper
reference into runtime methods.
Change-Id: I0e0c2cc011ab22d5d4b27924abc8c18372c104a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 10:42:01 +0000 (11:42 +0100)]
Smaller cleanup
Change-Id: I42a1de385e286bf1e4568769886034161f7fe500
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 09:50:07 +0000 (10:50 +0100)]
new eval() should throw a type error
Change-Id: I487a11a060657ac1eeae4c51085ce907711b51c8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 12:32:08 +0000 (13:32 +0100)]
Add a mechanism to protect managed objects from deletion
Change-Id: I6700dc94ad481e12ee7f00c04c0c37261e22a715
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>