aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assembler.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-11 22:23:56 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-13 12:55:20 +0000
commit3d5ba9f86e32950204bfcdf6591c4740a8ef7507 (patch)
tree9c599ad6b7fd2bd06d0880dde70ff21d6f522bef /src/qml/jit/qv4assembler.cpp
parent2d6b08bd17377aa6bcb663029a196a8d19cac6ac (diff)
Add instructions to simplify for-of loops
Added an IteratorNext instruction to fetch the next iteration value (empty if the iterator is done). This will also help to implement array destructuring without requiring huge amounts of byte code. Change-Id: If96c1e81471e5e2b0b7b2af122238d87741aa371 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit/qv4assembler.cpp')
-rw-r--r--src/qml/jit/qv4assembler.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index c73b3919ae..736dfd0908 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -707,6 +707,12 @@ struct PlatformAssembler64 : PlatformAssemblerCommon
patches.push_back({ jump, offset });
}
+ void jumpEmpty(int offset)
+ {
+ auto jump = branch64(Equal, AccumulatorRegister, TrustedImm64(Primitive::emptyValue().asReturnedValue()));
+ patches.push_back({ jump, offset });
+ }
+
void toBoolean(std::function<void(RegisterID)> continuation)
{
urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister);
@@ -1150,6 +1156,14 @@ struct PlatformAssembler32 : PlatformAssemblerCommon
patches.push_back({ jump, offset });
}
+ void jumpEmpty(int offset)
+ {
+ auto notEqual = branch32(NotEqual, AccumulatorRegisterTag, TrustedImm32(Primitive::emptyValue().asReturnedValue() >> 32));
+ auto jump = branch32(Equal, AccumulatorRegisterValue, TrustedImm32(Primitive::emptyValue().asReturnedValue() & 0xffffffff));
+ notEqual.link(this);
+ patches.push_back({ jump, offset });
+ }
+
void toBoolean(std::function<void(RegisterID)> continuation)
{
urshift32(AccumulatorRegisterTag, TrustedImm32(Value::IsIntegerConvertible_Shift - 32),
@@ -2001,6 +2015,11 @@ void Assembler::jumpNotUndefined(int offset)
pasm()->jumpNotUndefined(offset);
}
+void JIT::Assembler::jumpEmpty(int offset)
+{
+ pasm()->jumpEmpty(offset);
+}
+
void Assembler::jumpStrictEqualStackSlotInt(int lhs, int rhs, int offset)
{
pasm()->jumpStrictEqualStackSlotInt(lhs, rhs, offset);