aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-11-27 22:16:09 +0100
committerLars Knoll <lars.knoll@qt.io>2018-01-03 07:45:31 +0000
commit5f777705b73ad1d4a11c59ad1468621360658820 (patch)
tree19a44a7fd437d15ed3b46180d948a11b8898e36e /src/qml/jit
parent4ca1a2b7ad2ae5051d3cfa81e2985260f844213f (diff)
Optimize cmpEq/NeInt
Change-Id: I67d3ba6b8bb9c44ba8477c959d389c8a8099aeb2 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jit')
-rw-r--r--src/qml/jit/qv4assembler.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index e15cf32214..790598d5c0 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -796,6 +796,12 @@ struct PlatformAssembler64 : PlatformAssemblerCommon
isUndef.link(this);
}
+ Jump isIntOrBool()
+ {
+ urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerOrBool_Shift), ScratchRegister);
+ return branch32(Equal, TrustedImm32(3), ScratchRegister);
+ }
+
void jumpStrictEqualStackSlotInt(int lhs, int rhs, int offset)
{
Address lhsAddr(JSStackFrameRegister, lhs * int(sizeof(Value)));
@@ -1107,6 +1113,12 @@ struct PlatformAssembler32 : PlatformAssemblerCommon
done.link(this);
}
+ Jump isIntOrBool()
+ {
+ urshift32(AccumulatorRegisterTag, TrustedImm32(Value::IsIntegerOrBool_Shift - 32), ScratchRegister);
+ return branch32(Equal, TrustedImm32(3), ScratchRegister);
+ }
+
void pushValue(ReturnedValue v)
{
push(TrustedImm32(v >> 32));
@@ -1761,6 +1773,7 @@ void Assembler::cmpneNull()
void Assembler::cmpeqInt(int lhs)
{
+ auto isIntOrBool = pasm()->isIntOrBool();
saveAccumulatorInFrame();
pasm()->pushValueAligned(Encode(lhs));
if (PlatformAssembler::ArgInRegCount < 2)
@@ -1772,10 +1785,18 @@ void Assembler::cmpeqInt(int lhs)
if (PlatformAssembler::ArgInRegCount < 2)
pasm()->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);
pasm()->popValueAligned();
+ auto done = pasm()->jump();
+ isIntOrBool.link(pasm());
+ pasm()->compare32(PlatformAssembler::Equal, PlatformAssembler::AccumulatorRegisterValue,
+ TrustedImm32(lhs),
+ PlatformAssembler::AccumulatorRegisterValue);
+ pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
+ done.link(pasm());
}
void Assembler::cmpneInt(int lhs)
{
+ auto isIntOrBool = pasm()->isIntOrBool();
saveAccumulatorInFrame();
pasm()->pushValueAligned(Encode(lhs));
if (PlatformAssembler::ArgInRegCount < 2)
@@ -1787,6 +1808,13 @@ void Assembler::cmpneInt(int lhs)
if (PlatformAssembler::ArgInRegCount < 2)
pasm()->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);
pasm()->popValueAligned();
+ auto done = pasm()->jump();
+ isIntOrBool.link(pasm());
+ pasm()->compare32(PlatformAssembler::NotEqual, PlatformAssembler::AccumulatorRegisterValue,
+ TrustedImm32(lhs),
+ PlatformAssembler::AccumulatorRegisterValue);
+ pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
+ done.link(pasm());
}
void Assembler::cmp(int cond, CmpFunc function, const char *functionName, int lhs)