aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h48
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp57
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp24
3 files changed, 129 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index f0b8983038..8dac616a2a 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -100,6 +100,12 @@ QT_BEGIN_NAMESPACE
F(Increment, increment) \
F(Decrement, decrement) \
F(Binop, binop) \
+ F(Add, add) \
+ F(BitAnd, bitAnd) \
+ F(BitOr, bitOr) \
+ F(BitXor, bitXor) \
+ F(Mul, mul) \
+ F(Sub, sub) \
F(BinopContext, binopContext) \
F(AddNumberParams, addNumberParams) \
F(MulNumberParams, mulNumberParams) \
@@ -474,6 +480,42 @@ union Instr
Param rhs;
Param result;
};
+ struct instr_add {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
+ struct instr_bitAnd {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
+ struct instr_bitOr {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
+ struct instr_bitXor {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
+ struct instr_mul {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
+ struct instr_sub {
+ MOTH_INSTR_HEADER
+ Param lhs;
+ Param rhs;
+ Param result;
+ };
struct instr_binopContext {
MOTH_INSTR_HEADER
QV4::BinOpContext alu;
@@ -560,6 +602,12 @@ union Instr
instr_increment increment;
instr_decrement decrement;
instr_binop binop;
+ instr_add add;
+ instr_bitAnd bitAnd;
+ instr_bitOr bitOr;
+ instr_bitXor bitXor;
+ instr_mul mul;
+ instr_sub sub;
instr_binopContext binopContext;
instr_addNumberParams addNumberParams;
instr_mulNumberParams mulNumberParams;
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 2db30aa7f8..cddfc0076b 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -560,6 +560,14 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::
return;
}
case V4IR::OpUPlus: {
+ if (isNumberType(sourceTemp)) {
+ // use a move
+ Instruction::Move move;
+ move.source = getParam(sourceTemp);
+ move.result = getResultParam(targetTemp);
+ addInstruction(move);
+ return;
+ }
Instruction::UPlus uplus;
uplus.source = getParam(sourceTemp);
uplus.result = getResultParam(targetTemp);
@@ -634,6 +642,55 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource
if (_stackSlotAllocator && target && leftSource->asTemp())
_stackSlotAllocator->addHint(*leftSource->asTemp(), *target);
+ if (oper == V4IR::OpAdd) {
+ Instruction::Add add;
+ add.lhs = getParam(leftSource);
+ add.rhs = getParam(rightSource);
+ add.result = getResultParam(target);
+ addInstruction(add);
+ return add.result;
+ }
+ if (oper == V4IR::OpSub) {
+ Instruction::Sub sub;
+ sub.lhs = getParam(leftSource);
+ sub.rhs = getParam(rightSource);
+ sub.result = getResultParam(target);
+ addInstruction(sub);
+ return sub.result;
+ }
+ if (oper == V4IR::OpMul) {
+ Instruction::Mul mul;
+ mul.lhs = getParam(leftSource);
+ mul.rhs = getParam(rightSource);
+ mul.result = getResultParam(target);
+ addInstruction(mul);
+ return mul.result;
+ }
+ if (oper == V4IR::OpBitAnd) {
+ Instruction::BitAnd bitAnd;
+ bitAnd.lhs = getParam(leftSource);
+ bitAnd.rhs = getParam(rightSource);
+ bitAnd.result = getResultParam(target);
+ addInstruction(bitAnd);
+ return bitAnd.result;
+ }
+ if (oper == V4IR::OpBitOr) {
+ Instruction::BitOr bitOr;
+ bitOr.lhs = getParam(leftSource);
+ bitOr.rhs = getParam(rightSource);
+ bitOr.result = getResultParam(target);
+ addInstruction(bitOr);
+ return bitOr.result;
+ }
+ if (oper == V4IR::OpBitXor) {
+ Instruction::BitXor bitXor;
+ bitXor.lhs = getParam(leftSource);
+ bitXor.rhs = getParam(rightSource);
+ bitXor.result = getResultParam(target);
+ addInstruction(bitXor);
+ return bitXor.result;
+ }
+
if (oper == V4IR::OpInstanceof || oper == V4IR::OpIn || oper == V4IR::OpAdd) {
Instruction::BinopContext binop;
if (oper == V4IR::OpInstanceof)
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index a5a94cd149..0901bfbd52 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -500,6 +500,30 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code,
STOREVALUE(instr.result, instr.alu(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(Binop)
+ MOTH_BEGIN_INSTR(Add)
+ STOREVALUE(instr.result, __qmljs_add(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(Add)
+
+ MOTH_BEGIN_INSTR(BitAnd)
+ STOREVALUE(instr.result, __qmljs_bit_and(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(BitAnd)
+
+ MOTH_BEGIN_INSTR(BitOr)
+ STOREVALUE(instr.result, __qmljs_bit_or(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(BitOr)
+
+ MOTH_BEGIN_INSTR(BitXor)
+ STOREVALUE(instr.result, __qmljs_bit_xor(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(BitXor)
+
+ MOTH_BEGIN_INSTR(Mul)
+ STOREVALUE(instr.result, __qmljs_mul(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(Mul)
+
+ MOTH_BEGIN_INSTR(Sub)
+ STOREVALUE(instr.result, __qmljs_sub(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ MOTH_END_INSTR(Sub)
+
MOTH_BEGIN_INSTR(BinopContext)
STOREVALUE(instr.result, instr.alu(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(BinopContext)