diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-08-04 13:38:33 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-08-18 09:56:28 +0000 |
commit | 4f9875a10ff67aafebe227e9f5ea1b7b97abb52e (patch) | |
tree | 75504c1c17304c5118ac8ffc84bb626dbdd6d1c2 /src/qml/compiler/qv4bytecodegenerator_p.h | |
parent | ebc6979801d86ae79dbbbb64c8793d90e0508d18 (diff) |
Don't use a return value register for regular functions
don't use the return value register for normal functions
anymore. It's still needed for eval code and qml bindings
that have an implicit return value, as the accumulator gets
clobbered too easily in those cases.
Also get rid of the exit block we used to generate.
Adjust the control flow handlers to correctly unwind. This
required adding some jump instructions that left the
accumulator untouched (as it now holds the return value)
and using those in handlers.
Change-Id: I2ca1afaf7234cb632e5d26ba5b10ec3f11f50c93
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4bytecodegenerator_p.h')
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator_p.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index 81b64f96da..f53a720d2c 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -77,6 +77,14 @@ public: index(generator->labels.size()) { generator->labels.append(mode == LinkNow ? generator->instructions.size() : -1); } + static Label returnLabel() { + Label l; + l.index = INT_MAX; + return l; + } + bool isReturn() const { + return index == INT_MAX; + } void link() { Q_ASSERT(index >= 0); @@ -176,6 +184,22 @@ public: return addJumpInstruction(data); } + Q_REQUIRED_RESULT Jump jumpStrictEqualStackSlotInt(const StackSlot &lhs, int rhs) + { + Instruction::JumpStrictEqualStackSlotInt data; + data.lhs = lhs; + data.rhs = rhs; + return addJumpInstruction(data); + } + + Q_REQUIRED_RESULT Jump jumpStrictNotEqualStackSlotInt(const StackSlot &lhs, int rhs) + { + Instruction::JumpStrictNotEqualStackSlotInt data; + data.lhs = lhs; + data.rhs = rhs; + return addJumpInstruction(data); + } + void setExceptionHandler(ExceptionHandler *handler) { currentExceptionHandler = handler; |