aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-07-23 13:56:43 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-04 14:58:30 +0100
commit3f1d0b27a11a1d560c11057d2a801224d1613d60 (patch)
treea35184460b77be487fa15aaa0e823334e406b833 /src/qml/jsruntime/qv4context.cpp
parent8daace55a2c43ec354e5d778a42f9c421f9f9232 (diff)
Changed Value to store Managed::Data pointers directly
This is a step towards storing direct heap object pointers for the values on the JS stack, to avoid the costly indirection for data access. Change-Id: Ibb57ed6cf52a7088bbc95ee04ae3a4cb25b8c045 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 5ca47a80b1..8f9f8cc423 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -48,7 +48,7 @@ DEFINE_MANAGED_VTABLE(CallContext);
DEFINE_MANAGED_VTABLE(WithContext);
DEFINE_MANAGED_VTABLE(GlobalContext);
-HeapObject *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
+Returned<ExecutionContext> *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
Q_ASSERT(function->function());
@@ -78,24 +78,25 @@ HeapObject *ExecutionContext::newCallContext(FunctionObject *function, CallData
std::fill(c->callData->args + c->callData->argc, c->callData->args + compiledFunction->nFormals, Primitive::undefinedValue());
c->callData->argc = qMax((uint)callData->argc, compiledFunction->nFormals);
- return c;
+ return Returned<ExecutionContext>::create(c);
}
-WithContext *ExecutionContext::newWithContext(Object *with)
+Returned<WithContext> *ExecutionContext::newWithContext(Object *with)
{
return d()->engine->memoryManager->alloc<WithContext>(d()->engine, with);
}
-CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const ValueRef exceptionValue)
+Returned<CatchContext> *ExecutionContext::newCatchContext(String *exceptionVarName, const ValueRef exceptionValue)
{
return d()->engine->memoryManager->alloc<CatchContext>(d()->engine, exceptionVarName, exceptionValue);
}
-CallContext *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml)
+Returned<CallContext> *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml)
{
- CallContext *c = reinterpret_cast<CallContext*>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
+ Scope scope(this);
+ Scoped<CallContext> c(scope, static_cast<CallContext*>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0))));
new (c->d()) CallContext::Data(d()->engine, qml, f);
- return c;
+ return c.asReturned();
}