diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-08-20 12:20:28 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-08-20 11:50:15 +0000 |
commit | e47bd1fc0e6fc2b2e3ca82c48ccb2f8f7dd5ee92 (patch) | |
tree | a5c98155ca381ebee6fe4f7c455f9b3dac73c604 /src/qml/jit/qv4baselinejit_p.h | |
parent | 87a4d4babe0a3d6b8a57048205eccc7105931474 (diff) |
V4: clarify current vs. next instruction offset in ByteCodeHandler
When executing an interpreter instruction, the code pointer points to
the next instruction. However, sometimes a pointer to the current
instruction is needed. That was hacked-around by having startInstruction
be called before updating the pointer. This is confusing and leads to
unexpected off-by-one-instruction cases.
So now during startInstruction calls and generate_instructionName calls,
there is a currentInstructionOffset() and a nextInstructionOffset() that
do what's on the tin in both places.
Change-Id: Ie8dd35ff0a7d236f008030ef4c29ec3f31c07349
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit/qv4baselinejit_p.h')
-rw-r--r-- | src/qml/jit/qv4baselinejit_p.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h index 71b9dda9b9..6f066bb9a5 100644 --- a/src/qml/jit/qv4baselinejit_p.h +++ b/src/qml/jit/qv4baselinejit_p.h @@ -214,7 +214,10 @@ public: protected: bool hasLabel() const - { return std::find(labels.cbegin(), labels.cend(), instructionOffset()) != labels.cend(); } + { return std::find(labels.cbegin(), labels.cend(), currentInstructionOffset()) != labels.cend(); } + + int absoluteOffsetForJump(int relativeOffset) const + { return nextInstructionOffset() + relativeOffset; } private: QV4::Function *function; |