diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-01-31 13:25:09 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 08:58:31 +0000 |
commit | 518e258d59adc976e2e8aa9a7f9ef36d8b8cdb66 (patch) | |
tree | 33b90cb45ebfa4cb6767db85caaafcf6ac83d404 /src/qml/jsruntime | |
parent | 8b3cbc4403e3eac286613691c11aa1ded588da59 (diff) |
Make every member of a Heap object aware of its offset inside the object
This will allow adding a write barrier to those fields with manageable
effort.
Change-Id: I7d06d7ffccbcefe66e2524c64c962353c91c2766
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4global_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 5 |
6 files changed, 11 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index ccea1dbc80..f544821729 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -171,7 +171,7 @@ V4_ASSERT_IS_TRIVIAL(GlobalContext) #define CatchContextMembers(class, Member) \ Member(class, Pointer, String *, exceptionVarName) \ - Member(class, Value, Value, exceptionValue) + Member(class, HeapValue, HeapValue, exceptionValue) DECLARE_HEAP_OBJECT(CatchContext, ExecutionContext) { DECLARE_MARK_TABLE(CatchContext); diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 1fc40e6ff6..c7dac7d3e5 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -123,7 +123,7 @@ struct ScriptFunction : FunctionObject { #define BoundFunctionMembers(class, Member) \ Member(class, Pointer, FunctionObject *, target) \ - Member(class, Value, Value, boundThis) \ + Member(class, HeapValue, HeapValue, boundThis) \ Member(class, Pointer, MemberData *, boundArgs) DECLARE_HEAP_OBJECT(BoundFunction, FunctionObject) { diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index ea3e1d750e..cd8fb91f7a 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -199,6 +199,7 @@ struct ScriptFunction; struct InternalClass; struct Property; struct Value; +template<size_t> struct HeapValue; template<size_t> struct ValueArray; struct Lookup; struct ArrayData; diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 5b43710c03..63b132c2e6 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -82,6 +82,8 @@ DECLARE_HEAP_OBJECT(Object, Base) { Value *propertyData(uint index) { return memberData->values.v + index; } }; +Q_STATIC_ASSERT(Object::markTable == ((2 << 4) | (2 << 6) | (2 << 8))); + } #define V4_OBJECT(superClass) \ diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index b429524b71..c2eeb32b88 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -86,7 +86,7 @@ DECLARE_HEAP_OBJECT(RegExpObject, Object) { }; #define RegExpCtorMembers(class, Member) \ - Member(class, Value, Value, lastMatch) \ + Member(class, HeapValue, HeapValue, lastMatch) \ Member(class, Pointer, String *, lastInput) \ Member(class, NoMark, int, lastMatchStart) \ Member(class, NoMark, int, lastMatchEnd) diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 771d28dce8..3d7776b736 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -709,6 +709,11 @@ inline unsigned int Value::toUInt32() const } template <size_t offset> +struct HeapValue : Value { + HeapValue &operator = (const Value &other) { setRawValue(other.rawValue()); return *this; } +}; + +template <size_t offset> struct ValueArray { uint size; uint alloc; |