diff options
| author | Lars Knoll <lars.knoll@digia.com> | 2014-02-09 20:09:10 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-22 16:47:46 +0100 |
| commit | 48b44dc163953d78338dc884316344c377afd41f (patch) | |
| tree | 11bfed7080e8bc8a5432b726b4f06c290beaba17 /src/qml/compiler/qv4isel_masm.cpp | |
| parent | 346382c36c2ac114ce3fab41545f5a8386838264 (diff) | |
Avoid some unneccesary instructions in swapValues
If source and target values are of the same type, there's no need
to write the type to the stack once again.
Change-Id: I3e1600407012f7bd7f2e5ba91b279b0421be9e68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_masm.cpp')
| -rw-r--r-- | src/qml/compiler/qv4isel_masm.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index b355969450..157cbd3634 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -1201,20 +1201,22 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target } else { _as->load32(addr, Assembler::ScratchRegister); _as->store32((Assembler::RegisterID) registerTemp->index, addr); - addr.offset += 4; - quint32 tag; - switch (registerTemp->type) { - case V4IR::BoolType: - tag = QV4::Value::_Boolean_Type; - break; - case V4IR::SInt32Type: - tag = QV4::Value::_Integer_Type; - break; - default: - tag = QV4::Value::Undefined_Type; - Q_UNREACHABLE(); + if (registerTemp->type != stackTemp->type) { + addr.offset += 4; + quint32 tag; + switch (registerTemp->type) { + case V4IR::BoolType: + tag = QV4::Value::_Boolean_Type; + break; + case V4IR::SInt32Type: + tag = QV4::Value::_Integer_Type; + break; + default: + tag = QV4::Value::Undefined_Type; + Q_UNREACHABLE(); + } + _as->store32(Assembler::TrustedImm32(tag), addr); } - _as->store32(Assembler::TrustedImm32(tag), addr); _as->move(Assembler::ScratchRegister, (Assembler::RegisterID) registerTemp->index); } } |
