aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-05 14:56:24 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-07 10:31:53 +0000
commit15bdbd89639c29f88db1798de66066a4a95759c0 (patch)
treefd06324c900c9eb662f3f64cb1d1f1d45186ecb3 /src/qml/jit
parent06e3ff28bb52500ae45f0c174ff8cd746593855c (diff)
Fix exception handling while destructuring
When an exception happens during destructuring, IteratorClose needs to be called, unless the exception happened inside the IteratorNext call (in that case the iterator is assumed to be invalid and we shouldn't call close on it). Implement this, by ensuring that we set the done return variable of IteratorNext to true whenever IteratorNext throws an exception. IteratorClose will check the done state and not do anything in that case. Change-Id: I73a27f855f2c4d3134b8cc8980e64bf797d03886 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit')
-rw-r--r--src/qml/jit/qv4baselinejit.cpp3
-rw-r--r--src/qml/jit/qv4baselinejit_p.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp
index 9e9c586982..d0ac169e4f 100644
--- a/src/qml/jit/qv4baselinejit.cpp
+++ b/src/qml/jit/qv4baselinejit.cpp
@@ -682,7 +682,7 @@ void BaselineJIT::generate_GetIterator(int iterator)
as->checkException();
}
-void BaselineJIT::generate_IteratorNext(int value)
+void BaselineJIT::generate_IteratorNext(int value, int done)
{
as->saveAccumulatorInFrame();
as->prepareCallWithArgCount(3);
@@ -690,6 +690,7 @@ void BaselineJIT::generate_IteratorNext(int value)
as->passAccumulatorAsArg(1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(Runtime::method_iteratorNext, CallResultDestination::InAccumulator);
+ as->storeReg(done);
as->checkException();
}
diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h
index 972e9d07b7..7e3fcfa5e6 100644
--- a/src/qml/jit/qv4baselinejit_p.h
+++ b/src/qml/jit/qv4baselinejit_p.h
@@ -148,7 +148,7 @@ public:
void generate_PopScriptContext() override;
void generate_PopContext() override;
void generate_GetIterator(int iterator) override;
- void generate_IteratorNext(int value) override;
+ void generate_IteratorNext(int value, int done) override;
void generate_IteratorClose(int done) override;
void generate_DestructureRestElement() override;
void generate_DeleteProperty(int base, int index) override;