diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-02 17:11:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-05 22:23:25 +0100 |
commit | 26db9863f18d7f7e89cec88b720e4fb4c674dd5b (patch) | |
tree | fe5443f04e6c6adf47ac45e2e46b7c3965faf08a /src/qml/compiler/qv4isel_masm.cpp | |
parent | 4ffa7d3f651757b7bc10ae9801b7802a8f2e260f (diff) |
Optimise string additions
Small optimisation for string additions, also add one more check
for exceptions in the code where required.
Change-Id: I6c14bc88ea5d03f7eeed0e0168c5195f9f823693
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 | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index e33d3fdaf9..ff6fed2f30 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -1446,7 +1446,7 @@ Assembler::Jump InstructionSelection::genInlineBinop(V4IR::AluOp oper, V4IR::Exp void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target) { - if (oper != V4IR:: OpMod + if (oper != V4IR::OpMod && leftSource->type == V4IR::DoubleType && rightSource->type == V4IR::DoubleType && isPregOrConst(leftSource) && isPregOrConst(rightSource)) { doubleBinop(oper, leftSource, rightSource, target); @@ -1462,7 +1462,14 @@ void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR: done = genInlineBinop(oper, leftSource, rightSource, target); // TODO: inline var===null and var!==null - const Assembler::BinaryOperationInfo& info = Assembler::binaryOperation(oper); + Assembler::BinaryOperationInfo info = Assembler::binaryOperation(oper); + + if (oper == V4IR::OpAdd && + (leftSource->type == V4IR::StringType || rightSource->type == V4IR::StringType)) { + const Assembler::BinaryOperationInfo stringAdd = OPCONTEXT(__qmljs_add_string); + info = stringAdd; + } + if (info.fallbackImplementation) { _as->generateFunctionCallImp(target, info.name, info.fallbackImplementation, Assembler::PointerToValue(leftSource), |