diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-02-10 17:04:32 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-25 17:49:09 +0000 |
commit | b59b727035c4c1a4d235432cc67e5d89d3a24cd3 (patch) | |
tree | b452f39eab452a8a472dfc5c9b7e89ab4a354c1f /src/qml/jit/qv4assembler.cpp | |
parent | 2683a22364f742e3809b6c48570b0b4aaf37b31f (diff) |
ES6: add support for default arguments for function parameters
The parser can also handle rest parameters correctly, this will
however require some additional work in the runtime to support
it correctly.
Change-Id: Ib6f4d27683774966b2d2aac075494d2f5066d2a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit/qv4assembler.cpp')
-rw-r--r-- | src/qml/jit/qv4assembler.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp index c3e16c4093..890d9d03a1 100644 --- a/src/qml/jit/qv4assembler.cpp +++ b/src/qml/jit/qv4assembler.cpp @@ -701,6 +701,12 @@ struct PlatformAssembler64 : PlatformAssemblerCommon PlatformAssemblerCommon::generateCatchTrampoline([this](){loadUndefined();}); } + void jumpNotUndefined(int offset) + { + auto jump = branch64(NotEqual, AccumulatorRegister, TrustedImm64(0)); + patches.push_back({ jump, offset }); + } + void toBoolean(std::function<void(RegisterID)> continuation) { urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister); @@ -1136,6 +1142,14 @@ struct PlatformAssembler32 : PlatformAssemblerCommon push(TrustedImm32(v)); } + void jumpNotUndefined(int offset) + { + move(AccumulatorRegisterTag, ScratchRegister); + or32(AccumulatorRegisterValue, ScratchRegister); + auto jump = branch32(NotEqual, ScratchRegister, TrustedImm32(0)); + patches.push_back({ jump, offset }); + } + void toBoolean(std::function<void(RegisterID)> continuation) { urshift32(AccumulatorRegisterTag, TrustedImm32(Value::IsIntegerConvertible_Shift - 32), @@ -1982,6 +1996,11 @@ void Assembler::jumpFalse(int offset) }); } +void Assembler::jumpNotUndefined(int offset) +{ + pasm()->jumpNotUndefined(offset); +} + void Assembler::jumpStrictEqualStackSlotInt(int lhs, int rhs, int offset) { pasm()->jumpStrictEqualStackSlotInt(lhs, rhs, offset); |