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/qv4regexpobject_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/qv4regexpobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject_p.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index c0c7dfa78a..6726568eec 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -73,21 +73,28 @@ namespace QV4 { namespace Heap { -struct RegExpObject : Object { +#define RegExpObjectMembers(class, Member) \ + Member(class, Pointer<RegExp>, value) \ + Member(class, bool, global) + +DECLARE_HEAP_OBJECT(RegExpObject, Object) { + DECLARE_MARK_TABLE(RegExpObject); + void init(); void init(QV4::RegExp *value, bool global); void init(const QRegExp &re); - - Pointer<RegExp> value; - bool global; }; -struct RegExpCtor : FunctionObject { +#define RegExpCtorMembers(class, Member) \ + Member(class, Value, lastMatch) \ + Member(class, Pointer<String>, lastInput) \ + Member(class, int, lastMatchStart) \ + Member(class, int, lastMatchEnd) + +DECLARE_HEAP_OBJECT(RegExpCtor, FunctionObject) { + DECLARE_MARK_TABLE(RegExpCtor); + void init(QV4::ExecutionContext *scope); - Value lastMatch; - Pointer<String> lastInput; - int lastMatchStart; - int lastMatchEnd; void clearLastMatch(); }; @@ -126,9 +133,6 @@ struct RegExpObject: Object { QString toString() const; QString source() const; uint flags() const; - -protected: - static void markObjects(Heap::Base *that, ExecutionEngine *e); }; struct RegExpCtor: FunctionObject @@ -142,7 +146,6 @@ struct RegExpCtor: FunctionObject static void construct(const Managed *m, Scope &scope, CallData *callData); static void call(const Managed *that, Scope &scope, CallData *callData); - static void markObjects(Heap::Base *that, ExecutionEngine *e); }; struct RegExpPrototype: RegExpObject |