diff options
author | Lars Knoll <[email protected]> | 2017-04-06 13:51:12 +0200 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2017-04-06 12:14:37 +0000 |
commit | fd0ee94d961458760243db8ec7306206905ef4f9 (patch) | |
tree | 22d15595a7ddbd1f5dd6eb4338c4f160a1698222 /src/qml/jsruntime/qv4context.cpp | |
parent | b78508f55f6ada95a51ca7d8051382178c27abce (diff) |
Correctly compute the amount of variables we need to mark
CallContext.locals.alloc was computed incorrectly. This
number is being used to determine which memory could
contain valid pointers during marking.
The old code was off by 2, leading to the last two arguments
not getting marked properly during GC.
Fixes a regression introduced in 3a0bb11d.
Task-number: QTBUG-59928
Task-number: QTBUG-59600
Change-Id: I88f58a237c9a5f02434c0d4081c4e368cd944a5b
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index b71e71b92f..02d3af619e 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -62,9 +62,8 @@ DEFINE_MANAGED_VTABLE(GlobalContext); Heap::CallContext *ExecutionContext::newCallContext(Function *function, CallData *callData) { - uint localsAndFormals = function->compiledFunction->nLocals + qMax(static_cast<uint>(callData->argc), function->nFormals); - size_t requiredMemory = sizeof(CallContext::Data) - sizeof(Value) + \ - sizeof(Value) * (localsAndFormals) + sizeof(CallData) - sizeof(Value); + uint localsAndFormals = function->compiledFunction->nLocals + sizeof(CallData)/sizeof(Value) - 1 + qMax(static_cast<uint>(callData->argc), function->nFormals); + size_t requiredMemory = sizeof(CallContext::Data) - sizeof(Value) + sizeof(Value) * (localsAndFormals); Heap::CallContext *c = d()->engine->memoryManager->allocManaged<CallContext>(requiredMemory); c->init(d()->engine, Heap::ExecutionContext::Type_CallContext); |