diff options
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 8a6f1044b9..59b88c3160 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -59,7 +59,7 @@ Heap::CallContext *ExecutionContext::newBlockContext(CppStackFrame *frame, int b Function *function = frame->v4Function; Heap::InternalClass *ic = function->compilationUnit->runtimeBlocks.at(blockIndex); - int nLocals = ic->size; + uint nLocals = ic->size; size_t requiredMemory = sizeof(CallContext::Data) - sizeof(Value) + sizeof(Value) * nLocals; ExecutionEngine *v4 = function->internalClass->engine; @@ -77,6 +77,19 @@ Heap::CallContext *ExecutionContext::newBlockContext(CppStackFrame *frame, int b return c; } +Heap::CallContext *ExecutionContext::cloneBlockContext(Heap::CallContext *context) +{ + uint nLocals = context->locals.alloc; + size_t requiredMemory = sizeof(CallContext::Data) - sizeof(Value) + sizeof(Value) * nLocals; + + ExecutionEngine *v4 = context->internalClass->engine; + Heap::CallContext *c = v4->memoryManager->allocManaged<CallContext>(requiredMemory, context->internalClass); + memcpy(c, context, requiredMemory); + + return c; + +} + Heap::CallContext *ExecutionContext::newCallContext(CppStackFrame *frame) { Function *function = frame->v4Function; |