Commit Graph

39 Commits

Author SHA1 Message Date
Lars Knoll 37fbfa4dc0 Be a bit more conservative with allocating memory
Cap the max chunk size at 2MB. This value still still doesn't
affect the v8 benchmark noticably, but should avoid extreme
memory usage in some corner cases

Task-number: QTBUG-37134
Change-Id: If2050374c4a7df7ff74194d64880e2d660ea26fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-27 23:27:02 +01:00
Lars Knoll 57f4d8b490 Remove the scribble option from the memory manager
This option doesn't make sense anymore, as we memset the object to
0 on destruction anyway.

Change-Id: Ie40563394f9cacda1b35fde114c9a6043f53d460
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-27 20:39:59 +01:00
Lars Knoll 7ae796cb14 Get rid of collectDeletables
The method is only required for the QObjectWrapper, but
there we can instead simply register the deletable in the
destroy method.

Change-Id: I944319d327859cce33ac31a174e8d56fc4babfc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-27 20:39:59 +01:00
Lars Knoll 7526cb1c95 Optional reporting of GC statistics to stdout
Use QV4_MM_STATS to get some statistics about each GC run
written to stderr.

Change-Id: Idc30c06e1c3ca8353a2f16615cb26df13a8f23ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-25 10:01:43 +01:00
Lars Knoll a1fdf173eb Remove unused method
Change-Id: Ia7df68e78ac105fe5519cb4f80a64561310d3324
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-25 10:01:40 +01:00
Lars Knoll da7995ef2d Remove code for conservative GC
This was meant as a debugging help after we took the exact
GC into use. Turns out it doesn't help debug any issues,
aggressive garbage collection is much more helpful in
finding GC issues.

Change-Id: Idfff26d3a4a15e570615009c1e57921bca6297ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-25 10:01:38 +01:00
Michael Brasser f3a9176442 Allow maximum block size to be specified as an environment variable.
A smaller maximum block size helps limit RAM usage on constrained
systems, at the cost of more frequent garbage collection.

Change-Id: Iba07d9cc628e3178dfaad35664c631844540bc9d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-03-13 16:39:34 +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
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
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 658a15a075 Clear out memory in the GC, not when constructing objects
Object construction shouldn't need to zero initialize itself,
let's rather do this in the GC, where we can use fast memset's.

Change-Id: I2f9efa1729183b0d737de5a84f92af319b2c5631
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-03 17:09:14 +01:00
Lars Knoll fbcd0a22f6 Move the vtable pointer from the object to the internal class
This saves one pointer per object, and willmake other optimizations
easier in the future.

Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-12-04 09:45:45 +01:00
Friedemann Kleint f4c91ae691 Fix MSVC-64-warnings about truncation of integers.
Change-Id: Ib92ce4b7e42061bb1892957f04cbfc1fcfe43615
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-26 09:48:10 +01:00
Friedemann Kleint 93304429cf Fix MSVC-64-warning about shift word size.
jsruntime\qv4mm.cpp(301) : warning C4334: '<<' : result of 32-bit shift
implicitly converted to 64 bits (was 64-bit shift intended?).

Change-Id: I6a4ca024d43776e16a323fdb8c35a339b74e6c09
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-26 09:46:20 +01:00
Lars Knoll bf173fe5da Turn execution contexts into Managed objects
This finally gives proper memory management for ExecutionContexts.
So far they had been garbage collected but where still allocated
using standard malloc/free(). This allows us to collect the
contexts faster and speed up context creation.

Change-Id: I02e642391d55eaa59ab3f4c2720a2ac71259caf4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-22 14:54:33 +01:00
Lars Knoll 855784e5a7 Add support for large items to the memory manager
This is required, so we can track ExecutionContexts
through the regular memory manager.

Change-Id: I1bd2e2ef275e6e9e1f364a35affbb991f4377b05
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-22 14:54:14 +01:00
Sérgio Martins d2c958199f Initialize variables before using them.
Change-Id: I7cd5a17259814b3f2405b63d7f4d2a0fd30cae4d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-06 16:55:09 +01:00
Andrew Knight eeabbf5548 Fix build on WinRT
Disable JIT and avoid unsupported functions under WinRT.
Also add MSVC's ARM flag to the double conversion white list.

Change-Id: I22ec340a20b113fdeefb802ac61812f78a527895
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-06 09:07:08 +01:00
Lars Knoll cb7948caec Don't run the GC too often
Some test cases were badly trashing the GC, running it
way too often. Fix this by only running the GC after
we allocated more than 50% of the amount of available
items.

Change-Id: Icfe6d0730552ef2298963de706213ebc9e3e342c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-05 22:23:25 +01:00
Lars Knoll 025365f1dc Refactor marking GC'ed objects
Don't use recursive function calls anymore. Instead, push marked
objects onto the JS stack, and then pop them off when their children
are being marked.

Should reduce stack memory usage, and improves performance by ~5%.

Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-11-05 18:54:51 +01:00
Lars Knoll f0eaaef4ae Some minor optimizations
Change-Id: Ib2e08e7c89ca59a48f8fd52b30981e5d7e60803b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-19 14:59:02 +02:00
Lars Knoll ad7f91c59a Turn on exact garbage collection by default
Keep conservative GC as a fallback for testing
Enable all tests again that were skipped due to
GC issues.

Change-Id: I8e0fa728207bdd39a96d0acf95e27841157d8402
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-16 06:36:47 +02:00
Lars Knoll e20253ed7a Remove debug output
The output messes up some auto tests

Change-Id: I9b9b2b4fdf023bc9953939b814872e860c84f484
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-15 20:57:37 +02:00
Lars Knoll 40db24351b Smaller cleanups
Change-Id: I0a7eee96ef7c92ad4a3c5963010e3ac66fe6ed3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-11 08:56:26 +02:00
Kai Koehne e34477bfaf Use common prefix for environment variable
Change-Id: Idbbdcad42106d30451000fc6593428a0bac4bc04
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-10-09 15:11:11 +02:00
Lars Knoll ac8afca822 Remove some more uses of QV4::Value
All remaining uses should be GC safe now.

Change-Id: I05c962de6ab896f108f70caa1bf937a24e67bfe1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-10-02 16:07:33 +02:00
Lars Knoll cf2a253f2f Move Value::fromBool, ... to a new Primitive class
This will simplify finding the remaining direct usages of
QV4::Value that need fixing.

Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-28 13:33:24 +02:00
Lars Knoll 74807c0725 Move more API over to use ValueRef
Change-Id: I372f1f3e3e78d45912a913f437e622e0acfc9646
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-26 09:05:32 +02:00
Sérgio Martins 6bb0b40083 wince: Build fix, NtCurrentTeb() is not available in this platform.
This was copied from qtscript's:
src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp

Change-Id: Iaa5549e6915aa4aa4bf532fbe7c9117a0858ff02
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-25 13:18:33 +02:00
Lars Knoll 47bf40dd49 Prevent objects from being collected while in their constructor
While objects are being constructed, we don't have a reference to them
on the JS stack yet. So the constructor needs to protect itself against
being collected by putting the this object onto the JS stack.

Added an environment switch MM_EXACT_GC to test exact garbage
collection.

Change-Id: Ie37665a954de800359c272ffbebbe1488e7a8ace
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-22 01:06:20 +02:00
Lars Knoll e441692b0b Further work towards an exact GC
Add some more convenience in the helper classes
in qscopedvalue_p.h
Make accesses to CallData safer, and change
ExecutionEngine::newObject() to return a safe
pointer.

Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-22 01:06:20 +02:00
Giuseppe D'Angelo 13e7ffd5c2 Remove qLowerBound usages from declarative
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I85df32525af0c5706c631555a06b66ef3484d797
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-13 01:10:51 +02:00
Giuseppe D'Angelo 4df73e62a7 Remove qSort usages from declarative
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I8fa7d0186cc8f0ba562695974829e37f1eb87f2f
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-13 01:10:37 +02:00
Lars Knoll 1986cf68d0 Create a stack for JS values and use it in the interpreter
First step towards being able to do an exact GC.

Create a stack for JS Values that is separate from the C++
stack.

Use the stack for generated methods (masm and moth).

Change-Id: I80ac0e5b5d86439dda5e9ea2b21fa0c57d8aef22
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-11 13:01:44 +02:00
Simon Hausmann e04cadca4a Fix compilation with MSVC 2008 (and prospective Windows CE build fix)
* Only 2010 and newer ship stdint.h, so for 2008 we have to provide a little
stdint.h compat header, for some of the third-party code we import. Our own
Qt code this patch changes to use quint* types instead.

* Include math.h and float.h for some math functions.

* disable the JIT on Windows CE for now.

* Change use of intptr_t to qintptr in Qt code. intptr_t is in inttypes.h,
  except that with VS 2008 it is indirectly available through stdio.h. Let's
  avoid the mess and just use the qt type, that's always available.

Change-Id: I19055edd89e0a6b147d9edbb3b711798ed3c05a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-08-22 04:24:00 +02:00
Lars Knoll 3288b87e2f Restructure source code
Move the v4 engine classes from a subdir of qml/qml into
two subdirs (compiler and jsruntime) of the qml module
Remove an unsued qv4syntaxchecker class, and move
the moth code directly into compiler.

Change-Id: I6929bede1f25098e6cb2e68087e779fac16b0c68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-08-08 12:22:30 +02:00