aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-02-06 15:05:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-07 10:44:30 +0100
commitaaa8257d988f10f8a6f92d6e687d9aaf678aa05c (patch)
tree73fee6efd269ef1cc8ccabd44ccce893b21331e0 /src/qml
parentcd3736db10a8105d8dca09327b6efb139ce2ed1b (diff)
Specialize CJump into JumpEq and JumpNe
This avoids the bool invert in the instruction stream, and some additional code in the VME. Change-Id: I0ea675a2e3d07c1b8c5234b888d8d9683bcee330 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h14
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp12
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp15
3 files changed, 26 insertions, 15 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index c49b0798ad..7d15b4b010 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -107,7 +107,8 @@ QT_BEGIN_NAMESPACE
F(CreateActivationProperty, createActivationProperty) \
F(ConstructGlobalLookup, constructGlobalLookup) \
F(Jump, jump) \
- F(CJump, cjump) \
+ F(JumpEq, jumpEq) \
+ F(JumpNe, jumpNe) \
F(UNot, unot) \
F(UNotBool, unotBool) \
F(UPlus, uplus) \
@@ -556,11 +557,15 @@ union Instr
MOTH_INSTR_HEADER
ptrdiff_t offset;
};
- struct instr_cjump {
+ struct instr_jumpEq {
+ MOTH_INSTR_HEADER
+ ptrdiff_t offset;
+ Param condition;
+ };
+ struct instr_jumpNe {
MOTH_INSTR_HEADER
ptrdiff_t offset;
Param condition;
- bool invert;
};
struct instr_unot {
MOTH_INSTR_HEADER
@@ -796,7 +801,8 @@ union Instr
instr_createActivationProperty createActivationProperty;
instr_constructGlobalLookup constructGlobalLookup;
instr_jump jump;
- instr_cjump cjump;
+ instr_jumpEq jumpEq;
+ instr_jumpNe jumpNe;
instr_unot unot;
instr_unotBool unotBool;
instr_uplus uplus;
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 79077b6797..df102af73b 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -918,16 +918,16 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
Q_UNIMPLEMENTED();
}
- Instruction::CJump jump;
- jump.offset = 0;
- jump.condition = condition;
-
if (s->iftrue == _nextBlock) {
- jump.invert = true;
+ Instruction::JumpNe jump;
+ jump.offset = 0;
+ jump.condition = condition;
ptrdiff_t falseLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
_patches[s->iffalse].append(falseLoc);
} else {
- jump.invert = false;
+ Instruction::JumpEq jump;
+ jump.offset = 0;
+ jump.condition = condition;
ptrdiff_t trueLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
_patches[s->iftrue].append(trueLoc);
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 4434c34ef8..3d7ce0efcf 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -552,14 +552,19 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
code = ((uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(Jump)
- MOTH_BEGIN_INSTR(CJump)
- uint cond = __qmljs_to_boolean(VALUEPTR(instr.condition));
+ MOTH_BEGIN_INSTR(JumpEq)
+ bool cond = VALUEPTR(instr.condition)->toBoolean();
TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
- if (instr.invert)
- cond = !cond;
if (cond)
code = ((uchar *)&instr.offset) + instr.offset;
- MOTH_END_INSTR(CJump)
+ MOTH_END_INSTR(JumpEq)
+
+ MOTH_BEGIN_INSTR(JumpNe)
+ bool cond = VALUEPTR(instr.condition)->toBoolean();
+ TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
+ if (!cond)
+ code = ((uchar *)&instr.offset) + instr.offset;
+ MOTH_END_INSTR(JumpNe)
MOTH_BEGIN_INSTR(UNot)
STOREVALUE(instr.result, __qmljs_not(VALUEPTR(instr.source)));