aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4codegen.cpp39
-rw-r--r--src/qml/jit/qv4binop.cpp1
2 files changed, 22 insertions, 18 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 7d3ad38f97..8d0126ebb3 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -73,6 +73,25 @@ static inline void setLocation(IR::Stmt *s, const SourceLocation &loc)
s->location = loc;
}
+static bool cjumpCanHandle(IR::AluOp op)
+{
+ switch (op) {
+ case IR::OpIn:
+ case IR::OpInstanceof:
+ case IR::OpEqual:
+ case IR::OpNotEqual:
+ case IR::OpGe:
+ case IR::OpGt:
+ case IR::OpLe:
+ case IR::OpLt:
+ case IR::OpStrictEqual:
+ case IR::OpStrictNotEqual:
+ return true;
+ default:
+ return false;
+ }
+}
+
Codegen::ScanFunctions::ScanFunctions(Codegen *cg, const QString &sourceCode, CompilationMode defaultProgramMode)
: _cg(cg)
, _sourceCode(sourceCode)
@@ -715,7 +734,7 @@ IR::Stmt *Codegen::cjump(IR::Expr *cond, IR::BasicBlock *iftrue, IR::BasicBlock
if (hasError)
return 0;
- if (! (cond->asTemp() || cond->asBinop())) {
+ if (! (cond->asTemp() || (cond->asBinop() && cjumpCanHandle(cond->asBinop()->op)) )) {
const unsigned t = _block->newTemp();
move(_block->TEMP(t), cond);
cond = _block->TEMP(t);
@@ -1281,14 +1300,7 @@ bool Codegen::visit(BinaryExpression *ast)
if (_expr.accept(cx)) {
setLocation(cjump(binop(IR::binaryOperator(ast->op), left, *right, ast->operatorToken), _expr.iftrue, _expr.iffalse), ast->operatorToken);
} else {
- IR::Expr *e = binop(IR::binaryOperator(ast->op), left, *right, ast->operatorToken);
- if (e->asConst() || e->asString())
- _expr.code = e;
- else {
- const unsigned t = _block->newTemp();
- setLocation(move(_block->TEMP(t), e), ast->operatorToken);
- _expr.code = _block->TEMP(t);
- }
+ _expr.code = binop(IR::binaryOperator(ast->op), left, *right, ast->operatorToken);
}
break;
}
@@ -1314,14 +1326,7 @@ bool Codegen::visit(BinaryExpression *ast)
if (hasError)
return false;
- IR::Expr *e = binop(IR::binaryOperator(ast->op), left, *right, ast->operatorToken);
- if (e->asConst() || e->asString())
- _expr.code = e;
- else {
- const unsigned t = _block->newTemp();
- setLocation(move(_block->TEMP(t), e), ast->operatorToken);
- _expr.code = _block->TEMP(t);
- }
+ _expr.code = binop(IR::binaryOperator(ast->op), left, *right, ast->operatorToken);
break;
}
diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp
index 6d20a4e042..22067bbb13 100644
--- a/src/qml/jit/qv4binop.cpp
+++ b/src/qml/jit/qv4binop.cpp
@@ -331,7 +331,6 @@ void Binop<JITAssembler>::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *ta
break;
default: {
- Q_ASSERT(target->type == IR::BoolType);
Jump trueCase = as->branchDouble(false, op, lhs, rhs);
as->storeBool(false, target);
Jump done = as->jump();