diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-11-07 16:41:55 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-14 21:46:35 +0000 |
commit | 557ea845157d4f6b757ec2eebbc71e1af9910cc6 (patch) | |
tree | 0bcd57be6aefcf6b53dde515a0ac1523b55c6fba | |
parent | d1e2c75559e2fde61f9ec55d93b5730d8e11e8be (diff) |
V4: Get rid of Reference::This and treat it as a stack slot
This actually generates better code, for example for 'this.x'.
Previously:
LoadReg (this)
GetLookupA acc(0)
Now:
GetLookup (this)(0)
Change-Id: I7e4125d3dff707e9af9691f8b00c5c398087e395
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 11 | ||||
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 5 |
2 files changed, 2 insertions, 14 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 3cee80e977..04d16d412e 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -3073,8 +3073,6 @@ Codegen::Reference &Codegen::Reference::operator =(const Reference &other) qmlNotifyIndex = other.qmlNotifyIndex; captureRequired = other.captureRequired; break; - case This: - break; } // keep loaded reference @@ -3111,8 +3109,6 @@ bool Codegen::Reference::operator==(const Codegen::Reference &other) const case QmlContextObject: return qmlCoreIndex == other.qmlCoreIndex && qmlNotifyIndex == other.qmlNotifyIndex && captureRequired == other.captureRequired; - case This: - return true; } return true; } @@ -3218,7 +3214,6 @@ bool Codegen::Reference::storeWipesAccumulator() const switch (type) { default: case Invalid: - case This: case Const: case Accumulator: Q_UNREACHABLE(); @@ -3303,7 +3298,6 @@ void Codegen::Reference::storeAccumulator() const case Invalid: case Accumulator: case Const: - case This: break; } @@ -3457,11 +3451,6 @@ QT_WARNING_POP if (!captureRequired) codegen->_context->contextObjectPropertyDependencies.insert(qmlCoreIndex, qmlNotifyIndex); } return; - case This: { - Instruction::LoadReg load; - load.reg = Moth::StackSlot::createRegister(CallData::This); - codegen->bytecodeGenerator->addInstruction(load); - } return; case Invalid: break; } diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 89c887d46d..dba9388292 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -184,8 +184,7 @@ public: QmlScopeObject, QmlContextObject, LastLValue = QmlContextObject, - Const, - This + Const } type = Invalid; bool isLValue() const { return !isReadonly; } @@ -284,7 +283,7 @@ public: return r; } static Reference fromThis(Codegen *cg) { - Reference r(cg, This); + Reference r = fromStackSlot(cg, CallData::This); r.isReadonly = true; return r; } |