Commit Graph

260 Commits

Author SHA1 Message Date
Lars Knoll 13edffa303 Move remaining objects to new constructor syntax
Also disable the old way of constructing objects.

Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:13 +00:00
Lars Knoll 2a8de9d8d8 Convert FunctionObjects to new allocation syntax
Change-Id: I269c20abdc7f9eb0d71a2d2d485d622b65405762
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:09 +00:00
Lars Knoll b3cdc48914 Simplify new construction scheme
Declare the default prototype and internal class
in the class itself.

Change-Id: I08c2b42aa61a886580061336ae60cef8dedc0f03
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:07 +00:00
Lars Knoll 6190b10d1c move error objects over to new construction scheme
Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:04 +00:00
Lars Knoll d7e535e99b Convert variant object and ObjectProto
Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:01 +00:00
Lars Knoll 9420eb5c4e Use the new construction scheme for RegExpObjects
Gives around 10% speed improvement on the v8 regexp
benchmark.

Change-Id: Iad37bcbc79ccbfb92f65852b660364c919862a75
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:19:59 +00:00
Lars Knoll 17a0c271e0 Move more objects over to the new allocation scheme
Change-Id: I0241efe10d115f8e4a646f840e47e220eb6cfc18
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:19:56 +00:00
Lars Knoll 833c99db20 Inline property data into the object
Append the part of the objects property data that is
known ad instantiation time to the object itself and
by that avoid creating a separate MemberData. Saves
some memory and should speed up object creation.

Currently implemented only for Object and ArrayObject.

Change-Id: I7693bf2f3a28fb718522398ebb94ac115e021fa4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:19:53 +00:00
Lars Knoll fb52dab6b4 Further cleanups
Reduce usage of ScopedContext.

Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 19:12:40 +00:00
Lars Knoll f3efdebc34 Fix typo
Change-Id: I9bfc96096ec5e2c8bd4d3c5bad13fc78ae657962
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:28 +00:00
Lars Knoll 830376c962 Rename currentExecutionContext to currentContext
Now that the other method is gone, let's use
the shorter currentContext

Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:26 +00:00
Lars Knoll 0e6195a85c Cleanup usage of ExecutionEngine::currentContext
Change-Id: Ic79d6da162375928ec25871cd0341daeab6483d2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:22 +00:00
Lars Knoll 3a8d6123d1 Store the stack of executioncontext's on the JS stack
This saves one pointer per allocated execution context.
Now every execution context that is pushed, allocates two
Values on the js stack. One contains the context itself, the
other one the offset to the parent context.

Things are a bit tricky for with and catch scopes, as those
are called from the generated code, and can't open a Scope
anymore. In addition, all methods iterating over the js
stack frames need to work with ExecutionContext pointers,
not ScopedContext's.

Change-Id: I6f3013749d4e73d2fac37973b976ba6029686b82
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:16 +00:00
Lars Knoll fb059f697a Reduce usage of context->parent
Change-Id: I31bb8019783311a7e6065e2aac7fec67c1120ebf
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:14 +00:00
Lars Knoll cedd732794 Explicitly push/pop ExecutionContexts
Avoid the implicit push inside the execution context constructor
and rather make this explicit in the code.

Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:11 +00:00
Lars Knoll b5902bd43a Get rid of the qmlContextObject method
Change-Id: Id8c0d9e15dd85b3818e283ab6769a49bb2e6d0f7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:06 +00:00
Lars Knoll ad55f5fd24 Move the qmlSingletonWrapper method out of the contextwrapper
One more step towards removing the class alltogether.

Change-Id: Ic9f6794eb3c5c6605ee43ad23a6d432ebbf321a1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-20 20:01:25 +00:00
Ulf Hermann eb30e3d7ee Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	src/qml/debugger/qv4debugservice.cpp
	src/qml/jsruntime/qv4value_inl_p.h
	src/qml/jsruntime/qv4value_p.h
	src/qml/memory/qv4mm.cpp
	src/qml/memory/qv4mm_p.h
	src/qml/qml/qqmlnotifier_p.h
	src/qml/qml/qqmlproperty.cpp
	src/quick/items/qquickflickable.cpp
	src/quick/items/qquicktextedit.cpp
	tests/auto/quick/qquickwindow/BLACKLIST

The extra changes in qqmlbinding.cpp are ported from changes to
qqmlproperty.cpp that occurred in parallel with writeBinding() being
moved to qqmlbinding.cpp.

Change-Id: I16d1920abf448c29a01822256f52153651a56356
2015-08-18 10:29:47 +02:00
Lars Knoll 415f55d140 Encapsulate and protect all accesses to the vtable of Heap objects
This is required, so we can safely access the vtable even while
we're marking objects during GC.

Change-Id: I34f56b61b4bca0d0742faf607eb5ab8b2c30685e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 07:24:32 +00:00
Lars Knoll b288956817 Use the QmlContext to access properties of the scope object
Add some runtime methods to access properties of the scope
object directly (using the QmlContext), and generate proper
code to call those.

Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 01:21:57 +00:00
Lars Knoll 416c0f3263 Add ability to retrieve and use the QmlContext from our generated code
Our generated code (JIT and interpreter) should operate on the
QML context to retrieve QML related things. That's better than
operating on 4 different temps.

So this commit introduces the QML context as a temp in the
code we generate for QML. The next commits will move things over
to use that context with specialized runtime methods instead of
using generic subscript/get calls on the different subobjects.

Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 01:21:48 +00:00
Friedemann Kleint 7da45b21b7 Fix warning about returning address of local variable by MSVC2015 in qv4engine.cpp.
qtdeclarative\src\qml\jsruntime\qv4engine.cpp(179) : warning C4172: returning address of local variable or temporary: dummy

Disable warning as using the address is intended.

Change-Id: Ide894a8dc2fb94f11d0455723c46567c84d91f8d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-17 13:44:21 +00:00
Erik Verbruggen c749f37c83 V4: track C++ heap usage for Strings in the MemoryManager
... and do a GC run when it exceeds a threshold. The issue with Strings
is that they hold on to QString instances that store the real content.
However, the GC only sees the light-weight JS handle, and doesn't take
the size of the backing content into account. So it could happen that
big QStrings accumulate in the heap as long as the GC didn't reach its
threshold.

The newly introduced unmanaged heap threshold is upped by a factor of
two when exceeded, and lowered by a factor of 2 when the used heap space
falls below a quarter of the threshold. Also grow the threshold if there
is enough space after running the GC, but another GC run would be
triggered for the next allocation.

There is a special case for Heap::String::append, because this method
will copy the data from the left and right substrings into a new
QString. To track this, append notifies the memory manager directly of
the new length. The pointer to the memory manager is stored in
Heap::String, growing it from 40 bytes to 48 bytes (which makes it still
fit in the same bucket, so no extra memory is allocated).

Task-number: QTBUG-42002
Change-Id: I71313915e593a9908a2b227b0bc4d768e375ee17
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-10 13:52:18 +00:00
Thiago Macieira f35be0bc5a QtQml: Fix const correctness in old style casts
Found with GCC's -Wcast-qual.

Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-09 00:12:37 +00:00
Lars Knoll 5f162e17ed Cleanup retrieval of scope and context objects
Change-Id: I9c6174181f950bc4f829727dc6acdfe82fa4e894
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-18 18:24:34 +00:00
Lars Knoll f077bf13ef Clean up ExecutionContext's for QML
Create a specialized QmlContext instead of re-using
a call context with a QQmlContextWrapper as activation
object.

This saves some memory and opens up the route to getting
rid of the context wrapper in a future commit.

Change-Id: I1591c73932a08564fddf5137ac05bbc6f31dd4d5
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-18 16:42:58 +00:00
Lars Knoll 64199b0a58 Store a Heap::String pointer in StringObject
Change-Id: I926c5bb2dd4f1613af6737d4200e568f0ec13d58
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-17 09:03:48 +00:00
Lars Knoll a914b18667 Store rootcontext in a GC safe way
Change-Id: If81d638c0ccd2b34df918ae5055e309f4eae031f
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-17 07:40:03 +00:00
Lars Knoll 73093cbe4b Fix some function signatures
Add a const several places and pass values by pointer, not
reference. This allows us to also get rid of some Scope's.

Change-Id: I3b4c29c22511c947d024457e7b8fa2aaa6bec55d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-15 17:03:21 +00:00
Lars Knoll f468f71571 Get rid of qv4qmlextensions
It only contained the proto for the value type wrapper. Instead
just create it lazily, but reserve space on the js stack for it.

Change-Id: I2301549b6dc4007bd5ac848e1dca25aafd583c4a
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-15 15:27:06 +00:00
Lars Knoll d32849dbe7 Remove explicit marking of the typedarray constructors
These objects live on the JS stack and are thus marked implicitly.

Change-Id: I8295d8096d0a47861e0092c36e16b95db458de3c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-10 15:01:29 +00:00
Lars Knoll 864988474a Move the StringValue members of ExecutionEngine onto the JS stack
Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-10 15:01:17 +00:00
Simon Hausmann 9556f6d075 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/qml/jsruntime/qv4engine_p.h
	src/quick/items/qquickitemsmodule.cpp
	src/quick/items/qquicktext.cpp
	src/quick/util/qquickpixmapcache.cpp
	tests/auto/quick/qquickwindow/tst_qquickwindow.cpp

Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
2015-06-04 10:28:48 +02:00
Aleix Pol dad48f0e9c Makes it possible to extract all data from a QML DropArea
There's many types that aren't being covered by DropArea API, such as
images. getDataAsString is not acceptable, since fromUtf8 chokes on
reading non-utf8.
This patch introduces getDataAsArrayBuffer method that won't try to convert
the data into a QString and simply pass a QV4::ArrayBuffer, that internally
keeps a QByteArray.

Change-Id: I65411b3d365ee6c5e13effd9167156771ee08a05
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-23 13:52:36 +00:00
Simon Hausmann bf935a5359 Fix MSVC warning about unused variable
Change-Id: I9b2f21dd7cfc82a9da9aa3e4c60d47fa07fdceaf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-05-19 10:53:32 +00:00
Kai Koehne 2cb2c8f9e1 MSVC: Fix compiler warning
Fix compiler warning introduced in commit  d76921e3082cd31:

jsruntime\qv4engine.cpp(1626) : warning C4100: 'v' : unreferenced formal parameter

Change-Id: I1f2b74f8e3fb14019f6e28b407d0336b0812c573
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-05-19 07:40:02 +00:00
Erik Verbruggen d76921e308 QML: fix mixed debug/release build on OSX.
Dyld will take the debug library and link it against the release
versions of the frameworks. (Using the debug versions is an option to
dyld when starting an application.) This requires all symbols in both
debug and release libraries in frameworks to be the same.

Change-Id: I6d96bcdf8577f1dffc63c508cb7adc0db2acc486
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-12 08:49:09 +00:00
Simon Hausmann a690648c21 Add protection against "wrong" marking in debug builds
To protect against situations where we accidentally mark an object that belongs
to a different engine - there are many possible entry points - this patch adds
an assertion in debug builds for this situation. When it happens, it will point
more or less directly to the code that tries to push an object to the wrong JS
stack for marking. This helped in the investigation of QTBUG-44895

Change-Id: I311b9ff6d282d52e725044b03a62cd77085536be
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-05-08 14:55:32 +00:00
Simon Hausmann 94db5de2ac Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	tests/auto/quick/qquicktext/tst_qquicktext.cpp

Change-Id: I075e742da8396a268d97d3ab34bcd9e0c0cf001f
2015-04-28 14:29:59 +02:00
Simon Hausmann e2447f9f5f Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
	.qmake.conf
	tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp

Change-Id: I715b8a78b74cbe0dcaf599367fd6e08af4858e11
2015-04-27 14:40:00 +02:00
Lars Knoll 590c23b23c Move evalfunction and thrower onto the js stack
Change-Id: I3a0abe13d802aff8998d1c64f86b5a8f98c8335f
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:21:43 +00:00
Lars Knoll 1af88df072 Move constructor objects onto the js stack
Change-Id: I828c5f7407d90cd5df1a8fd89a0ca35074fbde43
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:21:36 +00:00
Lars Knoll f9440c704e Move more objects from the v4 engine to the js stack
Convert most of the prototype objects in the v4 engine.

Change-Id: I365f290493c20973bc991b6a383649836e42a16a
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:21:28 +00:00
Lars Knoll 7501c394d0 Continue the work to move Values inside the v4 engine to the js stack
Started with objectPrototype, the next commits will move more
of them over into the new data structure.

Change-Id: I1a048e95149ce69e4e42094db2dd738ce49b50b8
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:21:20 +00:00
Lars Knoll 0d54025cd2 Move exceptionValue and globalObject from the Engine onto the JS stack
We'll need to move all GC'ed objects currently stored in ExecutionEngine
onto the JS stack for easier management in a new garbage collection
scheme. This is the start of that change.

Change-Id: Ib3ad8e846875dade8a807ea79f063173d40e4aad
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:21:08 +00:00
Lars Knoll 0a499043fb Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.h
This is a cleaner separation and further reduces include dependencies
in the definitions of our basic data structured.

Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-24 15:20:43 +00:00
Liang Qi 07782f48f4 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/qml/qml/qqmlbinding.cpp
	src/qml/jsruntime/qv4arraybuffer.cpp
	src/qml/jsruntime/qv4functionobject.cpp

Change-Id: Ic752e9dfd69b282093651c9234c110a49762f06d
2015-04-22 15:32:19 +02:00
Lars Knoll 484abc8159 Get rid of asFunctionObject()
Change-Id: Ib4858376dc0ec57fa473c80696abc66a570c90ec
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-21 13:01:54 +00:00
Lars Knoll b4cb71e9d7 More cleanups
Get rid of Value::asObject(), and pass const Managed pointers
into some more vtable methods.

Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-21 13:01:47 +00:00
Rolf Eike Beer 9934c075c7 QML: do not check stack size if stack grows up
On architectures where the stack grows upwards (i.e. HP PA-RISC) the
stack limit calculation fails because the variables used to check the
offset are usually close to the bottom of the stack, which is in this
case the origin of the stack grows. Since these machines are a rare
obscurity simply assume that everything is fine on these machines. The
few people that are indeed running QML on such machines will probably
be able configure their stack size properly by default.

Task-number: QTBUG-44268
Change-Id: Ia83a39179a0f6e0602ba7a5032d386e12d8d1ba3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-21 08:52:06 +00:00