diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-01-24 12:07:33 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 08:58:04 +0000 |
commit | 6b4b2f5f1bbd706742cbab8764a1d07cbd912600 (patch) | |
tree | d11734823cbf27c557fea8b9be5225c1303d7b12 /src/qml/jsruntime/qv4object_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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 0d17afbf41..b0eec1adfc 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -67,17 +67,19 @@ struct BuiltinFunction; namespace Heap { -struct Object : Base { +#define ObjectMembers(class, Member) \ + Member(class, InternalClass *, internalClass) \ + Member(class, Pointer<Object>, prototype) \ + Member(class, Pointer<MemberData>, memberData) \ + Member(class, Pointer<ArrayData>, arrayData) + +DECLARE_HEAP_OBJECT(Object, Base) { + DECLARE_MARK_TABLE(Object); void init() { Base::init(); } void destroy() { Base::destroy(); } const Value *propertyData(uint index) const { return memberData->data + index; } Value *propertyData(uint index) { return memberData->data + index; } - - InternalClass *internalClass; - Pointer<Object> prototype; - Pointer<MemberData> memberData; - Pointer<ArrayData> arrayData; }; } @@ -114,7 +116,8 @@ struct Object : Base { dptr->_checkIsInitialized(); \ return dptr; \ } \ - V4_ASSERT_IS_TRIVIAL(QV4::Heap::DataClass); + V4_ASSERT_IS_TRIVIAL(QV4::Heap::DataClass); \ + static Q_CONSTEXPR quint64 markTable = QV4::Heap::DataClass::markTable; #define V4_INTERNALCLASS(c) \ static QV4::InternalClass *defaultInternalClass(QV4::ExecutionEngine *e) \ @@ -400,7 +403,6 @@ public: inline void call(Scope &scope, CallData *d) const { vtable()->call(this, scope, d); } protected: - static void markObjects(Heap::Base *that, ExecutionEngine *e); static void construct(const Managed *m, Scope &scope, CallData *); static void call(const Managed *m, Scope &scope, CallData *); static ReturnedValue get(const Managed *m, String *name, bool *hasProperty); |