Commit Graph

130 Commits

Author SHA1 Message Date
Lars Knoll 903e04dead Convert String to new constructor syntax
Change-Id: I07f7667d3d72a7d72e6717d194de8d7b15435777
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:19 +02:00
Lars Knoll 133ea9d0f1 Convert more objects to the new constructor scheme
Change-Id: I31b2a1ba4a93f0d4bde68eeb94f13e7224c0cd7b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:18 +02:00
Lars Knoll 0fd24cf96e Convert most simple objects to the new constructor scheme
Change-Id: I90042037bc0555771bd98233977c7d2b735bb718
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:18 +02:00
Lars Knoll dba56a752c Convert remaining FunctionObject's to new constructor scheme
Change-Id: I440d5b128d0ee28566ebfa82c2505a4bd97bba6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:18 +02:00
Lars Knoll 00fa904911 Convert FunctionObject derived classes to new construction scheme
Change-Id: I0d43a79ed531a9d651bd00866d73113c05d95a09
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:17 +02:00
Lars Knoll 45f7120d42 Convert regexps
Change-Id: I5b62a265a7ce363a16b1e14ae93cadbb1ab0cb5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:17 +02:00
Lars Knoll 57f08e59fc Get rid of all uses of ObjectRef
Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:13 +02:00
Lars Knoll 2c7c791e3f Remove the less often used Ref classes
Change-Id: I9ee531c903317a0f324671d98af1f967b684915c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:12 +02:00
Lars Knoll 33593f00e8 Get rid of StringRef
Remove the Ref classes, as they won't be required
anymore once Managed and Managed::Data are separated.

Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:12 +02:00
Lars Knoll d33b68e2df Convert specialized ExecutionContext's to new data layout
Change-Id: Ie3aad65e4a10aaa259ae9513f0fcff79dc7e6a39
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:11 +02:00
Lars Knoll 9744e8bd42 Convert ExecutionContext to new storage scheme
Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:11 +02:00
Lars Knoll 42b137bd1e Convert ErrorObject to new storage scheme
Change-Id: I356a9947b87a5cda4eda738d3b6d5d51ee9a98f2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:03 +02:00
Lars Knoll 1019b1cabf Move data of FunctionObject into an inner struct
Change-Id: Ic00b1761565f9f8881b665a3fecca723239e2279
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:48:55 +02:00
Lars Knoll b11ec08570 Move Managed data into it's own subclass
This prepares for moving over to a d pointer scheme,
where Managed subclasses don't hold any data directly. This
is required to be able to move over to a modern GC.

Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:48:54 +02:00
Lars Knoll c2ef5bff23 Use Members for storing the bound arguments in BoundFunction
Cleans up the code, and allows us to remove the destructor
for bound function objects.

Change-Id: Id32ac69171f7975ec7679d07d25c0eb6b4ca6fb5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:48:53 +02:00
Ulf Hermann 4d68155848 Properly initialize heap profiler when starting profiling
Change-Id: Ia994464b2150dc9a9185280ae0e2f8c615393310
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-12 18:13:45 +02:00
Ulf Hermann ac56e7cda7 Javascript heap profiler
This profiler tracks every memory allocation and deallocation, by the
MemoryManager as well as the V4 VM, and exposes them as a stream of
events to the profiler service.

Change-Id: I85297d498f0a7eb55df5d7829c4b7307de980519
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 18:18:35 +02:00
Simon Hausmann 52fcb218c3 Fix marking of prototype objects in internal class pool
As per reported bug, we have to protect ourselves against potential loops
and can mark the internal classes much simpler by just walking through
the memory pool they were allocated in.

Task-number: QTBUG-38299
Change-Id: I3ae96e8082e76d06f4321c5aa6d2e9645d2830a0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-04-28 12:49:53 +02:00
Lars Knoll 8e556778c8 Garbage collect member data
Move the allocated member data into the garbage collected
area, so that we can avoid using malloc/free for it.

Change-Id: I20625efa67ecd60238568742b74854b0c8cb2e3e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-04-04 17:26:20 +02:00
Lars Knoll c0fe2ec596 Optimize construct calls
Optimize construction of the internalClass for the object
being constructed.

Change-Id: Id5fc02c291664ec01c3595ae0acbb6895cc5b147
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-27 20:39:59 +01:00
Lars Knoll 4606bd6683 Optimize construction of SimpleArrayData
Change-Id: I7f8a0ac8a368af23534378e8c31d820b3b9f1f4c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-19 08:14:46 +01:00
Lars Knoll c3fbec3ab9 Small optimization to RegExp
Also add markObjects() calls to all the identifiers we keep
around in the engine. It's probably pure luck this hasn't caused
any issues until now.

Change-Id: Ie31d19793efa53867e4e240ba548070dcde32ec1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-18 09:05:57 +01:00
Lars Knoll dfed088a50 Fix copying of Property's
Data properties don't contain valid data in the set field
if they are being stored in Objects. Thus we should never
access that field unless we are dealing with accessor
properties.

Change-Id: I19dcbaee7ebd042ae24387f92a93571d75ca578a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-10 21:00:22 +01:00
Lars Knoll b8ca413243 Better way of retrieving the prototype property for FunctionObjects
Make sure FunctionObjects always have the prototype property at
index 0. This way we can speed up the instanceOf operator even more,
and at the same time save 16-28 bytes of memory per FunctionObject.

Change-Id: I8527bc8f9dc7b04a9db8395b5f05bab47ddc21ce
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-07 16:55:12 +01:00
Lars Knoll f836b9837d Remove the name member of FunctionObject
The data is anyway stored in the name property of
the FunctionObject, and is not performance critical.

Change-Id: If1784b0ec6f368bc474c246bb9c2c50d5e56b689
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-07 16:55:12 +01:00
Lars Knoll e4a6c5b3e4 Fix test failure in qqmldebugjs autotest
The debugger should only have one breakpoint that can
be set per line. Nevertheless, we should have proper
line number information available in case we stop at
other places.

We also need a debug instruction before the return
statement, so that step out will always find a last
stopping point in the parent frame.

Change-Id: I86145fc244148f106a4a97ce69ab60b568c8dac6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-07 16:55:12 +01:00
Lars Knoll 245f5ce7bb Add a Line instruction to the interpreter
This unifies the way we handle line numbers in the
JIT and Interpreter.

Remove the now unused lineNumberMapping code and data.

Change-Id: I1d60b1fbb77e70b531fa73d93410683e84dd1e3c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-07 16:55:12 +01:00
Lars Knoll a6fc758841 Remove unused codeSizes
Change-Id: I13c7d9dda7cd1e771079f6fdaa175008b3a3e0e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-03 20:23:28 +01:00
Lars Knoll 292fdc9086 Remove nArguments and name from QV4::Function
Saves 12 bytes per Function

Change-Id: I9a495805f9201eb6162a520ff5c2defeb73dc37a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2014-03-03 20:23:24 +01:00
Michael Brasser a3688bf41f Improve memory usage in QML/V4 engine.
* Don't create prototype Object for bindings and
  signal handlers. It is inaccessible and not required.
  This saves one Object-sized allocation per binding.
* Shrink the size of QQmlContextWrapper by removing
  the v8 member variable.
* Shrink the size of QObjectWrapper by moving the destroy
  identifier to the engine.

Change-Id: I76e84e4c0581e97a19d2e959f814ac84d9c431fa
Task-number: QTBUG-37134
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-28 19:01:21 +01:00
Lars Knoll cad3ba5fd4 Clean up our internal namespaces
QQmlJS::MASM -> QV4::JIT
QQmlJS::V4IR -> QV4::IR

Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-23 09:39:52 +01:00
Ulf Hermann ebef5a5a68 Satellite profiler for V4
Self-contained profiler for V4. By itself it doesn't have any
connections to qqmlprofilerservice.

Change-Id: I471a6119e07eab9c5f4712a16835be49c8886d1a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-12 21:29:54 +01:00
Friedemann Kleint 33201dc147 Add a function dumping out a GBMI stack trace of the V4 engine.
Add an exported C-function dumping the JS stack trace which can be
invoked by a debugger with the address of an execution context
it finds in a complete stack trace.

Task-number: QTCREATORBUG-11144
Change-Id: I5314f6b24868f12d4f9dedd1c261658957e581ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-12 11:23:40 +01:00
Lars Knoll 39d7e330e6 Make the Ref classes not template based
Move to a class hierarchy that mirrors the main classes. This will
allow moving functionality over into the Ref classes, as the current
Managed classes become mainly something that holds the data. This
is required to make objects movable by the GC.

Change-Id: I4ca88ab0e5d8c88c8dc56d51937990500a33e0d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-07 10:44:00 +01:00
Lars Knoll 927a46b1af Rename Referenced to ManagedRef
First step of removing the templates here and turning this
into a class hierarchy. This is required, so we can move all
member methods into the Ref classes and make objects movable
during GC.

Change-Id: Ie14af07fd3e72a7d84a528d0042189ff12ba21bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-07 10:43:57 +01:00
Lars Knoll d89e269866 Smaller performance fixes
Move commonly used variables in the ExecutionEngine
to the beginning of the struct to increase cache locality.
Keep the engine pointer in a register in the interpreter to
save one memory load per instruction.

Change-Id: If2540c66b62685701511f410aff495c0a20ca694
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-05 18:29:02 +01:00
Lars Knoll a78a48c532 Cleanups
Remove SafeValue, it was used to port over to an exact GC. Since
we now have that, we can now safely merge it with QV4::Value
again. Also rename SafeString to StringValue for better naming
consistency.

Change-Id: I8553d1bec5134c53996f6b0d758738a0ec8a2e4d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-31 11:13:48 +01:00
Lars Knoll e37a9eb4a4 Rename some files
Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to
qv4value_inl_p.h.
It makes more sense to have the class definition in the file
that is named after the class and move the inline methods into
a _inl file. Doing this now, as I expect we'll be needing a few
more _inl files soon.

Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-31 11:13:48 +01:00
Simon Hausmann 9a5568a197 Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev 2014-01-24 18:27:50 +01:00
Simon Hausmann 22041acdfe Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/imports/dialogs/qquickmessagedialog.cpp
	src/imports/dialogs/qquickmessagedialog_p.h
	src/qml/debugger/qqmlprofilerservice_p.h
	src/qml/jsruntime/qv4regexpobject.cpp
	tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro

Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
2014-01-24 18:27:41 +01:00
Simon Hausmann ab2b521987 Allocate the ArrayData object and it's data together
Reduce the amount of allocations required for Arrays, and
allows freeing the array data more easily in the GC.

Change-Id: I3e3213f089c45c83a227038ce444aa60b2735b7f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-24 14:32:37 +01:00
Lars Knoll 7d4fc70e70 Split ManagedVTable into two classes
Keep the basic methods in ManagedVTable, but have
the Object related stuff in an ObjectVTable class.

Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-21 20:46:50 +01:00
Alex Blasche 24c43a5748 Make compile on DragonFly BSD.
[ChangeLog][Platform Specific Changes][BSD] Fixed compile errors on
DragonFly BSD and potentially FreeBSD.

Task-number: QTBUG-35867
Change-Id: Iea90b93672c34f8a4b56e9afc4dbfb82cc993548
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-21 12:32:58 +01:00
Simon Hausmann f596553e03 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	.qmake.conf
	src/imports/dialogs/DefaultFileDialog.qml
	src/imports/widgets/qquickqfiledialog.cpp

Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
2014-01-17 07:12:23 +01:00
Albert Astals Cid 14ebfef611 Do not crash if /proc is not mounted
When proc is not mounted pthread_getattr_np fails, so default
to 1MB stack in getStackLimit and to exactGC in MemoryManager

Change-Id: Ic7515fd420f2d39a656808d24a3915a657722891
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-15 10:45:05 +01:00
Lars Knoll 40fd9ff0ff Move Managed::type and some flags into the vtable
Move the type flag into the vtable to free up these
bits in the Managed class, and not have to set them
at object construction time.

As we often need to know whether a Managed object is a
Object, FunctionObject or String, add some bitflags to test
for these to the vtable.

Change-Id: I7d08ca044544debb307b55f124f34cb086ad9e84
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-03 17:09:16 +01:00
Lars Knoll 74ef33c881 Do not call InternalClass::changeVTable directly
vtable changes need to happen when the internal class
is being constructed, not later on.

Change-Id: Ibb9515745c9fc3507a5a90b4cc50a33e2e0d3f99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-03 17:09:11 +01:00
aavit 0697a94132 Fixes: qml memory corruption on Android
Bionic pthreads reports too small stack size for main thread.

Change-Id: I3d33229e76101a847309c723d534844ffb2d2042
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-12-17 21:36:34 +01:00
Lars Knoll 9306c05dd1 Encapsulate the current context and fix it's usage
Encapsulate accesses to the current context, and rework
the way we push and pop this context from the context
stack.

Largely a cleanup, but simplifies the code in the long term

Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-12-04 09:45:50 +01:00
Lars Knoll 0f32303e5c Remove setVTable calls in performance critical areas
Remove all the calls to setVTable that were in performance
critical parts of the code. This now brings performance
back to the level we had with the vtable inlined in the
Managed objects.

Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-12-04 09:45:48 +01:00