diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-06-22 09:28:47 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-06-23 06:39:27 +0000 |
commit | 1f056ae9e67a90cbbb6dc2a1c21ed7c361a5c108 (patch) | |
tree | 5f8ea74e3e36a66fb4877d2d6fdfa24e3f6a4914 /src/qml | |
parent | e56fdca238600f33acba98b5102ad8a18d5af8a7 (diff) |
Add run time assertion for local handling
Commit f44782d0cdbdb800d9c31d5aff712fbf29d52edc fixed the missing call
context creation that would lead to
language/statements/break/S12.8_A2.js failing. It wouldn't always fail
as the invalid cast from the global context to a call context would
access memory that happens to be available just for the test. An
assertion however will not require us to rely on memory setup.
Change-Id: I131a2242004cd5e4d518e58cc9f6a79037f962d2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 18aae4bd32..f625368b62 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -559,12 +559,14 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const char *code) MOTH_BEGIN_INSTR(LoadLocal) auto cc = static_cast<Heap::CallContext *>(stack[CallData::Context].m()); + Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext); acc = cc->locals[index].asReturnedValue(); MOTH_END_INSTR(LoadLocal) MOTH_BEGIN_INSTR(StoreLocal) CHECK_EXCEPTION; auto cc = static_cast<Heap::CallContext *>(stack[CallData::Context].m()); + Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext); QV4::WriteBarrier::write(engine, cc, cc->locals.values[index].data_ptr(), acc); MOTH_END_INSTR(StoreLocal) |