From e6180ecdc2144786c58d2f9d615f698ca3442382 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Sep 2013 13:48:33 +0200 Subject: Properly unwind the js stack for generated code Surround all calls into generated code with a try {} catch {} statement that resets the jstack to the correct position. Like this we properly unwind the js stack in all cases, and can also use stricter assertions in our ScopedCallData, etc. classes to check that the stack is healthy. Change-Id: I7ca03e06ea55007be683305d9c2a6898cf5fc689 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4function.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/qml/jsruntime/qv4function.cpp') diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index e989d31c1b..9907f3e2ba 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -54,21 +54,14 @@ using namespace QV4; Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function, Value (*codePtr)(ExecutionContext *, const uchar *), quint32 _codeSize) : name(0) - , compiledFunction(0) - , compilationUnit(0) - , code(0) + , compiledFunction(function) + , compilationUnit(unit) + , codePtr(codePtr) , codeData(0) - , codeSize(0) + , codeSize(_codeSize) { - Q_ASSERT(!compilationUnit); - compilationUnit = unit; - compiledFunction = function; - name = compilationUnit->runtimeStrings[compiledFunction->nameIndex]; - code = codePtr; - codeSize = _codeSize; - formals.resize(compiledFunction->nFormals); const quint32 *formalsIndices = compiledFunction->formalsTable(); for (int i = 0; i < compiledFunction->nFormals; ++i) -- cgit v1.2.3