aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-09-18 10:33:35 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2018-10-07 12:42:40 +0000
commit2bcfb322df727abf96022830077d4ae8b30f644d (patch)
tree08a53f19407f5b58694c41d217d4ab959986d4f0
parent28521e3585c0290ff1ef5cd21fa81d308ddf3f44 (diff)
Make Codegen::Reference movable
This removes the call to Reference::operator= and allows the constructor and assignment to be inlined. Change-Id: I173ae47127cc5c939300c1178c4c8637882f1c49 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4codegen.cpp64
-rw-r--r--src/qml/compiler/qv4codegen_p.h7
2 files changed, 4 insertions, 67 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index a90dca4884..321cf21c54 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3965,70 +3965,6 @@ void Codegen::RValue::loadInAccumulator() const
}
-Codegen::Reference::Reference(const Codegen::Reference &other)
-{
- *this = other;
-}
-
-Codegen::Reference &Codegen::Reference::operator =(const Reference &other)
-{
- type = other.type;
-
- switch (type) {
- case Invalid:
- case Accumulator:
- break;
- case Super:
- break;
- case SuperProperty:
- property = other.property;
- break;
- case StackSlot:
- theStackSlot = other.theStackSlot;
- break;
- case ScopedLocal:
- index = other.index;
- scope = other.scope;
- break;
- case Name:
- // name is always copied
- break;
- case Member:
- propertyBase = other.propertyBase;
- propertyNameIndex = other.propertyNameIndex;
- break;
- case Subscript:
- elementBase = other.elementBase;
- elementSubscript = other.elementSubscript;
- break;
- case Import:
- index = other.index;
- break;
- case Const:
- constant = other.constant;
- break;
- case QmlScopeObject:
- case QmlContextObject:
- qmlBase = other.qmlBase;
- qmlCoreIndex = other.qmlCoreIndex;
- qmlNotifyIndex = other.qmlNotifyIndex;
- capturePolicy = other.capturePolicy;
- break;
- }
-
- // keep loaded reference
- isArgOrEval = other.isArgOrEval;
- codegen = other.codegen;
- isReadonly = other.isReadonly;
- isReferenceToConst = other.isReferenceToConst;
- name = other.name;
- requiresTDZCheck = other.requiresTDZCheck;
- stackSlotIsLocalOrArgument = other.stackSlotIsLocalOrArgument;
- isVolatile = other.isVolatile;
- global = other.global;
- return *this;
-}
-
bool Codegen::Reference::operator==(const Codegen::Reference &other) const
{
if (type != other.type)
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index afcc1b67ad..c25e386131 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -194,9 +194,10 @@ public:
Reference(Codegen *cg, Type type = Invalid) : type(type), codegen(cg) {}
Reference() {}
- Reference(const Reference &other);
-
- Reference &operator =(const Reference &other);
+ Reference(const Reference &) = default;
+ Reference(Reference &&) = default;
+ Reference &operator =(const Reference &) = default;
+ Reference &operator =(Reference &&) = default;
bool operator==(const Reference &other) const;
bool operator!=(const Reference &other) const