aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4property_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-12-15 08:46:38 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-20 12:00:39 +0100
commit74c658bb631fd5bab433b9867ff2e568a56ec082 (patch)
treecf82000446c51064a2f8643fd5ffd74b0bcca668 /src/qml/jsruntime/qv4property_p.h
parent965fac4418bec7e7b3c84efd76f7803116fb9eac (diff)
Make Property uses GC safe
Change-Id: I5aa41a07a2d25e5c8a2d64bfa58a55fcd7aaf77e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4property_p.h')
-rw-r--r--src/qml/jsruntime/qv4property_p.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index 50d3c0e351..ddee264b0e 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -68,18 +68,18 @@ struct Property {
return pd;
}
- inline bool isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const;
- inline void merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs);
+ inline bool isSubset(const PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs) const;
+ inline void merge(PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs);
inline Heap::FunctionObject *getter() const { return value.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(value.heapObject()) : 0; }
inline Heap::FunctionObject *setter() const { return set.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(set.heapObject()) : 0; }
inline void setGetter(FunctionObject *g) { value = Primitive::fromManaged(reinterpret_cast<Managed *>(g)); }
inline void setSetter(FunctionObject *s) { set = s ? Primitive::fromManaged(reinterpret_cast<Managed *>(s)) : Value::fromHeapObject(0); }
- void copy(const Property &other, PropertyAttributes attrs) {
- value = other.value;
+ void copy(const Property *other, PropertyAttributes attrs) {
+ value = other->value;
if (attrs.isAccessor())
- set = other.set;
+ set = other->set;
}
explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); }
@@ -98,7 +98,7 @@ private:
Property &operator=(const Property &);
};
-inline bool Property::isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const
+inline bool Property::isSubset(const PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs) const
{
if (attrs.type() != PropertyAttributes::Generic && attrs.type() != otherAttrs.type())
return false;
@@ -108,18 +108,18 @@ inline bool Property::isSubset(const PropertyAttributes &attrs, const Property &
return false;
if (attrs.hasWritable() && attrs.isWritable() != otherAttrs.isWritable())
return false;
- if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other.value))
+ if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other->value))
return false;
if (attrs.type() == PropertyAttributes::Accessor) {
- if (value.heapObject() != other.value.heapObject())
+ if (value.heapObject() != other->value.heapObject())
return false;
- if (set.heapObject() != other.set.heapObject())
+ if (set.heapObject() != other->set.heapObject())
return false;
}
return true;
}
-inline void Property::merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs)
+inline void Property::merge(PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs)
{
if (otherAttrs.hasEnumerable())
attrs.setEnumerable(otherAttrs.isEnumerable());
@@ -129,13 +129,13 @@ inline void Property::merge(PropertyAttributes &attrs, const Property &other, Pr
attrs.setWritable(otherAttrs.isWritable());
if (otherAttrs.type() == PropertyAttributes::Accessor) {
attrs.setType(PropertyAttributes::Accessor);
- if (!other.value.isEmpty())
- value = other.value;
- if (!other.set.isEmpty())
- set = other.set;
+ if (!other->value.isEmpty())
+ value = other->value;
+ if (!other->set.isEmpty())
+ set = other->set;
} else if (otherAttrs.type() == PropertyAttributes::Data){
attrs.setType(PropertyAttributes::Data);
- value = other.value;
+ value = other->value;
}
}