diff options
author | Lars Knoll <[email protected]> | 2017-01-24 12:07:33 +0100 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2017-03-09 08:58:04 +0000 |
commit | 6b4b2f5f1bbd706742cbab8764a1d07cbd912600 (patch) | |
tree | d11734823cbf27c557fea8b9be5225c1303d7b12 /src/qml/jsruntime/qv4functionobject_p.h | |
parent | 78dd18a0cd18449e1289e428ea6eca65e28fb114 (diff) |
New mark table implementation
Automatically generate a table containing the data where JS Values
and pointers are in objects in the JS heap.
This will allow making the GC mark phase a lot more efficient.
A bit of a special hack is currently required for MemberData and
ArrayData, as they have a variable length, and we need to read the
size from the object.
We keep backwards compatibility with the old markObjects() functions
for now (calling them if they are defined). Some further work on
QV4::String and in a few other places is required before we can get
remove the compatibility.
Change-Id: I78528ace67e886bdbe4a4330c9677c7fc9f08a33
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 45d7485f1b..083ff4343b 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -65,7 +65,12 @@ struct BuiltinFunction; namespace Heap { -struct Q_QML_PRIVATE_EXPORT FunctionObject : Object { +#define FunctionObjectMembers(class, Member) \ + Member(class, Pointer<ExecutionContext>, scope) \ + Member(class, Function *, function) + +DECLARE_HEAP_OBJECT(FunctionObject, Object) { + DECLARE_MARK_TABLE(FunctionObject); enum { Index_Prototype = 0, Index_ProtoConstructor = 0 @@ -82,9 +87,6 @@ struct Q_QML_PRIVATE_EXPORT FunctionObject : Object { bool needsActivation() const { return function ? function->needsActivation() : false; } const QV4::Object *protoProperty() const { return propertyData(Index_Prototype)->cast<QV4::Object>(); } - - Pointer<ExecutionContext> scope; - Function *function; }; struct FunctionCtor : FunctionObject { @@ -119,11 +121,15 @@ struct ScriptFunction : FunctionObject { void init(QV4::ExecutionContext *scope, Function *function); }; -struct BoundFunction : FunctionObject { +#define BoundFunctionMembers(class, Member) \ + Member(class, Pointer<FunctionObject>, target) \ + Member(class, Value, boundThis) \ + Member(class, Pointer<MemberData>, boundArgs) + +DECLARE_HEAP_OBJECT(BoundFunction, FunctionObject) { + DECLARE_MARK_TABLE(BoundFunction); + void init(QV4::ExecutionContext *scope, QV4::FunctionObject *target, const Value &boundThis, QV4::MemberData *boundArgs); - Pointer<FunctionObject> target; - Value boundThis; - Pointer<MemberData> boundArgs; }; } @@ -160,8 +166,6 @@ struct Q_QML_EXPORT FunctionObject: Object { bool isBoundFunction() const; QQmlSourceLocation sourceLocation() const; - - static void markObjects(Heap::Base *that, ExecutionEngine *e); }; template<> @@ -259,8 +263,6 @@ struct BoundFunction: FunctionObject { static void construct(const Managed *, Scope &scope, CallData *d); static void call(const Managed *that, Scope &scope, CallData *dd); - - static void markObjects(Heap::Base *that, ExecutionEngine *e); }; } |