aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2013-08-17 12:08:21 +0200
committerLars Knoll <[email protected]>2013-08-18 12:28:24 +0200
commit45dacdaa788eeac64148465658b6af2d2fa552cf (patch)
tree2e527ab9e1b3de23e7dac8011cefc8609ba1d26d /src/qml/jsruntime/qv4context.cpp
parent314a977217fc158f17fbdda85d7e80edbccc7c7d (diff)
Fix eval operating on incorrect runtime data
Moved compilationUnit and compiledFunction into the context and set it also during eval, along with the runtime strings. Change-Id: I627b3bea0f7c38ad91bc5e8ee85e1484d08ed3f3 Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 3c0dbe35b7..3067cf0387 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -139,6 +139,8 @@ void WithContext::initWithContext(ExecutionContext *p, Object *with)
outer = p;
lookups = p->lookups;
runtimeStrings = p->runtimeStrings;
+ compilationUnit = p->compilationUnit;
+ compiledFunction = p->compiledFunction;
withObject = with;
}
@@ -151,6 +153,8 @@ void CatchContext::initCatchContext(ExecutionContext *p, String *exceptionVarNam
outer = p;
lookups = p->lookups;
runtimeStrings = p->runtimeStrings;
+ compilationUnit = p->compilationUnit;
+ compiledFunction = p->compiledFunction;
this->exceptionVarName = exceptionVarName;
this->exceptionValue = exceptionValue;
@@ -175,8 +179,10 @@ void CallContext::initCallContext(ExecutionContext *parentContext, FunctionObjec
activation = 0;
if (function->function) {
- lookups = function->function->compilationUnit->runtimeLookups;
- runtimeStrings = function->function->compilationUnit->runtimeStrings;
+ compilationUnit = function->function->compilationUnit;
+ compiledFunction = function->function->compiledFunction;
+ lookups = compilationUnit->runtimeLookups;
+ runtimeStrings = compilationUnit->runtimeStrings;
}
uint argc = argumentCount;
@@ -223,8 +229,10 @@ void CallContext::initQmlContext(ExecutionContext *parentContext, Object *qml, F
activation = qml;
- lookups = function->function->compilationUnit->runtimeLookups;
- runtimeStrings = function->function->compilationUnit->runtimeStrings;
+ compilationUnit = function->function->compilationUnit;
+ compiledFunction = function->function->compiledFunction;
+ lookups = compilationUnit->runtimeLookups;
+ runtimeStrings = compilationUnit->runtimeStrings;
locals = (Value *)(this + 1);
if (function->varCount)
@@ -610,20 +618,6 @@ void ExecutionContext::throwURIError(Value msg)
throwError(Value::fromObject(engine->newURIErrorObject(msg)));
}
-const Function *ExecutionContext::runtimeFunction() const
-{
- const ExecutionContext *ctx = this;
- if (ctx->type == Type_CatchContext)
- ctx = ctx->parent;
- if (ctx->type >= Type_CallContext) {
- const QV4::FunctionObject *f = ctx->asCallContext()->function;
- Q_ASSERT(f);
- return f ? f->function : 0;
- }
- Q_ASSERT(ctx->type == Type_GlobalContext);
- return engine->globalCode;
-}
-
void SimpleCallContext::initSimpleCallContext(ExecutionEngine *engine)
{
initBaseContext(Type_SimpleCallContext, engine, engine->current);